Commit graph

53 commits

Author SHA1 Message Date
epenet
7427d4f323
Add type hints to integration tests (zha) () 2023-02-17 18:54:26 +01:00
J. Nick Koston
4221433ca6
Account for changed python3.11 enum.IntFlag 0 behavior in zha () 2023-02-15 11:40:48 -06:00
Franck Nijhof
ed79265843
Enable Ruff PT006 ()
* Enable Ruff PT006

* Adjust existing cases

* Fix tests

* Remove unneeded parentheses
2023-02-15 14:09:50 +01:00
Franck Nijhof
e50a531cd9
Code styling tweaks to the tests - Part 2 ()
Co-authored-by: jjlawren <jjlawren@users.noreply.github.com>
2023-01-26 01:23:53 +01:00
Paul Bottein
c3e27f6812
Add tier summation delivered for Lixee Zlinky TIC ()
* 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
Michael
9828b2d13f
Replace the usage of unit constants by enumerations in Tests [v-z] ()
replace unit conts by enums v-z
2023-01-15 20:14:02 +02:00
TheJulianJES
f740312247
Fix some typos in ZHA comments ()
* 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
Maciej Bieniek
a8f09b4063
Round illuminance value in ZHA integration () 2022-12-23 13:24:15 +01:00
David F. Mulcahey
20d71a869e
Add friendly entity names for ZHA sensors ()
* Add friendly entity names for ZHA sensors

* lowercase 2nd word
2022-10-10 15:40:42 -04:00
David F. Mulcahey
3937ac2ca3
Track code coverage for ZHA sensor entities ()
* Track code coverage for ZHA sensor entities

* remove correct entry
2022-08-11 21:13:27 -04:00
David F. Mulcahey
6f28e4bfee
Migrate ZHA to new entity naming standard () 2022-07-10 13:17:59 -07:00
J. Nick Koston
4bc5d7bfed
Speed up zha tests () 2022-06-17 11:41:10 -05:00
glcos
8a73381b56
ZHA ElectricalMeasurement cluster add Frequency and Power Factor ()
* 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>
2022-04-24 12:42:52 -04:00
puddly
0f6296e4b5
Bump zigpy to 0.44.1 and zha-quirks to 0.0.69 ()
* 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
2022-03-31 11:26:27 -04:00
rforro
4e376181f5
Expose entity device temperature from cluster in ZHA ()
* expose device temperature sensor in frontend

* fixes after runnig test

* specified device temp channel

* add dev temp int test device aqara water

* black fix
2022-01-23 09:37:01 -05:00
David F. Mulcahey
abbde8f128
Clean up state class and device class usage in ZHA ()
* Clean up sensor and device class usage in ZHA

* additional cleanup

* Use EntityCategory
2021-12-11 11:51:24 -05:00
David F. Mulcahey
a17031630f
Use Platform enum in ZHA () 2021-12-11 11:06:39 -05:00
Robin Dupont
4598353315
Add apparent_power for ZHA ElectricalMeasurement ()
* 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
2021-11-18 19:43:08 -05:00
Alexei Chetroi
d0827a9129
ZHA support for additional entities on ElectricalMeasurement ZCL cluster ()
* 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
2021-10-02 21:57:49 -04:00
Alexei Chetroi
dbba2c4afe
Add "Summation Delivered" Sensor for SmartEnergy metering ZHA channel () 2021-09-29 09:35:20 -07:00
Alexei Chetroi
c6888e4faf
Refactor ZHA tests ()
* 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
2021-09-06 19:00:06 -04:00
Alexei Chetroi
54c4e9335f
Refactor ZHA sensor initialization ()
* 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
2020-11-18 21:34:12 -05:00
Samantha
a8b68dc4f9
Add Neighbors & Endpoint Names to zha/devices reply ()
* Add Neighbors & Endpoint Names to zha/devices reply.

* Remove unused const

* Add tests & correct const name.

* Change tests to use corresponding enum device_type
2020-09-29 15:25:05 -04:00
springstan
6c8e0e20fb
Add and use light lux constant in entire code base () 2020-09-23 20:48:01 +02:00
springstan
e330468a13
Use pressure constants in code base () 2020-09-19 09:26:08 +02:00
springstan
d2b1918e9c
Drop UNIT_ prefix for percentage constant () 2020-09-05 21:09:14 +02:00
Franck Nijhof
1c2ebdf307
Upgrade black to 20.8b1 () 2020-08-27 13:56:20 +02:00
Alexei Chetroi
33dc015083
Fix ZHA electrical measurement sensor initialization ()
* Refactor cached ZHA channel reads.

If doing a cached ZCL attribute read, do "only_from_cache" read for
battery operated devices only. Mains operated devices will do a network
read in case of a cache miss.

* Use cached attributes for ZHA electrical measurement

* Bump up ZHA zigpy dependency.
2020-07-16 16:25:42 -04:00
Alexei Chetroi
21acdbbbfd
Refactor ZHA Entity availability tracking ()
* Refactor ZHA entity availability

ZHA entity availability tracks on underlying ZHA device availability.

* Update device status without signal.

* Update tests.

* Fix tests.

* Tests for restored devices availability.

* Guard against empty last_seen entry

Refactor device loading a bit.
2020-06-11 17:21:08 -04:00
springstan
f839ba00eb
Use POWER_WATT constant () 2020-04-11 15:40:59 +02:00
springstan
78d87dc40f
Use TEMP_CELSIUS constant () 2020-04-10 19:17:46 +02:00
David F. Mulcahey
aa972b0005
Fix handling of attribute reports in ZHA sensors and binary sensors ()
* Update sensor tests.

