* Enable Bosch Outdoor Siren and Bosch Twinguard QR Codes
These devices contain inside their QR code device specific link keys instead of installation codes. Normally, the link key is generated from the installation code, but in this case we can directly pass the provided link key from QR code to zigpy application controller.
* Replace ZHA deprecated permit_with_key by permit_with_link_key
Convert installation code directly to link key
* Update tests
* formatting
* stub out zha update entity
* update matcher
* updates based on assumptions / conversation
* hook into current installed version
* post rebase cleanup
* incorporate zigpy changes
* fix async_setup_entry
* fix sw_version
* make ota work with config diagnostic match
* fix version format
* sync up with latest Zigpy changes
* fix name attribute
* disable ota providers for tests
* update device list
* review comment
* add current_file_version to Ota ZCL_INIT_ATTRS
* updates to update and start tests
* get installed version from restore data
* better version handling
* remove done todo notes
* reorganize test
* move image notify to cluster handler
* add test for manual update check
* firmware update success test
* coverage
* use zigpy defs
* clean up after rebase
* bump Zigpy
* cleanup from review comments
* fix busted F string
* fix empty error
* move inside check
* guard zigbee network from bulk check for updates
* Correct handling of power_factor ElectricalMeasurement attribute
The Zigbee Cluster Library defines PowerFactor as an int8 with value supported from -100 to 100.
Currently the zha sensor handler attempts to apply the ac_power_divisor and ac_power_multiplier formatters against the attribute value, the spec outlines that this should not be the case.
The impact of the current code is that quirks not using the default values of 1 are multiplying/dividing
power and power factor values prior to updating the cluster attribute.
This results in either a non-conformant power_factor e.g. the value was multiplied by 10 so that an ac_power_divider of 10 could be used, or the power readings sacrificing a point of measurement for lower readings.
Two quirks currently use this workaround:
* ts0601_din_power.py
* ts0601_rcbo.py
* Update ZHA Metering formatter to perform None check on _div_mul_prefix
To address feedback:
https://github.com/home-assistant/core/pull/107641#discussion_r1447547054
* _div_mul_prefix needs self reference
* Simplify None check for _div_mul_prefix
Co-authored-by: Joakim Plate <elupus@ecce.se>
* Updates to formatting and CI test typing fix
* Use ' | ' in place of Union
* Add tests for power_factor sensor
---------
Co-authored-by: Joakim Plate <elupus@ecce.se>
* Allow `window_covering_type` to be `None`
* Create a `window_covering_mode` attribute and simplify inversion switch
* Revert "Create a `window_covering_mode` attribute and simplify inversion switch"
This reverts commit 048d649b4d.
* check both config status and mode
* coverage
---------
Co-authored-by: David Mulcahey <david.mulcahey@icloud.com>
* Update smartenergy.py metering_device_type enums
* Added missing enum 127
* Enum 127 is also electric metering type
* Meter type constants and status enums in smartenergy cluster handler
Addresses
https://github.com/home-assistant/core/pull/109126#discussion_r1471383887
Whilst I have the code open I've also added status handlers for the non-electrical meter types.
* New tests for different metering device type statuses
* Add sensor for exposing Summation Received from Metering cluster
* Ruff format
* Test updates for new sensor
* Update test_sensor.py to support summation_received
* Correct report_count for smart meterning and some pylint warning fixes
* Limit concurrency of startup traffic to allow for interactive usage
* Drop `retryable_req`, we already have request retrying
* Oops, `min` -> `max`
* Add a comment describing why `async_initialize` is not concurrent
* Fix existing unit tests
* Break out fetching mains state into its own function to unit test
* Dynamically map state class, device class and UoM in ZHA smart energy metering sensor
* Fix some state & device classes and add scaling
* Fix added imperial gallons tests
* Use entity description instead of custom class & add one entity to tests
* Apply code review suggestion
* Scale only when needed
* Revert "Scale only when needed"
This reverts commit a9e0403402.
* Avoid second lookup of entity description
* Change test to not mix sensor types
* initial
* fix tests
* match on specific name and quirk name
* fix tests
* fix tests
* store cluster handlers in only one place
* edit tests
* use correct device for quirk id
* change quirk id
* fix tests
* even if there is a quirk id, it doesn't have to have a specific cluster handler
* add tests
* rename quirk_id
* add tests
* fix tests
* fix tests
* use quirk id from zha_quirks
* Don't update entities until they are initialized
* fix hass reference
* only establish polling once
* fix log level and small cleanup
* start device availability checks after full initialization of network
* add logging
* clean up sensor polling and class hierarchy
* don't attempt restore sensor cleanup in this PR
* put check back
* fix race condition and remove parallel updates
* add sensor polling test
* cleanup switch polling and add a test
* clean up and actually fix race condition
* update light forced refresh
* only use flag
* unused flag
* reduce diff size
* collapse
* Use ServiceValidationError for fan preset_mode
* Use _valid_preset_mode_or_raise to raise
* Move preset_mode validation to entity component
* Fix bond fan and comments
* Fixes baf, fjaraskupan and template
* More integration adjustments
* Add custom components mock and test code
* Make NotValidPresetModeError subclass
* Update homeassistant/components/fan/strings.json
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Keep bond has_action validation
* Move demo test asserts outside context block
* Follow up comment
* Update homeassistant/components/fan/strings.json
Co-authored-by: G Johansson <goran.johansson@shiftit.se>
* Fix demo tests
* Remove pylint disable
* Remove unreachable code
* Update homeassistant/components/fan/__init__.py
Co-authored-by: G Johansson <goran.johansson@shiftit.se>
* Use NotValidPresetModeError, Final methods
* Address comments
* Correct docst
* Follow up comments
* Update homeassistant/components/fan/__init__.py
Co-authored-by: Erik Montnemery <erik@montnemery.com>
---------
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
Co-authored-by: G Johansson <goran.johansson@shiftit.se>
Co-authored-by: Erik Montnemery <erik@montnemery.com>
* Add ZHA test checking light restores with None attributes
* Move shared `core_rs` fixture to `conftest.py`
* Remove special `color_mode` case, use `parametrize` for expected state
---------
Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>
* Use fixed quirk IDs for matching instead of quirk class
* Change tests for quirk id (WIP)
* Do not default `quirk_id` to `quirk_class`
* Implement test for checking if quirk ID exists
* Change `quirk_id` for test slightly (underscore instead of dot)
* 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
* 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
* 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