Skip to content

Commit

Permalink
Merge pull request #14 from PiotrMachowski/dev
Browse files Browse the repository at this point in the history
v1.0.4
  • Loading branch information
PiotrMachowski authored Jan 23, 2022
2 parents 8633bac + 12a619e commit 84210c1
Show file tree
Hide file tree
Showing 10 changed files with 121 additions and 75 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/hacs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Validate HACS
on:
push:
pull_request:
jobs:
ci:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
name: Download repo
with:
fetch-depth: 0

- uses: actions/setup-python@v2
name: Setup Python
with:
python-version: '3.8.x'

- uses: actions/cache@v2
name: Cache
with:
path: |
~/.cache/pip
key: custom-component-ci

- name: HACS Action
uses: hacs/action@main
with:
CATEGORY: integration
12 changes: 12 additions & 0 deletions .github/workflows/hassfest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Validate with hassfest

on:
push:
pull_request:

jobs:
validate:
runs-on: "ubuntu-latest"
steps:
- uses: "actions/checkout@v2"
- uses: home-assistant/actions/hassfest@master
27 changes: 27 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Release

on:
release:
types: [published]

jobs:
release:
name: Prepare release
runs-on: ubuntu-latest
steps:
- name: Download repo
uses: actions/checkout@v1

- name: Zip burze_dzis_net dir
run: |
cd /home/runner/work/Home-Assistant-custom-components-Burze.dzis.net/Home-Assistant-custom-components-Burze.dzis.net/custom_components/burze_dzis_net
zip burze_dzis_net.zip -r ./
- name: Upload zip to release
uses: svenstaro/upload-release-action@v1-release
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: /home/runner/work/Home-Assistant-custom-components-Burze.dzis.net/Home-Assistant-custom-components-Burze.dzis.net/custom_components/burze_dzis_net/burze_dzis_net.zip
asset_name: burze_dzis_net.zip
tag: ${{ github.ref }}
overwrite: true
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2019 Piotr Machowski
Copyright (c) 2022 Piotr Machowski

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
41 changes: 34 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,26 @@
# Burze.dzis.net sensor
[![HACS Default][hacs_shield]][hacs]
[![GitHub Latest Release][releases_shield]][latest_release]
[![GitHub All Releases][downloads_total_shield]][releases]
[![Buy me a coffee][buy_me_a_coffee_shield]][buy_me_a_coffee]
[![PayPal.Me][paypal_me_shield]][paypal_me]


[hacs_shield]: https://img.shields.io/static/v1.svg?label=HACS&message=Default&style=popout&color=green&labelColor=41bdf5&logo=HomeAssistantCommunityStore&logoColor=white
[hacs]: https://hacs.xyz/docs/default_repositories

[latest_release]: https://github.com/PiotrMachowski/Home-Assistant-custom-components-Burze.dzis.net/releases/latest
[releases_shield]: https://img.shields.io/github/release/PiotrMachowski/Home-Assistant-custom-components-Burze.dzis.net.svg?style=popout

[releases]: https://github.com/PiotrMachowski/Home-Assistant-custom-components-Burze.dzis.net/releases
[downloads_total_shield]: https://img.shields.io/github/downloads/PiotrMachowski/Home-Assistant-custom-components-Burze.dzis.net/total

[buy_me_a_coffee_shield]: https://img.shields.io/static/v1.svg?label=%20&message=Buy%20me%20a%20coffee&color=6f4e37&logo=buy%20me%20a%20coffee&logoColor=white
[buy_me_a_coffee]: https://www.buymeacoffee.com/PiotrMachowski

