Commit graph

147 commits

Author SHA1 Message Date
Caius-Bonus
3b7ec8ed2c
Use EnumSensor instead of custom formatter() in ZHA Sensor entities (#109218)
use EnumSensor for SonofPresenceSensorIlluminationStatus and AqaraPetFeederLastFeedingSource
2024-01-31 11:53:10 -05:00
David F. Mulcahey
ac8f555a70
Add additional entities for the Aqara E1 curtain motor to ZHA (#108243)
* aqara curtain motor opened by hand binary sensor

add icon and translation key for identify button

remove previous inversion entity

add window covering type sensor and aqara curtain motor sensors

add aqara curtain motor hook lock switch

add aqara curtain motor attributes zcl_init_attrs

add aqara curtain motor zcl_init_attrs

translations

* update translation string

* review comments

* use enum sensor after rebase

* remove button change
2024-01-30 22:40:33 -05:00
Caius-Bonus
a7a41e54f6
Add ZHA ZCL thermostat entities (#106563) 2024-01-31 03:26:19 +01:00
Jack
2909e1c4fe
Fix ZHA handling of power factor ElectricalMeasurement attribute sensor (#107641)
* 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>
2024-01-30 23:11:18 +01:00
Jack
af1ba4b22f
Add ZHA metering summation received sensor (#107576)
* 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
2024-01-24 07:56:49 -05:00
Peter Hall
701404fa0b
Add ZHA entities for snzb06p (#107379)
* Updating zha component to add entities for snzb06p

Sonoff snzb06p presence detector needs some custom entities.

* Updating ZCL_INIT_ATTRS for sonoff specific attrs

* updating cluster name due to change in quirk
2024-01-23 08:31:32 -05:00
Florian Kisser
b5bb97c856
Fix zha illuminance measured value mapping (#108547) 2024-01-20 20:37:13 -05:00
Jan-Philipp Benecke
10014838ef
Dynamically map state class, device class and UoM in ZHA smart energy metering sensor (#107685)
* 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
2024-01-17 00:40:00 +01:00
Dorian Benech
2584de6324
Add TICMeter Energy Metering sensors (#107956) 2024-01-13 16:53:53 -05:00
David F. Mulcahey
2ed9397611
Fix assertion error when unloading ZHA with pollable entities (#107311) 2024-01-05 16:53:43 -05:00
David F. Mulcahey
817c71747f
Delay all ZHA polling until initialization of entities has completed (#105814)
* 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
2023-12-27 10:25:41 -05:00
Joakim Plate
bb0d082b25
Correctly report unavailable battery for value 255 of percentage (#104566)
* Ignore unavailable battery level for zha

* Adjust unavailable test
2023-12-11 19:17:06 +01: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
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
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
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
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
puddly
52a8f01096
Make IKEA fan sensors diagnostic in ZHA (#97747) 2023-08-17 02:15:35 +01:00
Marc Mueller
77f38e33e5
Import names from typing instead of typing_extensions [3.11] (#97065) 2023-07-22 17:03:44 -05:00
puddly
22dfa8797f
Bump ZHA dependencies (#93989)
* 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
2023-06-14 21:42:31 -04:00
Joakim Plate
deaf910a24
Correct zha device classes for voc and pm25 (#94130)
Correct zha device classes
2023-06-06 23:03:59 +02:00
epenet
c475273145
Prevent SensorEntity and RestoreEntity inheritance (#88971) 2023-05-24 12:49:35 +02:00
David F. Mulcahey
2bc2c4a651
Don't poll ZHA electrical measurement sensors unnecessarily (#92330) 2023-05-01 18:32:40 +02:00
puddly
6842cdcb65
Clean up default ZHA entity names (#91841)
* 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`
2023-04-25 19:51:39 -04:00
David F. Mulcahey
9c784ac622
Refactor ZHA (#91476)
* 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
2023-04-19 10:47:07 -04:00
TheJulianJES
47a2598b66
Add Aqara smoke sensor entities to ZHA (#90159)
* Add Aqara smoke sensor entities (WIP)

* Update smoke sensor entities (WIP)

* Drop two init attributes

* Move self-test button

* Remove self-test switch, add icons

* Add smoke sensor dbm entity

* Also add SMOKE device class to linkage alarm

Note: Enable "Linkage alarm" for this
2023-03-28 21:30:56 -04:00
J. Nick Koston
4221433ca6
Account for changed python3.11 enum.IntFlag 0 behavior in zha (#88144) 2023-02-15 11:40:48 -06:00
Erik Montnemery
cc564026fa
Move EntityCategory to homeassistant.const (#87792)
* Move EntityCategory to homeassistant.const

* Fix more imports
2023-02-09 20:15:37 +01:00
Marc Mueller
a5d376069a
Add Self typing (2) [mypy 1.0] (#87599) 2023-02-06 23:23:52 -05:00
Paul Bottein
a8b23d7139
Uses PolledSmartEnergySummation for ZLinky (#86960) 2023-01-30 22:10:55 +01:00
TheJulianJES
0cf676d501
Remove unnecessary ZHA AnalogInput sensors for Xiaomi plugs (#86261)
* Remove unnecessary ZHA AnalogInput sensors for Xiaomi plugs

* Remove AnalogInput entities from test
2023-01-25 06:17:33 -05:00
mbo18
29e3d06a42
Add unit and device class to ZHA RSSI sensor (#85390)
* Add unit device class to ZHA RSSI sensor

* Remove unit and device class for LQI

* mypy

* isort

* mypy2

* Update sensor.py
2023-01-23 07:36:21 -05:00
Paul Bottein
c3e27f6812
Add tier summation delivered for Lixee Zlinky TIC (#82602)
* 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>
2023-01-16 10:33:18 -05:00
epenet
829c8e611e
Remove invalid device class for RSSI sensors (#85191)
* Remove invalid device class for RRSI sensors

* Restore state class
2023-01-05 15:30:52 -05:00
TheJulianJES
f740312247
Fix some typos in ZHA comments (#84881)
* Fix copy paste errors

* Fix "setup/set up" usage

* Fix typo

* Fix comment

* Fix copy paste errors

* Remove space at end of comment

* Remove double word

* Fix copy paste errors

* Fix typos

* Apply review suggestion

* Upper-case zha (to ZHA) everywhere

* Review: fix "over rules"

* Review: most/more
2023-01-02 00:20:59 -05:00
MattWestb
0854f29b7c
Fix zha RMS voltage (#84689)
Fix RMS Voltage.

class ElectricalMeasurementRMSVoltage(ElectricalMeasurement, id_suffix="rms_voltage"): is using CURRENT as unit but shall being VOLTAGE.

Fix: https://github.com/home-assistant/core/issues/84537
2022-12-28 09:27:17 -05:00
Maciej Bieniek
a8f09b4063
Round illuminance value in ZHA integration (#84500) 2022-12-23 13:24:15 +01:00
epenet
2f45e6c2ae
Use UnitOfVolumeFlowRate in integrations (#84348) 2022-12-21 11:00:24 +01:00
epenet
d63a1ab511
Use UnitOfPower.BTU_PER_HOUR in zha (#83657) 2022-12-09 15:57:57 +01:00
epenet
e3aca53899
Use new unit enums in zha (#83633)
* Use new unit enums in zha

* Add kPa

* Add kPa
2022-12-09 13:33:08 +01:00
epenet
248d5ff541
Use ApparentPower unit and device class in integrations (#83577) 2022-12-08 20:55:18 +01:00
David F. Mulcahey
5329a679bb
Add Aqara c1 pet feeder support to ZHA (#82340)
* Add Aqara c1 pet feeder support to ZHA

* clean up

* cleanup

* state classes for daily measurements

* cleanups

* cleanups

* restore the refreshing of the inverted value cache

* cleanup
2022-11-21 18:03:17 -05:00
David F. Mulcahey
20d71a869e
Add friendly entity names for ZHA sensors (#80035)
* Add friendly entity names for ZHA sensors

* lowercase 2nd word
2022-10-10 15:40:42 -04:00
epenet
e2568d8375
Import climate constants from root [m-z] (#78020) 2022-09-08 10:34:44 +02:00
epenet
325557c3e9
Use _attr_should_poll in zha entities (#77175) 2022-08-22 21:38:26 -04:00
David F. Mulcahey
3937ac2ca3
Track code coverage for ZHA sensor entities (#76617)
* Track code coverage for ZHA sensor entities

* remove correct entry
2022-08-11 21:13:27 -04:00
Marc Mueller
a3b2b5c328
Add zha typing [classmethods] (#75472) 2022-07-20 12:03:30 +02:00
Arne Mauer
d8030ed9e7
Ikea Starkvind support all models (#74615)
* Add Particulate Matter 2.5 of ZCL concentration clusters to ZHA component

* Fixed black and flake8 test

* New sensors and manufacturer cluster to support IKEA STARKVIND (with quirk)

* Fix multi_match for FilterLifeTime, device_run_time, filter_run_time sensors for Ikea starkvind

* Remove model match because sensors are matched with manufacturer channel

* Update manufacturerspecific.py

* Update number.py
2022-07-07 14:28:33 -04:00