Commit Graph

89 Commits (4ee5a29bc057e2bb38ff52f86f43bbc90434b366)

Author SHA1 Message Date
Franck Nijhof 140fc48ede
Remove invalidation version from ZHA deprecated config options (#37089) 2020-06-25 08:17:31 -04:00
Alexei Chetroi 7e1c836acb
Don't remove deprecated ZHA config option yet (#35627) 2020-05-14 13:50:54 -04:00
Alexei Chetroi c71a7b901f
New configuration flow for ZHA integration (#35161)
* Start gateway using new zigpy init.

Update config entry data  import.
Use new zigpy startup.
Fix config entry import without zha config section.
Auto form Zigbee network.

* Migrate config entry.

* New ZHA config entry flow.

Use lightweight probe() method for ZHA config entry validation when
available. Failback to old behavior of setting up Zigpy app if radio lib
does not provide probing.

* Clean ZHA_GW_RADIO

* Don't import ZHA device settings.

* Update config flow tests.

* Filter out empty manufacturer.

* Replace port path with an by-id device name.

* Rebase cleanup

* Use correct mock.

* Make lint happy again

* Update tests/components/zha/test_config_flow.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Update tests/components/zha/test_config_flow.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Update tests/components/zha/test_config_flow.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Use executor pool for IO

* Address comments.

Use AsyncMock from tests.

* Use core interface to test config flow.

* Use core interface to test config_flow.

* Address comments. Use core interface.

* Update ZHA dependencies.

* Schema guard

* Use async_update_entry for migration.

* Don't allow schema extra keys.

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2020-05-06 12:23:53 +02:00
David F. Mulcahey 13dda7bd98
Cleanup ZHA group entity lifecycle (#33977)
* Clean up ZHA group entity lifecycle

* group entities don't use state restore

* add tests
2020-04-10 13:17:48 -07:00
David F. Mulcahey 2a3c94bad0
Add group entity support to ZHA (#33196)
* split entity into base and entity

* add initial light group support

* add dispatching of groups to light

* added zha group object

* add group event listener

* add and remove group members

* get group by name

* fix rebase

* fix rebase

* use group_id for unique_id

* get entities from registry

* use group name

* update entity domain

* update zha storage to handle groups

* dispatch group entities

* update light group

* fix group remove and dispatch light group entities

* allow picking the domain for group entities

* beginning - auto determine entity domain

* move methods to helpers so they can be shared

* fix rebase

* remove double init groups... again

* cleanup startup

* use asyncio create task

* group entity discovery

* add logging and fix group name

* add logging and update group after probe if needed

* test add group via gateway

* add method to get group entity ids

* update storage

* test get group by name

* update storage on remove

* test group with single member

* add light group tests

* test some light group logic

* type hints

* fix tests and cleanup

* revert init changes except for create task

* remove group entity domain changing for now

* add missing import

* tricky code saving

* review comments

* clean up class defs

* cleanup

* fix rebase because I cant read

* make pylint happy
2020-03-25 07:23:54 -04:00
Alexei Chetroi 28c2f9caa9
Refactor ZHA platform setup (#33226)
Setup ZHA platforms only after successful gateway startup.
2020-03-24 20:32:46 -04:00
Alexei Chetroi 81cef9a281
Split ZHA device loading and entities adding (#33075)
* Split ZHA device loading and entities adding.
Load zha devices from ZHA gateway, but add entities after integration
was setup.

* Use hass.loop.create_task()
* Split ZHA device initialization from loading.
Restore and initialize ZHA devices separately.

* Use hass.async_create_task()
Load devices prior group initialization.
2020-03-21 13:25:43 -04:00
Alexei Chetroi c8c81d493d
Refactor ZHA setup (#32959)
* Refactor ZHA setup.
Catch errors and raise if needed.

* Cleanup.
2020-03-19 12:37:47 -04:00
Alexei Chetroi 3385893b77
ZHA device channel refactoring (#31971)
* Add ZHA core typing helper.
* Add aux_channels to ZHA rule matching.
* Add match rule claim_channels() method.
* Expose underlying zigpy device.
* Not sure we need this one.
* Move "base" channels.
* Framework for channel discovery.
* Make DEVICE_CLASS and REMOTE_DEVICE_TYPE default dicts.
* Remove attribute reporting configuration registry.
* Refactor channels.
- Refactor zha events
- Use compound IDs and unique_ids
- Refactor signal dispatching on attribute updates

* Use unique id compatible with entities unique ids.
* Refactor ZHA Entity registry.
Let match rule to check for the match.

* Refactor discovery to use new channels.
* Cleanup ZDO channel.
Remove unused zha store call.

* Handle channel configuration and initialization.
* Refactor ZHA Device to use new channels.
* Refactor ZHA Gateway to use new discovery framework.
Use hass.data for entity info intermediate store.

* Don't keep entities in hass.data.
* ZHA gateway new discovery framework.
* Refactor ZHA platform loading.
* Don't update ZHA entities, when restoring from zigpy.
* ZHA entity discover tests.
* Add AnalogInput sensor.
* Remove 0xFC02 based entity from Keen smart vents.
* Clean up IAS channels.
* Refactor entity restoration.
* Fix lumi.router entities name.
* Rename EndpointsChannel to ChannelPool.
* Make Channels.pools a list.
* Fix cover test.
* Fix FakeDevice class.
* Fix device actions.
* Fix channels typing.
* Revert update_before_add=False
* Refactor channel class matching.
* Use a helper function for adding entities.
* Make Pylint happy.
* Rebase cleanup.
* Update coverage for ZHA device type overrides.
* Use cluster_id for single output cluster registry.
* Remove ZHA typing from coverage.
* Fix tests.
* Address comments.
* Address comments.
2020-02-21 18:06:57 -05:00
David F. Mulcahey ef8eefc7a0 Remove ZHA establish device mappings function (#30423)
* remove establish_device_mappings
* inline init
2020-01-02 21:21:09 -05:00
Alexei Chetroi 315d0064fe
Fix zha circular import (#29802)
* Refactor zha.core.helpers.
* Make zha isort-able.
* Const import reorg.
* Keep DATA_ZHA config key on entry unload.
* Cleanup ZHA config flow.
* isort.
* Add test.
2019-12-10 00:00:04 -05:00
Bas Nijholt 6cc75fc6f3 Sort imports according to PEP8 for components starting with "Z" (#29784)
* use isort to sort imports for components starting with 'z'

* add skip to end of zha/core/channels/__init__.py

* put 'pylint: disable=import-error' at the right place

* remove the import of config_flow in zha/__init__.py

According to @balloob it is no longer needed.

* revert previous commit

* isort:skip homeassistant/components/zha/__init__.py completely
2019-12-09 18:54:54 +01:00
springstan 1ee8057662 Move imports to top for zha (#29555)
* Move imports to top for zha
* Move back some imports, add annotation for disabling import-outside-toplevel
* Move import config_flow before import api
2019-12-06 16:12:46 -05:00
Ville Skyttä 99c7608fb4 Lint config cleanups (#28864)
* Remove bunch of unneeded lint exclusions

* Use symbolic names instead of identifiers in pylint disables

* Tighten scope of some pylint disables
2019-11-25 22:40:08 -08:00
Ville Skyttä d88ca0f5cb Lint exclusions (#28655)
* Remove malformed pylint disable markers

* Remove some unused imports

* Remove some unneeded lint exclusions

* Remove more unneeded lint exclusions

* Add specific codes to all noqa's
2019-11-16 10:22:07 +01:00
Alexei Chetroi 8dbac9176e Refactor ZHA Zigbee channel registry. (#25716)
* Update test to catch regression.

* Refactor ZHA Core channels.

Use channel decorator for Zigbee channel registry.

* Update tests.

* Pylint
2019-08-05 15:40:29 -06:00
Alexei Chetroi 0c561aec4f
isort ZHA imports. (#25660) 2019-08-02 10:37:21 -04:00
Alexei Chetroi 77e4ff94fd ZHA code cleanup. (#25644)
* isort ZHA imports.

* Sort zha channel registry.

* Sort ZHA core registry.

* Sort ZHA core consts.
2019-08-02 06:05:23 -04:00
Paulus Schoutsen 4de97abc3a Black 2019-07-31 12:25:30 -07:00
David F. Mulcahey ac91423d71 Fix device name customization on ZHA add devices page (#25180)
* ensure new device exists

* clean up dev reg handling

* update test

* fix tests
2019-07-16 15:16:49 -07:00
David F. Mulcahey a9459c6d92
Remove ZHA device entity (#24909)
* move availability handling to device

* update last_seen format

* add battery sensor

* fix interval

* fix battery reporting now that it is a sensor

* remove zha entities and add battery sensor
2019-07-03 13:36:36 -04:00
Alexei Chetroi 8328ea6bd7 Bump ZHA modules versions. (#23705)
* Bump ZHA modules versions.

Bump bellows-homeassistant version.
Bump zigpy-homeassistant version.
Bump zigpy-xbee-homeassistant version.

* Update requirements_*.txt
2019-05-05 17:15:34 -04:00
cgtobi 2c07bfb9e0 Remove dependencies and requirements (#23024)
* Remove dependencies and requirements

* Revert "Remove dependencies and requirements"

This reverts commit fe7171b4cd.

* Remove dependencies and requirements

* Revert "Remove dependencies and requirements"

This reverts commit 391355ee2c.

* Remove dependencies and requirements

* Fix flake8 complaints

* Fix more flake8 complaints

* Revert non-component removals
2019-04-12 10:13:30 -07:00
Tobias Sauerwein 048b100eea Clean up docstrings (#22679)
* Clean up docstrings

* Fix long lines

* Fix more docstrings

* Fix more docstrings

* Fix more docstrings
2019-04-03 17:40:03 +02:00
Alexei Chetroi 625c8e0cee
Shutdown ZHAGateway on hass closing. (#22646)
* Shutdown ZHAGateway on hass stop.
* Cleanup ZHA event leftovers.
2019-04-03 09:40:48 -04:00
damarco c0ce86fa8e Bump zigpy (#22545) 2019-03-29 14:01:51 -07:00
David F. Mulcahey 300384410f
Refactor ZHA gateway into modules and add admin protections to API (#22023)
* refactor

* cleanup

* fix tests

* admin all the things
2019-03-14 10:20:25 -04:00
David F. Mulcahey 5ffb471198 Update ZHA state handling (#21866)
* make device available if it was seen within 2 hours

* more state restore

* cleanup init

* clean up storage stuff

* fix tests

* update state handling
2019-03-09 20:09:09 -08:00
David F. Mulcahey ac5ccd651c Bump quirks for ZHA and handle resulting battery % change (#21869)
* bump quirks and handle battery change

* move inside guard

* round battery
2019-03-09 12:14:58 -08:00
damarco 1a9dcaefd2 Bump zigpy-deconz (#21566) 2019-03-01 13:47:20 -05:00
David F. Mulcahey a34524febe Clean up ZHA post rewrite (#21448)
* update async handling to reduce unnecessary coroutine creation

* lint

* cleanup
2019-02-26 10:48:10 -08:00
damarco 1518a80069 Bump zigpy (#21203)
* Bump zigpy

* Update requirements

* Update test requirements

* Bump zigpy-deconz
2019-02-20 16:34:59 +01:00
David F. Mulcahey 3be8178035 Refactor ZHA listeners into channels (#21196)
* refactor listeners to channels

* update coveragerc
2019-02-19 09:58:22 -08:00
David F. Mulcahey d692251e62
Run tasks when ZHA devices become available (#20998)
* use tasks for message interception

* update available handling

* review comments and cleaned up check

* review comments
2019-02-13 08:52:29 -05:00
David F. Mulcahey d4c34c6b02 Cleanup zha listener lifecycle (#20789) 2019-02-07 09:23:01 +01:00
David F. Mulcahey e6cd04d711
ZHA component rewrite (#20434)
* rebase reorg

* update coveragerc for now

* sensor cleanup

* remove availability tracking for entities

* finish removing changes from tests

* review comments pass 1

* use asyncio.gather - review comments

* review comments

* cleanup - review comments

* review comments

* review comments

* cleanup

* cleanup - review comments

* review comments

* review comments

* use signal for removal

* correct comment

* remove entities from gateway

* remove dead module

* remove accidently committed file

* use named tuple - review comments

* squash bugs

* squash bugs

* add light and sensor back to coveragerc until % is higher
2019-02-06 13:33:21 -05:00
David F. Mulcahey 05d41bc0ee
introduce gateway (#20460) 2019-01-26 13:28:13 -05:00
David F. Mulcahey a0b93c2add
ZHA component rewrite part 1 (#20456)
* rearrange files

* add init to module

* update imports

* update coveragerc

* put blank line back... git raw view be damned
2019-01-26 08:54:49 -05:00
damarco b557157ea1 Add support for deconz radios to zha component (#20167)
* Add support for deconz radios

* Update check_zigpy_connection()
2019-01-16 16:09:09 -08:00
David F. Mulcahey 8748ace244 Make imports relative in ZHA component (#20020)
* make imports relative

* remove cyclic import
2019-01-16 11:06:22 -08:00
David F. Mulcahey 012e91f9b1 version bump for zha-quirks (#20019) 2019-01-12 15:21:30 +01:00
David F. Mulcahey 7be015fcc6 Add services and helper functions to support a config panel for ZHA (#19664)
* reconfigure zha device service

add log line to reconfigure service for consistency

* add entity functions to support new services

* added new services and web socket api and split them into their own module

* support manufacturer code

logging to debug

get safe value for manufacturer

* update services.yaml

* add comma back

* update coveragerc

* remove blank line

* fix type

* api cleanup - review comments

* move static method to helpers - review comment

* convert reconfigure service to websocket command - review comment

* change path

* fix attribute
2019-01-11 11:34:29 -08:00
David F. Mulcahey acdf9c7ce2 Relay events for onoff and levelcontrol output clusters in ZHA (#19863)
* auto relay events for onoff and levelcontrol output clusters

* fix docstring

* correct copy/paste failure - review comment

* add space - review comment
2019-01-08 17:20:50 +01:00
David F. Mulcahey ef180c489a check config instead of config_entry for quirks flag (#19730) 2019-01-04 14:00:26 -05:00
David F. Mulcahey bef85ecd2e Remove global from ZHA application controller (#19557)
* remove global from application controller per request

* remove unneeded line

* don't store controller application in hass.data - review comment
2018-12-25 09:20:09 +01:00
David F. Mulcahey 031ee71adf Add ZHA device handler library (#19099)
* event foundation

* implement quirks

* lock zha-quirks version

* allow quirks handling to be toggled on and off

* revert event commit

* disable warning

* update requirements_all

* Remove fix in favor of #19141

#19141 should be what ultimately corrects this issue.

* review comment
2018-12-12 17:06:22 +01:00
David F. Mulcahey f4f42176bd ZHA - Event foundation (#19095)
* event foundation

* add missing periods to comments

* reworked so that entities don't fire events

* lint

* review comments
2018-12-10 10:59:50 -05:00
Alexei Chetroi 3e1ab1b23a Sort import order of zha component. (#18993) 2018-12-04 11:38:57 +01:00
damarco 1ae58ce48b Add support for zha device registry (#18755) 2018-12-01 10:31:49 +01:00
damarco 052d305243 Add config entry for ZHA (#18352)
* Add support for zha config entries

* Add support for zha config entries

* Fix node_config retrieval

* Dynamically load discovered entities

* Restore device config support

* Refactor loading of entities

* Remove device registry support

* Send discovery_info directly

* Clean up discovery_info in hass.data

* Update tests

* Clean up rebase

* Simplify config flow

* Address comments

* Fix config path and zigpy check timeout

* Remove device entities when unloading config entry
2018-11-27 21:21:25 +01:00