[![hacs_badge](https://img.shields.io/badge/HACS-Default-orange.svg)](https://github.com/custom-components/hacs)
[![buymeacoffee_badge](https://img.shields.io/badge/Donate-Buy%20Me%20a%20Coffee-ff813f?style=flat)](https://www.buymeacoffee.com/PiotrMachowski)
[![paypalme_badge](https://img.shields.io/badge/Donate-PayPal-0070ba?style=flat)](https://paypal.me/PiMachowski)
[paypal_me_shield]: https://img.shields.io/static/v1.svg?label=%20&message=PayPal.Me&logo=paypal
[paypal_me]: https://paypal.me/PiMachowski

# Burze.dzis.net sensor

This sensor uses official API to get weather warnings from [*Burze.dzis.net*](https://burze.dzis.net/). To get more detailed information about parameters of warnings visit [*official API documentation*](https://burze.dzis.net/soap.php?WSDL).

Expand Down Expand Up @@ -53,12 +71,20 @@ binary_sensor:

## Installation

Download [*binary_sensor.py*](https://github.com/PiotrMachowski/Home-Assistant-custom-components-Burze.dzis.net/raw/master/custom_components/burze_dzis_net/binary_sensor.py) and [*manifest.json*](https://github.com/PiotrMachowski/Home-Assistant-custom-components-Burze.dzis.net/raw/master/custom_components/burze_dzis_net/manifest.json) to `config/custom_components/burze_dzis_net` directory:
### Using [HACS](https://hacs.xyz/) (recommended)

This integration can be installed using HACS.
To do it search for `Burze.dzis.net` in *Integrations* section.

### Manual

To install this integration manually you have to download [*burze_dzis_net.zip*](https://github.com/PiotrMachowski/Home-Assistant-custom-components-Burze.dzis.net/releases/latest/download/burze_dzis_net.zip) and extract its contents to `config/custom_components/burze_dzis_net` directory:
```bash
mkdir -p custom_components/burze_dzis_net
cd custom_components/burze_dzis_net
wget https://github.com/PiotrMachowski/Home-Assistant-custom-components-Burze.dzis.net/raw/master/custom_components/burze_dzis_net/binary_sensor.py
wget https://github.com/PiotrMachowski/Home-Assistant-custom-components-Burze.dzis.net/raw/master/custom_components/burze_dzis_net/manifest.json
wget https://github.com/PiotrMachowski/Home-Assistant-custom-components-Burze.dzis.net/releases/latest/download/burze_dzis_net.zip
unzip burze_dzis_net.zip
rm burze_dzis_net.zip
```

## FAQ
Expand All @@ -75,3 +101,4 @@ wget https://github.com/PiotrMachowski/Home-Assistant-custom-components-Burze.dz
```

<a href="https://www.buymeacoffee.com/PiotrMachowski" target="_blank"><img src="https://bmc-cdn.nyc3.digitaloceanspaces.com/BMC-button-images/custom_images/orange_img.png" alt="Buy Me A Coffee" style="height: auto !important;width: auto !important;" ></a>
<a href="https://paypal.me/PiMachowski" target="_blank"><img src="https://www.paypalobjects.com/webstatic/mktg/logo/pp_cc_mark_37x23.jpg" border="0" alt="PayPal Logo" style="height: auto !important;width: auto !important;"></a>
1 change: 1 addition & 0 deletions custom_components/burze_dzis_net/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Burze.dzis.net"""
16 changes: 10 additions & 6 deletions custom_components/burze_dzis_net/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from homeassistant.util import Throttle
from homeassistant.util.dt import parse_datetime
from homeassistant.components.binary_sensor import PLATFORM_SCHEMA, ENTITY_ID_FORMAT
from homeassistant.components.binary_sensor import DEVICE_CLASS_SAFETY, PLATFORM_SCHEMA, ENTITY_ID_FORMAT
from homeassistant.const import CONF_NAME, CONF_RADIUS, CONF_API_KEY, ATTR_ATTRIBUTION, CONF_LATITUDE, CONF_LONGITUDE, \
CONF_SCAN_INTERVAL
import homeassistant.helpers.config_validation as cv
Expand Down Expand Up @@ -121,11 +121,15 @@ def __init__(self, entity_id, name, updater):
self._data = None

@property
def device_state_attributes(self):
def extra_state_attributes(self):
output = dict()
output[ATTR_ATTRIBUTION] = ATTRIBUTION
return output

@property
def device_class(self):
return DEVICE_CLASS_SAFETY

async def async_update(self):
await self._updater.async_update()

Expand All @@ -142,8 +146,8 @@ def is_on(self):
return data is not None and data[self._warning_key] > 0

@property
def device_state_attributes(self):
output = super().device_state_attributes
def extra_state_attributes(self):
output = super().extra_state_attributes
if self.is_on:
data = self._updater.ostrzezenia_pogodowe_output
output['level'] = data[self._warning_key]
Expand Down Expand Up @@ -171,8 +175,8 @@ def is_on(self):
return data is not None and data['liczba'] > 0

@property
def device_state_attributes(self):
output = super().device_state_attributes
def extra_state_attributes(self):
output = super().extra_state_attributes
if self.is_on:
data = self._updater.szukaj_burzy_output
output['number'] = data['liczba']
Expand Down
4 changes: 3 additions & 1 deletion custom_components/burze_dzis_net/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
"domain": "burze_dzis_net",
"name": "Burze.dzis.net",
"documentation": "https://github.com/PiotrMachowski/Home-Assistant-custom-components-Burze.dzis.net",
"issue_tracker": "https://github.com/PiotrMachowski/Home-Assistant-custom-components-Burze.dzis.net/issues",
"dependencies": [],
"codeowners": ["@PiotrMachowski"],
"requirements": ["zeep"],
"version": "v1.0.3"
"version": "v1.0.4",
"iot_class": "cloud_polling"
}
5 changes: 4 additions & 1 deletion hacs.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"name": "Burze.dzis.net sensor",
"domains": ["binary_sensor"],
"country": ["EU", "PL"]
"country": ["EU", "PL"],
"render_readme": true,
"zip_release": true,
"filename": "antistorm.zip"
}
59 changes: 0 additions & 59 deletions info.md

This file was deleted.

0 comments on commit 84210c1

Please sign in to comment.