* 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>
* 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>
* 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>
* 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
* 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
* 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
* 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
* Allow matching custom quirks when self.quirk_classes might not contain the full class path but only the module and the class.
* Add test for matching custom quirk classes.
* Make `find_entity_id` synchronous
* Remove `tries`
* Use new `attribute_updated` event signature
* Validate attributes before creating entities
* Avoid swallowing exceptions when opening covers
* Bump ZHA dependencies
* Add a matcher for Sinope water leak sensors using a non-standard ZCL attribute
* Ensure handler matching is strict, not multi
* Add type annotations for newly-updated functions
* Add silabs_multiprotocol platform
* Add new files
* Add ZHA tests
* Prevent ZHA from creating database during tests
* Add delay parameter to async_change_channel
* Add the updated dataset to the dataset store
* Allow MultipanProtocol.async_change_channel to return a task
* Notify user about the duration of migration
* Update tests
* Migrate restore_state helper to use registry loading pattern
As more entities have started using restore_state over time, it
has become a startup bottleneck as each entity being added is
creating a task to load restore state data that is already loaded
since it is a singleton
We now use the same pattern as the registry helpers
* fix refactoring error -- guess I am tired
* fixes
* fix tests
* fix more
* fix more
* fix zha tests
* fix zha tests
* comments
* fix error
* add missing coverage
* s/DATA_RESTORE_STATE_TASK/DATA_RESTORE_STATE/g
* Ensure devices with bad cluster subclasses do not prevent startup
* Explicitly unit test an affected SML001 device
* Do not use invalid `hue_occupancy` attribute name
* Actually remove `hue_occupancy`
* Bump ZHA dependencies
* Expose channel changing over the websocket API
* Expose channel changing as a service
* Type annotate some existing unit test fixtures
* Add unit tests
* Rename `api.change_channel` to `api.async_change_channel`
* Expand on channel migration in the service description
* Remove channel changing service, we only really need the websocket API
* Update homeassistant/components/zha/websocket_api.py
* Black
---------
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
* Always use `Light` for lights, including subclasses
* Clean up other platforms
* Add a unit test to ensure all future entity classes have names
* Remove stale `_name`
* Address review feedback and rename `Open` to `Opening`
* rename channel -> cluster handler
* remove refs to channels and create endpoint class
* remove remaining references to channels
* fix filter
* take in latest changes from #91403
* missed one
* missed a reference