* 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
* Simplify MQTT device trigger
* Add test non unique trigger_id
* Adjust deprecation warning
* Make discovery_id optional
* refactor double if
* Improve validation, add tests and deprecation comments
* Avoid breaking change
* Inmprove error message
* Match on discovery_id instead of discovery_info
* Revert an unrelated change
* follow up comments
* Add comment and test on device update with non unique trigger
* Update homeassistant/components/mqtt/device_trigger.py
Co-authored-by: Erik Montnemery <erik@montnemery.com>
* Update homeassistant/components/mqtt/device_trigger.py
Co-authored-by: Erik Montnemery <erik@montnemery.com>
---------
Co-authored-by: Erik Montnemery <erik@montnemery.com>
* Add volume flow rate conversions
* Add missing translations
* Adjust liter unit and add gallons per minute
* Adjust to min instead of m for minutes
* Add matching class for number
* Add some tests for number and sensor platform
* Add deprecated constants
* Add explicit list of flow rate for check
This reverts commit 105171af31.