Skip to content

Commit

Permalink
Bumped version of underlying library, bumped update version number
Browse files Browse the repository at this point in the history
  • Loading branch information
alryaz committed May 10, 2021
1 parent a2cca35 commit a0c2913
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 21 deletions.
47 changes: 30 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,29 @@
# HomeAssistant Hekr Integration
> HomeAssistant implementation of Hekr API communicator
>
>[![hacs_badge](https://img.shields.io/badge/HACS-Custom-orange.svg)](https://github.com/custom-components/hacs)
>[![hacs_badge](https://img.shields.io/badge/HACS-Default-green.svg)](https://github.com/custom-components/hacs)
>[![License](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
>[![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-green.svg)](https://github.com/alryaz/hass-hekr-component/graphs/commit-activity)
>[![Maintenance](https://img.shields.io/badge/Maintained%3F-bugfixes%20only-yellow.svg)](https://github.com/alryaz/hass-hekr-component/graphs/commit-activity)
>
>[![Donate Yandex](https://img.shields.io/badge/Donate-Yandex-red.svg)](https://money.yandex.ru/to/410012369233217)
>[![Donate PayPal](https://img.shields.io/badge/Donate-Paypal-blueviolet.svg)](https://www.paypal.me/alryaz)
## ❗❗❗❗❗❗❗❗❗ HOMEASSISTANT 0.97+ USERS ❗❗❗❗❗❗❗❗❗
**Update to version `v0.2.5` and greater is necessary to prevent "Home Assistant is still loading" message.**

## ❗❗❗ WARNING ❗❗❗
**THIS PROJECT IS HIGHLY _WORK-IN-PROGRESS_!!!**
Things are subject to change drastically until at least two to three different Hekr implementations are discovered and
added to the integration as well as the parent python module. Please, read release notes carefully before installing
or upgrading. __I am not responsible for damaging your devices in any way!__

## ❗❗❗ _Elro Connects_ owners ❗❗❗
This module **does not** yet support _Elro Connects_, however work has been done to make a testing implementation.
Testers with _Elro K1_ gateways are needed. Please, contact me via e-mail
<[[email protected]](mailto:[email protected]?subject=Elro%20Connects%20Integration)>.

## !!! BREAKING CHANGES IN >=0.2.0 !!!
- Platform setups are no longer supported. Unfortunately, this is a trade-off for supporting accounts.
When you update to the latest version, a persistent notification will appear containing necessary
YAML configuration that you can add to your configuration.yaml file.
- Config entry management mechanism vastly overhauled. While this should not influence
existing setups, it is advised to keep a backup of `core.config_entries` on update.
- From now on, entries created within interface **will override** YAML configuration. This is done
to facilitate capability of removing YAML entry live and replacing it with different config.

## Contribution
If you found yourself using Wisen application with any of your Smart Home devices, contact me via
e-mail <[email protected]>. The process of adding new devices is not yet completely formalized,
the milestone is set for a release-candidate version.
e-mail <[[email protected]](mailto:[email protected]?subject=Hekr%20for%20HomeAssistant%20Contribution)>.
The process of adding new devices is not yet completely formalized, the milestone is set for a release-candidate version.

Check original repository with HekrAPI bindings: [hekrapi-python: Hekr protocol bindings for Python](https://github.com/alryaz/hekrapi-python)

Expand All @@ -40,10 +34,14 @@ translation key, and submit a pull request. Alternatively you can send a transla
communication channels listed at the end of this page.

## Power meter protocol: `power_meter`

![Loaded badges for power meter protocol](https://raw.githubusercontent.com/alryaz/hass-hekr-component/master/images/power_meter/badges.png)

_(more screenshots available at: [images/power_meter](images/power_meter))_

### Supported devices
- HIKING DDS238-4W

### Example configuration
```yaml
hekr:
Expand Down Expand Up @@ -116,9 +114,24 @@ hekr:
```

## Fetching `device_id` and `control_key` for local setup
**The easiest way to accomplish this is to begin an integration flow with `account` setup type. Tick the box
`Create notification with device info`, and a persistent notification will appear containing compatible YAML config.**
The following steps (evidently) assume you already paired target device using Wisen.

### _Integrations_ menu
The easiest way to accomplish this is to begin an integration flow with `account` setup type.

Tick the box `Create notification with device info` during setup, and a persistent notification
will appear containing compatible YAML config.

### _Wisen_ application
To obtain `device_id` and `control_key`:
- Open _Wisen_ application
- Open sidebar menu (on the left)
- Select _Management_ menu entry
- Select your device
- Tap device icon at the top 5 times
- A toast notification will appear

### HttpCanary (packet sniffing, Android)
The following tutorial is left for educational purposes / explanation on how protocol decoding was done.

##### Pre-requisites:
Expand Down
10 changes: 7 additions & 3 deletions custom_components/hekr/hekr_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
PROTOCOL_MANUFACTURER, PROTOCOL_NAME, CONF_DEVICE, CONF_TOKEN_UPDATE_INTERVAL, DEFAULT_NAME_DEVICE, DEFAULT_TIMEOUT

if TYPE_CHECKING:
# noinspection PyProtectedMember
from hekrapi.device import _BaseConnector
from hekrapi.command import Command
from homeassistant.core import Event
from homeassistant.helpers.device_registry import DeviceRegistry, DeviceEntry
Expand Down Expand Up @@ -64,10 +66,12 @@ def __init__(self, hass: HomeAssistantType):
self.use_model_from_protocol = DEFAULT_USE_MODEL_FROM_PROTOCOL

self.hass.bus.async_listen_once(
EVENT_HOMEASSISTANT_START, self.callback_homeassistant_start
EVENT_HOMEASSISTANT_START,
self.callback_homeassistant_start
)
self.hass.bus.async_listen_once(
EVENT_HOMEASSISTANT_STOP, self.callback_homeassistant_stop
EVENT_HOMEASSISTANT_STOP,
self.callback_homeassistant_stop
)

# HomeAssistant event callbacks
Expand Down Expand Up @@ -164,7 +168,7 @@ def get_device_info_dict(self, device_id: DeviceID):
attrs['connections'] = set() # @TODO: physical address
attrs['name'] = device.device_name
attrs['sw_version'] = device.firmware_version
#attrs['hw_version'] = device.hardware_version
# attrs['hw_version'] = device.hardware_version

if self.use_model_from_protocol:
attrs['model'] = protocol.get(PROTOCOL_MODEL, model)
Expand Down
2 changes: 1 addition & 1 deletion custom_components/hekr/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"documentation": "https://github.com/alryaz/hass-hekr-component",
"dependencies": [],
"issue_tracker": "https://github.com/alryaz/hass-hekr-component/issues",
"version": "v0.2.7",
"version": "v0.2.7u1",
"codeowners": [
"@alryaz"
],
Expand Down

0 comments on commit a0c2913

Please sign in to comment.