Commit graph

1389 commits

Author SHA1 Message Date
puddly
8a79870e3a
Clean up stale ZHA database listener when reconnecting to radio (#101850) 2023-10-20 08:48:33 +02:00
TheJulianJES
92e625636a
Fix ZHA power_factor attribute not initialized (#102133) 2023-10-20 08:15:37 +02:00
Robert Resch
bb90c1f168
Fix multilevel reference translations (#102338) 2023-10-20 08:12:53 +02:00
puddly
3285c982fe
Bump ZHA dependencies (#102358) 2023-10-20 08:11:49 +02:00
Joakim Plate
90687e9794
Standardize zha attribute member name (#102182)
* Correct missed translation

* Standardize on _attribute for zha
2023-10-19 17:34:17 +02:00
TheJulianJES
60c1a8d56f
Remove invalid attribute reporting for enhanced_current_hue in ZHA (#102137) 2023-10-17 16:23:11 -04:00
TheJulianJES
9dd2f37b11
Remove unused variables in ZHA lighting cluster handler (#102138)
* Remove unused `UNSUPPORTED_ATTRIBUTE`

* Remove unused `CAPABILITIES_COLOR_TEMP`

* Use zigpy `ColorCapabilities` and remove `CAPABILITIES_COLOR_XY`
2023-10-17 15:04:03 -05:00
Joakim Plate
29e8814d1b
Add translation entiry support (zha) (#101909)
* zha: Add translation to binary sensors

* Add some small test for name

* Add translations for sensors

* Correct some tests

* Adjust summation key

* Add translation keys for button

* Add translation keys to climate

* Add translation keys for cover

* Add translation keys to fan

* Add translations to light

* Add translations for lock

* Add translation keys to number

* Add translationk keys to select

* Add translations for switch entities

* Add translation to alarm control panel

* Map to some more standard device classes

* Use shorter references

* Remove explicit name from identify button

* Correct tests

* Correction after rebase
2023-10-17 21:59:49 +02:00
Joakim Plate
6d457e808f
Remove class argument in favor of class variables (zha) (#102117)
* Drop id_suffix class argument

* Use lowecase attribute
2023-10-16 16:26:03 -05:00
TheJulianJES
23b379b7da
Bump zha-quirks to 0.0.105 (#102113) 2023-10-16 21:57:37 +02:00
Caius-Bonus
5290396731
ZHA Component: Correct AttributeUpdated signal in Thermostat climate entity, ThermostatClusterHandler and ThermostatHVACAction sensor entity (#101725)
* initial

* change other Thermostat climate entities

* remove AttributeUpdateRecord
2023-10-10 14:23:03 -04:00
puddly
2e4df6d2f2
Open a ZHA repair when network settings change (#99482) 2023-10-09 15:01:05 +02:00
TheJulianJES
5d0c8947a1
Fix ZHA device diagnostics error for unknown unsupported attributes (#101239)
* Modify test to account for scenario of unknown unsupported attributes

* Add error checking for finding unsupported attributes

* Change comment to clarify zigpy misses an attribute def

This should make it more clear that it's about an unknown attribute (where zigpy doesn't have an attribute definition).

* Increase test coverage

This increases test coverage by doing the following:
- adding the `IasZone` to our test device, so we have a cluster which actually has some attribute definitions
- adding not just an unknown unsupported attribute by id, but also by name
- adding a known unsupported attribute by id and by name

* Fix diagnostics logic
2023-10-06 12:23:48 -04:00
TheJulianJES
f5d8d41ad5
Fix ZHA exception when writing cie_addr during configuration (#101087)
Fix ZHA exception when writing `cie_addr`
2023-09-28 21:56:17 -04:00
puddly
4e4d4992bf
Bump ZHA dependencies (#100979) 2023-09-26 23:39:07 -05:00
TheJulianJES
93e2d4b74c
Bump zha-quirks to 0.0.104 (#100975) 2023-09-26 23:20:23 -04:00
Marc Mueller
dd302b291d
Update pylint to 2.17.6 (#100849) 2023-09-25 09:14:07 -05:00
puddly
44fd60bd53
Bump ZHA dependencies (#100732) 2023-09-23 09:53:56 +02:00
c0ffeeca7
f973d4cc26
ZHA multiprotocol detected message: add info (#100686) 2023-09-21 19:23:02 +02:00
c0ffeeca7
1c7b3cb2d5
ZHA multiprotocol detected - fix typo (#100683) 2023-09-21 17:02:39 +02:00
J. Nick Koston
59daceafd2
Avoid calling extract_stack in system_log since it does blocking I/O (#100455) 2023-09-21 09:48:41 +02:00
Erik Montnemery
d1afcd773f
Revert "Cache entity properties that are never expected to change in the base class" (#100422)
Revert "Cache entity properties that are never expected to change in the base class (#95315)"

This reverts commit 042776ebb8.
2023-09-15 11:25:24 +02:00
J. Nick Koston
042776ebb8
Cache entity properties that are never expected to change in the base class (#95315) 2023-09-14 17:48:48 -05:00
Jan Bouwhuis
9f3b1a8d44
Use hass.loop.create_future() in zha (#100056)
* Use hass.loop.create_future() in zha

* Remove not needed method
2023-09-13 13:32:00 +02:00
puddly
15b9963a24
Bump ZHA dependencies (#100156) 2023-09-11 22:23:55 -04:00
puddly
cbb28b6943
Migrate internal ZHA data to a dataclasses (#100127)
* Cache device triggers on startup

* reorg zha init

* don't reuse gateway

* don't nuke yaml configuration

* review comments

* Add unit tests

* Do not cache device and entity registries

* [WIP] Wrap ZHA data in a dataclass

* [WIP] Get unit tests passing

* Use a helper function for getting the gateway object to fix annotations

* Remove `bridge_id`

* Fix typing issues with entity references in group websocket info

* Use `Platform` instead of `str` for entity platform matching

* Use `get_zha_gateway` in a few more places

* Fix flaky unit test

* Use `slots` for ZHA data

Co-authored-by: J. Nick Koston <nick@koston.org>

---------

Co-authored-by: David F. Mulcahey <david.mulcahey@icloud.com>
Co-authored-by: J. Nick Koston <nick@koston.org>
2023-09-11 21:39:33 +02:00
puddly
a6f325d05a
Cache device trigger info during ZHA startup (#99764)
* Do not connect to the radio hardware within `_connect_zigpy_app`

* Make `connect_zigpy_app` public

* Create radio manager instances from config entries

* Cache device triggers on startup

* reorg zha init

* don't reuse gateway

* don't nuke yaml configuration

* review comments

* Fix existing unit tests

* Ensure `app.shutdown` is called, not just `app.disconnect`

* Revert creating group entities and device registry entries early

* Add unit tests

---------

Co-authored-by: David F. Mulcahey <david.mulcahey@icloud.com>
2023-09-11 14:36:01 +02:00
puddly
e8c4ddf05c
Bump ZHA dependencies (#99855) 2023-09-07 19:22:24 +02:00
J. Nick Koston
b69cc29a78
Switch lambda to attrgetter in zha (#99660) 2023-09-05 22:45:45 +02:00
puddly
7ab1913ba4
Fix ZHA startup creating entities with non-unique IDs (#99679)
* Make the ZHAGateway initialization restartable so entities are unique

* Add a unit test
2023-09-05 20:30:28 +02:00
puddly
c225ee89d6
Bump ZHA dependencies (#99561) 2023-09-04 09:26:14 -04:00
puddly
38270ee823
Create a ZHA repair when directly accessing a radio with multi-PAN firmware (#98275)
* Add the SiLabs flasher as a dependency

* Create a repair if the wrong firmware is detected on an EZSP device

* Update homeassistant/components/zha/strings.json

Co-authored-by: c0ffeeca7 <38767475+c0ffeeca7@users.noreply.github.com>

* Provide the ZHA config entry as a reusable fixture

* Create a separate repair when using non-Nabu Casa hardware

* Add unit tests

* Drop extraneous `config_entry.add_to_hass` added in 021def44

* Fully unit test all edge cases

* Move `socket://`-ignoring logic into repair function

* Open a repair from ZHA flows when the wrong firmware is running

* Fix existing unit tests

* Link to the flashing section in the documentation

* Reduce repair severity to `ERROR`

* Make issue persistent

* Add unit tests for new radio probing states

* Add unit tests for new config flow steps

* Handle probing failure raising an exception

* Implement review suggestions

* Address review comments

---------

Co-authored-by: c0ffeeca7 <38767475+c0ffeeca7@users.noreply.github.com>
2023-09-01 09:05:45 -04:00
puddly
22c5071270
Initialize ZHA device database before connecting to the radio (#98082)
* Create ZHA entities before attempting to connect to the coordinator

* Delete the ZHA gateway object when unloading the config entry

* Only load ZHA groups if the coordinator device info is known offline

* Do not create a coordinator ZHA device until it is ready

* [WIP] begin fixing unit tests

* [WIP] Fix existing unit tests (one failure left)

* Fix remaining unit test
2023-08-31 12:09:46 -04:00
puddly
5fd88f5874
Bump ZHA dependencies (#99341)
* Bump ZHA dependencies

* Include bellows as well
2023-08-30 14:56:19 -04:00
puddly
c8ef3f9393
Automatic migration from multi-PAN back to Zigbee firmware (#93831)
* Initial implementation of migration back to Zigbee firmware

* Fix typo in `BACKUP_RETRIES` constant name

* Name potentially long-running tasks

* Add an explicit timeout to `_async_wait_until_addon_state`

* Guard against the addon not being installed when uninstalling

* Do not launch the progress flow unless the addon is being installed

* Use a separate translation key for confirmation before disabling multi-PAN

* Disable the bellows UART thread within the ZHA config flow radio manager

* Enhance config flow progress keys for flasher addon installation

* Allow `zha.async_unload_entry` to succeed when ZHA is not loaded

* Do not endlessly spawn task when uninstalling addon synchronously

* Include `uninstall_addon.data.*` in SkyConnect and Yellow translations

* Make `homeassistant_hardware` unit tests pass

* Fix SkyConnect unit test USB mock

* Fix unit tests in related integrations

* Use a separate constant for connection retrying

* Unit test ZHA migration from multi-PAN

* Test ZHA multi-PAN migration helper changes

* Fix flaky SkyConnect unit test being affected by system USB devices

* Unit test the synchronous addon uninstall helper

* Test failure when flasher addon is already running

* Test failure where flasher addon fails to install

* Test ZHA migration failures

* Rename `get_addon_manager` to `get_multiprotocol_addon_manager`

* Remove stray "addon uninstall" comment

* Use better variable names for the two addon managers

* Remove extraneous `self.install_task = None`

* Use the addon manager's `addon_name` instead of constants

* Migrate synchronous addon operations into a new class

* Remove wrapper functions with `finally` clause

* Use a more descriptive error message when the flasher addon is stalled

* Fix existing unit tests

* Remove `wait_until_done`

* Fully replace all addon name constants with those from managers

* Fix OTBR breakage

* Simplify `is_hassio` mocking

* Add missing tests for `check_multi_pan_addon`

* Add missing tests for `multi_pan_addon_using_device`

* Use `waiting` instead of `sync` in class name and methods
2023-08-28 17:26:34 -04:00
puddly
23839a7f10
Wrap most ZHA exceptions in HomeAssistantError (#98421)
* Wrap attribute writes in a helper throwing `HomeAssistantError`

* Do not check for `Exception` instances, they are now propagated

* Write `cie_addr` synchronously

* Fix unnecessary `if` in `async_set_native_value`

* Fix unit tests

* Use `HomeAssistantError` in cover commands

* Revert writing `cie_addr` synchronously

* Disallow proxying of some cluster methods to fix unit test warnings

* Unit test cover failures to increase coverage

* Unit test missing climate device

* Unit test remaining cover commands
2023-08-28 17:24:12 -04:00
Ville Skyttä
b51c0f6ddc
Remove unnnecessary pylint configs from components [s-z]* (#98925) 2023-08-24 01:25:32 +02:00
Ville Skyttä
2399cd283a
Python 3.10 support cleanups (#98640) 2023-08-21 19:14:07 +02:00
ZigStar
af0e48081f
Add ZigStar UZG-01 ZHA zeroconf autodiscovery (#98657)
ZigStar UZG-01 ZHA Zeconf Autodiscovery
2023-08-21 11:28:42 -04:00
puddly
52a8f01096
Make IKEA fan sensors diagnostic in ZHA (#97747) 2023-08-17 02:15:35 +01:00
Erik Montnemery
91faa53843
Don't allow hass.config.config_dir to be None (#98442) 2023-08-16 13:00:14 +02:00
Erik Montnemery
045c327928
Move DeviceInfo from entity to device registry (#98149)
* Move DeviceInfo from entity to device registry

* Update integrations
2023-08-10 22:04:26 -04:00
Sam Reed
2cae79415d
zha: Fix double spaces in strings.json (#98097) 2023-08-09 11:21:05 +02:00
puddly
323657e6d7
Bump ZHA dependency bellows to 0.35.9 (#97976)
Bump bellows to 0.35.8
2023-08-07 18:14:47 -04:00
TheJulianJES
f7aec46b69
Bump zigpy to 0.56.4 (#97722) 2023-08-03 18:11:36 -04:00
TheJulianJES
bae5a3dbd6
Fix ZHA turn_on issues with transition=0, improve tests (#97539)
* Fix turn_on ignoring transition=0 and brightness=None, add test

This fixes light.turn_on for ZHA lights ignoring a transition of 0 when no brightness is given at the same time.
It also adds a test for that case.

Fixes https://github.com/home-assistant/core/issues/93265

* Add test for "force on" lights

This test checks that "force on" lights also get an "on" command (in addition to the "move to level" command) when turn_on is called with only transition=0.

* Fix "on" command sent for transition=0 calls, fix FORCE_ON missing for transition=0

This fixes an issue where the "on" command is sent in addition to a "move_to_level_with_on_off" command, even though the latter one is enough (for non-FORCE_ON lights).
It also fixes the test to not expect the unnecessary "on" command (in addition to the expected "move_to_level_with_on_off" command).

The `brightness != 0` change is needed to fix an issue where FORCE_ON lights did not get the required "on" command (in addition to "move_to_level_with_on_off") if turn_on was called with only transition=0.
(It could have been `brightness not None`, but that would also send an "on" command if turn_on is called with brightness=0 which HA somewhat "supports". The brightness != 0 check avoids that issue.)

* Improve comments in ZHA light class
2023-08-03 15:20:40 -04:00
TheJulianJES
cad845f5c9
Bump zha-quirks to 0.0.102 (#97588) 2023-08-01 22:26:36 +02:00
Marc Mueller
5e3bcc1224
Update zigpy to 0.56.3 (#97480) 2023-07-30 09:30:13 -04:00
puddly
84220e92ea
Wrap internal ZHA exceptions in HomeAssistantErrors (#97033) 2023-07-24 09:12:21 +02:00
Marc Mueller
8c870a5683
Use EventType for state changed [m-z] (#97118) 2023-07-24 08:07:07 +02:00