Co-authored-by: Sid <27780930+autinerd@users.noreply.github.com>
Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
Co-authored-by: J. Nick Koston <nick@koston.org>
* Phase out periodic tasks
* false by default or some tests will block forever, will need to fix each one manually
* kwarg works
* kwarg works
* kwarg works
* fixes
* fix more tests
* fix more tests
* fix lifx
* opensky
* pvpc_hourly_pricing
* adjust more
* adjust more
* smarttub
* adjust more
* adjust more
* adjust more
* adjust more
* adjust
* no eager executor
* zha
* qnap_qsw
* fix more
* fix fix
* docs
* its a wrapper now
* add more coverage
* coverage
* cover all combos
* more fixes
* more fixes
* more fixes
* remaining issues are legit bugs in tests
* make tplink test more predictable
* more fixes
* feedreader
* grind out some more
* make test race safe
* one more
* Add counter entities to the ZHA coordinator device
* rework to prepare for non coordinator device counters
* Initial scaffolding to support quirks v2 entities
* update for zigpy changes
* add assertion error message
* clean up test
* update group entity discovery kwargs
* constants and clearer names
* apply custom device configuration
* quirks switches
* quirks select entities
* quirks sensor entities
* update discovery
* move call to super
* add complex quirks v2 discovery test
* remove duplicate replaces
* add quirks v2 button entity support
* add quirks v2 binary sensor entity support
* fix exception in counter entitiy discovery
* oops
* update formatting
* support custom on and off values
* logging
* don't filter out entities quirks says should be created
* fix type alias warnings
* sync up with zigpy changes and additions
* add a binary sensor test
* button coverage
* switch coverage
* initial select coverage
* number coverage
* sensor coverage
* update discovery after rebase
* coverage
* single line
* line lengths
* fix double underscore
* review comments
* set category from quirks in base entity
* line lengths
* move comment
* imports
* simplify
* simplify
* Add counter entities to the ZHA coordinator device
* rework to prepare for non coordinator device counters
* counter entity test
* update log lines
* disable by default
* Do not create `current_summ_received` entity until initialized once
* Update zha_devices_list.py to not expect summation received entities
The attribute isn't initialized for these devices in the test (which our check now expects it to be), hence we need to remove them from this list.
* Update sensor tests to have initial state for current_summ_received entity
The attribute needs to be initialized for it to be created which we do by plugging the attribute read.
The test expects the initial state to be "unknown", but hence we plugged the attribute (to create the entity), the state is whatever we plug the attribute read as.
* Update sensor tests to expect not updating current_summ_received entity if it doesn't exist
* 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>
* 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
* 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
* 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
* 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
* 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
* 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
* 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
* Add tier summation delivered for zlinky
* Improve name case
* Add other tiers and register tier
* Fix smartenergy sensor update
* Account for new reporting configuration in unit tests
* Use cluster ID attributes instead of hardcoding the values
* Use tier names instead of the numeric constants for formatter
* Revert active register tier delivered
* Fix tests
Co-authored-by: puddly <32534428+puddly@users.noreply.github.com>
* Add files via upload
* Add Frequency and PF
* Add Frequency and PF
Add Frequency and PF
* Add Frequency and PF
Add Frequency and PF
* Add Frequency and PF
Add Frequency and PF
* Add Frequency and PF
Add Frequency and PF
* Update homeassistant/const.py
Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
* Update homeassistant/components/zha/sensor.py
Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
* Update homeassistant/const.py
Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
* Fix rebase
* rebase cleanup
* fix stale doc string
* missed this again
* isort
* update tests
* update discovery test data
Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
Co-authored-by: David Mulcahey <david.mulcahey@me.com>
* Make unit tests pass
* Flip response type check to not rely on it being a list
https://github.com/zigpy/zigpy/pull/716#issuecomment-1025236190
* Bump zigpy and quirks versions to ZCLR8 releases
* Fix renamed zigpy cluster attributes
* Handle the default response for ZLL `get_group_identifiers`
* Add more error context to `stage failed` errors
* Fix unit test returning lists as ZCL request responses
* Always load quirks when testing ZHA
* Bump zha-quirks to 0.0.69
* expose device temperature sensor in frontend
* fixes after runnig test
* specified device temp channel
* add dev temp int test device aqara water
* black fix
* Add apparent_power for ZHA ElectricalMeasurement
* Add apparent_power to REPORT_CONFIG
* update device list with apparent_power attribute
* update test decorators for apparent_power
* remove comments
* Add test for apparent_power in test_sensor
* Add electrical measurement type state attribute.
* Add active_power_max attribute
* Skip unsupported attributes on entity update
* Fix tests
* Create sensor only if the main attribute is supported
* Refactor ElectricalMeasurement sensor to use attr specific divisor and multiplier
* Multiple entities for electrical measurement cluster
* Update discovery tests
* Sensor clean up
* update tests
* Pylint
* Replace ZHA tests FakeDevice
* Refactor ZHA tests to use zigpy devices and endpoints
* Use common consts for zigpy device mocks
Use the same dict key names for device signature mocks as zha quirks.
* Use const for test device list
* Update tests/components/zha/common.py
* Refactor ZHA sensors to use cached values after restart
* Get attr from cluster, not channel
* Run cached state through formatter method
* Use cached values for div/multiplier for SmartEnergy channel
* Restore batter voltage from cache
* Refactor sensor to use cached values only
* Update tests
* Add battery sensor test