Commit Graph

30 Commits (2d1002d40da81f5540e88022e3ac8039f39cd163)

Author SHA1 Message Date
springstan dde93304d3
Improve string formatting v2 (#33645)
* Improve string formatting v2

* Improve string formatting v3

* Address review comments
2020-04-04 23:09:34 +02:00
David F. Mulcahey 188ca630de
Miscellaneous ZHA code cleanup (#33395)
* cleanup state change listener

* update group id handling and unique id

* update test

* add guards for last_seen updates
2020-03-29 13:26:48 -04: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
David F. Mulcahey aa972b0005
Fix handling of attribute reports in ZHA sensors and binary sensors (#32776)
* Update sensor tests.

* Update light tests.

* Update binary_sensor tests.

* Update cover tests.

* Update device tracker tests.

* Update fan tests.

* Update lock tests.

* Update switch tests.

* add sensor attr to sensors

* add sensor attr to binary sensors

* cleanup extra var

Co-authored-by: Alexei Chetroi <alexei.chetroi@outlook.com>
2020-03-13 19:17:50 -04:00
Alexei Chetroi 87b770be08
Add PollControl cluster support to ZHA (#32618)
* Poll control channel

Set check-in interval to 55min.
Set long-poll interval to 6s.

* Update tests.

* Don't use magic numbers.
2020-03-09 19:55:25 -04:00
David F. Mulcahey e52542c4d7
Allow multiple attribute reads in ZHA (#32498)
* multi attribute reads for lights

* catch specific exceptions

* get attributes

* fix mains powered update

* add guards and use get_attributes

* use debug for read failures

* cleanup

* update return value for read_attributes

* fix on with timed off
2020-03-07 07:33:59 -05:00
Alexei Chetroi e416f17e4d
ZHA: Successful pairing feedback (#32456) 2020-03-04 19:27:37 -05: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 8255bdf3d5
Bump ZHA quirks and add skip configuration support (#31982)
* add skip configuration
* Bump quirks
* add skip configuration to FakeDevice
2020-02-19 09:19:26 -05:00
Alexei Chetroi 52fe1328f6
ZHA tests refactoring (#31744)
* Refactor ZHA fixtures.
Patch Zigpy radio libs instead of ZHA when setting up fixtures.
Use new fixtures for binary_sensor.zha platform.

* Update ZHA api tests.
* Update ZHA channels and discovery tests.
* Update ZHA cover tests.
* Update device action/trigger tests.
* Update device_tracker.zha platform tests.
* Update fan.zha platform tests.
* Update ZHA gateway tests.
* Update lock.zha platform tests.
* Update switch.zha platform tests.
* Update sensor.zha platform tests.
* Update light.zha platform tests.
* Use MockConfigEntry.
* Address PR comments.
2020-02-12 16:12:14 -05:00
Alexei Chetroi 28eeed1db3
ZHA tests refactoring (#31682)
* Fixtures for restoring/joning a device.

* binary_sensor.zha tests.

* cover.zha platform tests.

* device_tracker.zha platform tests.

* fan.zha platform tests.

* switch.zha platform tests.

* Update light.zha platform tests.

* Update sensor.zha platform tests.

* ZHA api tests refactoring.

* Update lock.zha platform tests.

* Update ZHA gateway tests.

* Update zha device action tests.

* Update zha device trigger tests.

* Cleanup.
2020-02-09 21:45:35 -05:00
Alexei Chetroi 9d8b4de09c Update ZHA entity discovery tests (#31191)
* ZHA registry test fixtures refactoring.

* Update ZHA test devices list.

* Use channel.id for event relay channels test.

* Add zigpy_device factory fixture.

* Add node descriptor to mock zigpy devices.

* Use node descriptor for ZHA device tests.

* Update ZHA discovery test.

check for unique_id and channels passed into each entity.

* Address comments.
2020-01-27 19:43:26 -05:00
Alexei Chetroi a3061bda60 Make the rest of ZHA platforms to use ZHA class registry (#30261)
* Refactor ZHA component tests fixtures.

* Add tests for ZHA device discovery.

* Refactor ZHA registry MatchRule.

Allow callables as a matching criteria.
Allow sets for model & manufacturer.

* Minor ZHA class registry refactoring.

Less cluttered strict_matching registrations.

* Add entities only if there are any.

* Migrate rest of ZHA platforms to ZHA registry.

* Pylint fixes.
2019-12-31 11:09:58 -05:00
David F. Mulcahey 1222aa8c56 Add ZHA group API (#29641)
* add skeleton to retrieve zigbee groups
* get single group
* add a group
* return group members with group
* add comment
* fix group members
* add function to add device to group
* add group members
* add remove from group method
* add api to remove members from group
* add remove groups method
* clean up group add and remove
* fix remove group
* fix remove groups
* add api to get only groupable devices
* change var init
* add tests
* address review comment
2019-12-09 14:50:04 -05:00
Alexei Chetroi 89213a4ce8
Don't set entity_id in ZHA entities (#28362)
* Don't set entity_id on ZHA entities.
* Update tests.
* Use comma as separator for multiple channel names.
* Address PR comments.
2019-10-31 12:31:06 -04:00
Alexei Chetroi 969322e14a Fixes/zha ieee tail (#28160)
* Fix ZHA entity_id assignment.

* Update tests.
2019-10-24 12:23:02 -04:00
Alexei Chetroi fe7c45b363
Move remaining of ZHA imports to top level. (#28071)
* Move ZHA import to top level.
* ZHA tests: move imports to top level.
2019-10-21 19:30:56 -04:00
Alexei Chetroi a0c50f4794 Leverage zigpy for IEEE address conversions (#27972)
* Refactor EUI64 conversions.

* Update ZHA dependencies.

* Update tests.
2019-10-21 13:14:17 -04:00
David F. Mulcahey fec6706bf7 use newly added is_server for cluster reporting (#26533) 2019-09-09 09:21:34 -04:00
David F. Mulcahey fafd228418 Refactor ZHA device initialized logic (#25796)
* refactor device initialized
* better names and update tests
* clean up last seen logic
* logging consistency
2019-08-09 18:52:47 -04:00
Alexei Chetroi f7cfe908f7 Refactor ZHA Zigbee Cluster report configuration (#25589)
* Move ZCL report configs to ZHA core channels.

* Refactor ZCL report configuratopm and cluster binding.

* Tests for ZHA channel configuration.

* Update tests.

* Remove INPUT_BIND_ONLY_CLUSTER ZHA core registry.

We always need bind a cluster, but not always need to configure
attribute reporting. No reporting is done on ZCL "client" clusters.

* Lint

* Black
2019-08-04 18:20:03 -04:00
Paulus Schoutsen 4de97abc3a Black 2019-07-31 12:25:30 -07:00
Alexei Chetroi 5aa35b52cc
ZHA log helper (#25543)
* Logging helper.
* Use log helper for ZHA entities.
* Use log helper for ZHA core device.
* Log helper for ZHA core channels.
* Lint
* ZHA fixture fix.
2019-07-30 15:19:24 -04:00
David F. Mulcahey ae1bcd5fef
Use node descriptor from Zigpy for ZHA (#24316)
* use zigpy node descriptor

* cleanup
2019-06-06 08:31:03 -04:00
David F. Mulcahey 3f9e6a7064 Add power source to device and clean up zha listeners (#21174)
check available and add comments

ensure order on API test
2019-02-18 16:55:41 +01:00
David F. Mulcahey 3a6a246746
Set ZHA device availability on new join (#21066)
* set availability on device join

* fix new join test
2019-02-15 13:14:58 -05:00
David F. Mulcahey d4c34c6b02 Cleanup zha listener lifecycle (#20789) 2019-02-07 09:23:01 +01:00
David F. Mulcahey 03ab152c82 Enable the available property for zha entities (#20788) 2019-02-07 09:14:19 +01:00
David F. Mulcahey 9c11602674 Add ZHA sensor tests (#20710)
* add sensor tests

* update switch test

* add sensor back to coveragerc

* review comments

* added comments
2019-02-03 22:03:35 +01:00
David F. Mulcahey 74cdf7c347
Add tests for ZHA switch (#20691)
* start test setup

test cleanup

test deps

update switch test

actually update test deps

cleanup and remove switch from coveragerc

comment

refactor to use fixtures and shared components

lint

* remove availability part that isn't in zha yet

* review comments and cleanup

* review comments

* add switch back unil post reorg merge
2019-02-03 07:03:31 -05:00