2121 ATTR_DEVICE_POWER_FAILURE_ALARM ,
2222 ATTR_DEVICE_SIREN ,
2323 ATTR_DEVICE_SMART_REMOTER ,
24+ ATTR_DEVICE_SOIL_TH_SENSOR ,
2425 ATTR_DEVICE_SWITCH ,
2526 ATTR_DEVICE_TH_SENSOR ,
2627 ATTR_DEVICE_THERMOSTAT ,
4243 PERCENTAGE ,
4344 SIGNAL_STRENGTH_DECIBELS_MILLIWATT ,
4445 EntityCategory ,
46+ UnitOfConductivity ,
4547 UnitOfEnergy ,
4648 UnitOfLength ,
4749 UnitOfPower ,
@@ -103,6 +105,7 @@ class YoLinkSensorEntityDescription(SensorEntityDescription):
103105 ATTR_DEVICE_MANIPULATOR ,
104106 ATTR_DEVICE_CO_SMOKE_SENSOR ,
105107 ATTR_GARAGE_DOOR_CONTROLLER ,
108+ ATTR_DEVICE_SOIL_TH_SENSOR ,
106109]
107110
108111BATTERY_POWER_SENSOR = [
@@ -122,6 +125,7 @@ class YoLinkSensorEntityDescription(SensorEntityDescription):
122125 ATTR_DEVICE_WATER_DEPTH_SENSOR ,
123126 ATTR_DEVICE_WATER_METER_CONTROLLER ,
124127 ATTR_DEVICE_MULTI_WATER_METER_CONTROLLER ,
128+ ATTR_DEVICE_SOIL_TH_SENSOR ,
125129]
126130
127131MCU_DEV_TEMPERATURE_SENSOR = [
@@ -182,7 +186,7 @@ def cvt_volume(val: int | None) -> str | None:
182186 native_unit_of_measurement = PERCENTAGE ,
183187 state_class = SensorStateClass .MEASUREMENT ,
184188 exists_fn = lambda device : (
185- device .device_type in [ATTR_DEVICE_TH_SENSOR ]
189+ device .device_type in [ATTR_DEVICE_TH_SENSOR , ATTR_DEVICE_SOIL_TH_SENSOR ]
186190 and device .device_model_name not in NONE_HUMIDITY_SENSOR_MODELS
187191 ),
188192 ),
@@ -191,7 +195,8 @@ def cvt_volume(val: int | None) -> str | None:
191195 device_class = SensorDeviceClass .TEMPERATURE ,
192196 native_unit_of_measurement = UnitOfTemperature .CELSIUS ,
193197 state_class = SensorStateClass .MEASUREMENT ,
194- exists_fn = lambda device : device .device_type in [ATTR_DEVICE_TH_SENSOR ],
198+ exists_fn = lambda device : device .device_type
199+ in [ATTR_DEVICE_TH_SENSOR , ATTR_DEVICE_SOIL_TH_SENSOR ],
195200 ),
196201 # mcu temperature
197202 YoLinkSensorEntityDescription (
@@ -206,7 +211,7 @@ def cvt_volume(val: int | None) -> str | None:
206211 key = "loraInfo" ,
207212 device_class = SensorDeviceClass .SIGNAL_STRENGTH ,
208213 native_unit_of_measurement = SIGNAL_STRENGTH_DECIBELS_MILLIWATT ,
209- value = lambda value : value [ "signal" ] if value is not None else None ,
214+ value = lambda value : value . get ( "signal" ) if value is not None else None ,
210215 state_class = SensorStateClass .MEASUREMENT ,
211216 entity_category = EntityCategory .DIAGNOSTIC ,
212217 entity_registry_enabled_default = False ,
@@ -302,6 +307,14 @@ def cvt_volume(val: int | None) -> str | None:
302307 exists_fn = lambda device : device .device_model_name in POWER_SUPPORT_MODELS ,
303308 value = lambda value : value / 100 if value is not None else None ,
304309 ),
310+ YoLinkSensorEntityDescription (
311+ key = "conductivity" ,
312+ device_class = SensorDeviceClass .CONDUCTIVITY ,
313+ native_unit_of_measurement = UnitOfConductivity .MICROSIEMENS_PER_CM ,
314+ state_class = SensorStateClass .MEASUREMENT ,
315+ exists_fn = lambda device : device .device_type in [ATTR_DEVICE_SOIL_TH_SENSOR ],
316+ should_update_entity = lambda value : value is not None ,
317+ ),
305318)
306319
307320
0 commit comments