Add humidity sensor to deconz component (#93024)

Co-authored-by: Robert Svensson <Kane610@users.noreply.github.com>
This commit is contained in:
Tobias G 2023-06-01 19:16:42 +02:00 committed by GitHub
parent 0ca53eccb8
commit d4e352d6a7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 53 additions and 3 deletions

View file

@ -8,7 +8,7 @@
"iot_class": "local_push",
"loggers": ["pydeconz"],
"quality_scale": "platinum",
"requirements": ["pydeconz==112"],
"requirements": ["pydeconz==113"],
"ssdp": [
{
"manufacturer": "Royal Philips Electronics",

View file

@ -16,6 +16,7 @@ from pydeconz.models.sensor.daylight import DAYLIGHT_STATUS, Daylight
from pydeconz.models.sensor.generic_status import GenericStatus
from pydeconz.models.sensor.humidity import Humidity
from pydeconz.models.sensor.light_level import LightLevel
from pydeconz.models.sensor.moisture import Moisture
from pydeconz.models.sensor.power import Power
from pydeconz.models.sensor.pressure import Pressure
from pydeconz.models.sensor.switch import Switch
@ -81,6 +82,7 @@ T = TypeVar(
GenericStatus,
Humidity,
LightLevel,
Moisture,
Power,
Pressure,
Temperature,
@ -206,6 +208,17 @@ ENTITY_DESCRIPTIONS: tuple[DeconzSensorDescription, ...] = (
state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=LIGHT_LUX,
),
DeconzSensorDescription[Moisture](
key="moisture",
supported_fn=lambda device: device.moisture is not None,
update_key="moisture",
value_fn=lambda device: device.scaled_moisture,
instance_check=Moisture,
device_class=SensorDeviceClass.MOISTURE,
state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=PERCENTAGE,
suggested_display_precision=1,
),
DeconzSensorDescription[Power](
key="power",
supported_fn=lambda device: device.power is not None,

View file

@ -1625,7 +1625,7 @@ pydaikin==2.9.1
pydanfossair==0.1.0
# homeassistant.components.deconz
pydeconz==112
pydeconz==113
# homeassistant.components.delijn
pydelijn==1.0.0

View file

@ -1198,7 +1198,7 @@ pycsspeechtts==1.0.8
pydaikin==2.9.1
# homeassistant.components.deconz
pydeconz==112
pydeconz==113
# homeassistant.components.dexcom
pydexcom==0.2.3

View file

@ -441,6 +441,43 @@ TEST_DATA = [
"next_state": "10.0",
},
),
( # Moisture Sensor
{
"config": {"battery": 100, "offset": 0, "on": True, "reachable": True},
"etag": "1ba99c68975111c04367b67cf95ead44",
"lastannounced": None,
"lastseen": "2023-05-19T09:55Z",
"manufacturername": "_TZE200_myd45weu",
"modelid": "TS0601",
"name": "Soil Sensor",
"state": {
"lastupdated": "2023-05-19T09:42:00.472",
"lowbattery": False,
"moisture": 7213,
},
"swversion": "1.0.8",
"type": "ZHAMoisture",
"uniqueid": "a4:c1:38:fe:86:8f:07:a3-01-0408",
},
{
"entity_count": 3,
"device_count": 3,
"entity_id": "sensor.soil_sensor",
"unique_id": "a4:c1:38:fe:86:8f:07:a3-01-0408-moisture",
"state": "72.13",
"entity_category": None,
"device_class": SensorDeviceClass.MOISTURE,
"state_class": SensorStateClass.MEASUREMENT,
"attributes": {
"state_class": "measurement",
"unit_of_measurement": "%",
"device_class": "moisture",
"friendly_name": "Soil Sensor",
},
"websocket_event": {"state": {"moisture": 6923}},
"next_state": "69.23",
},
),
( # Light level sensor
{
"config": {