* Update light tests.

* Update binary_sensor tests.

* Update cover tests.

* Update device tracker tests.

* Update fan tests.

* Update lock tests.

* Update switch tests.

* add sensor attr to sensors

* add sensor attr to binary sensors

* cleanup extra var

Co-authored-by: Alexei Chetroi <alexei.chetroi@outlook.com>
2020-03-13 19:17:50 -04:00
springstan
f1a0ca7cd3
Add and use percentage constant ()
* Add and use percentage constant

* Fix pylint error and broken test
2020-02-28 11:46:48 -08:00
Alexei Chetroi
52fe1328f6
ZHA tests refactoring ()
* Refactor ZHA fixtures.
Patch Zigpy radio libs instead of ZHA when setting up fixtures.
Use new fixtures for binary_sensor.zha platform.

* Update ZHA api tests.
* Update ZHA channels and discovery tests.
* Update ZHA cover tests.
* Update device action/trigger tests.
* Update device_tracker.zha platform tests.
* Update fan.zha platform tests.
* Update ZHA gateway tests.
* Update lock.zha platform tests.
* Update switch.zha platform tests.
* Update sensor.zha platform tests.
* Update light.zha platform tests.
* Use MockConfigEntry.
* Address PR comments.
2020-02-12 16:12:14 -05:00
Alexei Chetroi
28eeed1db3
ZHA tests refactoring ()
* Fixtures for restoring/joning a device.

* binary_sensor.zha tests.

* cover.zha platform tests.

* device_tracker.zha platform tests.

* fan.zha platform tests.

* switch.zha platform tests.

* Update light.zha platform tests.

* Update sensor.zha platform tests.

* ZHA api tests refactoring.

* Update lock.zha platform tests.

* Update ZHA gateway tests.

* Update zha device action tests.

* Update zha device trigger tests.

* Cleanup.
2020-02-09 21:45:35 -05:00
Christian Clauss
df7d2b3aeb
Fix typos found by codespell ()
* Fix typos found by codespell

* Fix typos found by codespell

* codespell: Furture  ==> Future

* Update test_config_flow.py

* Update __init__.py

* Spellcheck: successfull  ==> successful

* Codespell: unsuccesful  ==> unsuccessful

* Codespell: cant  ==> can't

* Codespell: firware ==> firmware

* Codespell: mimick  ==> mimic
2020-01-31 08:33:00 -08:00
Alexei Chetroi
3bf657284c
Refactor rounding for ZHA electrical measurement sensor () 2020-01-17 20:53:31 -05:00
Alexei Chetroi
008dddb17c Fix ZHA temperature sensor restoration ()
* Add test for restoring state for zha temp.

* Don't restore unit of measurement for ZHA sensors.

Properly restore ZHA temperature sensor state.
2020-01-10 20:30:58 -05:00
Ville Skyttä
fa4fa30461 Various string cleanups ()
* Remove some unnecessary string concatenations

* Replace some simple str.formats with f-strings

* Replace some string concatenations with f-strings
2020-01-03 14:47:06 +01:00
Alexei Chetroi
8e3dfbd5c9
Refactor ZHA electrical measurement sensor. () 2019-12-21 17:15:50 -05:00
Alexei Chetroi
89213a4ce8
Don't set entity_id in ZHA entities ()
* Don't set entity_id on ZHA entities.
* Update tests.
* Use comma as separator for multiple channel names.
* Address PR comments.
2019-10-31 12:31:06 -04:00
Alexei Chetroi
fe7c45b363
Move remaining of ZHA imports to top level. ()
* Move ZHA import to top level.
* ZHA tests: move imports to top level.
2019-10-21 19:30:56 -04:00
Alexei Chetroi
a0c50f4794 Leverage zigpy for IEEE address conversions ()
* Refactor EUI64 conversions.

* Update ZHA dependencies.

* Update tests.
2019-10-21 13:14:17 -04:00
Alexei Chetroi
9c0fbfd101
Bump up ZHA dependencies ()
* Update ZHA to track zigpy changes.
* Update ZHA dependencies.
* Update tests.
* Make coverage happy again.
2019-09-23 13:35:27 -04:00
presslab-us
8e5d272b5f Support formatting and scaling with ZHA Metering cluster ()
* Support formatting and scaling with Metering cluster

* fix lint

* run black formatter
2019-08-26 23:16:54 -04:00
Paulus Schoutsen
4de97abc3a Black 2019-07-31 12:25:30 -07:00
David F. Mulcahey
128ce589e1 Correct ZHA illumination conversion ()
* fix illumination values

* correct formula

* update illuminance calculation

* update test
2019-05-14 07:16:41 +02:00
Alexei Chetroi
e670491c86 Targeted ZHA permit joins. ()
* Targeted ZHA permit service.

* Convert IEEE string to EUI64 usiv vol schema.

* Update test units.

* Lint.

isort imports.
2019-03-27 19:50:52 -07:00
David F. Mulcahey
3f9e6a7064 Add power source to device and clean up zha listeners ()
check available and add comments

ensure order on API test
2019-02-18 16:55:41 +01:00
David F. Mulcahey
d4c34c6b02 Cleanup zha listener lifecycle () 2019-02-07 09:23:01 +01:00