mirror of
https://github.com/home-assistant/core.git
synced 2025-07-13 00:07:10 +00:00
Add YS8009 support to Yolink (#148538)
This commit is contained in:
parent
a00f61f7be
commit
8881919efd
@ -6,5 +6,5 @@
|
||||
"dependencies": ["auth", "application_credentials"],
|
||||
"documentation": "https://www.home-assistant.io/integrations/yolink",
|
||||
"iot_class": "cloud_push",
|
||||
"requirements": ["yolink-api==0.5.5"]
|
||||
"requirements": ["yolink-api==0.5.7"]
|
||||
}
|
||||
|
@ -21,6 +21,7 @@ from yolink.const import (
|
||||
ATTR_DEVICE_POWER_FAILURE_ALARM,
|
||||
ATTR_DEVICE_SIREN,
|
||||
ATTR_DEVICE_SMART_REMOTER,
|
||||
ATTR_DEVICE_SOIL_TH_SENSOR,
|
||||
ATTR_DEVICE_SWITCH,
|
||||
ATTR_DEVICE_TH_SENSOR,
|
||||
ATTR_DEVICE_THERMOSTAT,
|
||||
@ -42,6 +43,7 @@ from homeassistant.const import (
|
||||
PERCENTAGE,
|
||||
SIGNAL_STRENGTH_DECIBELS_MILLIWATT,
|
||||
EntityCategory,
|
||||
UnitOfConductivity,
|
||||
UnitOfEnergy,
|
||||
UnitOfLength,
|
||||
UnitOfPower,
|
||||
@ -103,6 +105,7 @@ SENSOR_DEVICE_TYPE = [
|
||||
ATTR_DEVICE_MANIPULATOR,
|
||||
ATTR_DEVICE_CO_SMOKE_SENSOR,
|
||||
ATTR_GARAGE_DOOR_CONTROLLER,
|
||||
ATTR_DEVICE_SOIL_TH_SENSOR,
|
||||
]
|
||||
|
||||
BATTERY_POWER_SENSOR = [
|
||||
@ -122,6 +125,7 @@ BATTERY_POWER_SENSOR = [
|
||||
ATTR_DEVICE_WATER_DEPTH_SENSOR,
|
||||
ATTR_DEVICE_WATER_METER_CONTROLLER,
|
||||
ATTR_DEVICE_MULTI_WATER_METER_CONTROLLER,
|
||||
ATTR_DEVICE_SOIL_TH_SENSOR,
|
||||
]
|
||||
|
||||
MCU_DEV_TEMPERATURE_SENSOR = [
|
||||
@ -182,7 +186,7 @@ SENSOR_TYPES: tuple[YoLinkSensorEntityDescription, ...] = (
|
||||
native_unit_of_measurement=PERCENTAGE,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
exists_fn=lambda device: (
|
||||
device.device_type in [ATTR_DEVICE_TH_SENSOR]
|
||||
device.device_type in [ATTR_DEVICE_TH_SENSOR, ATTR_DEVICE_SOIL_TH_SENSOR]
|
||||
and device.device_model_name not in NONE_HUMIDITY_SENSOR_MODELS
|
||||
),
|
||||
),
|
||||
@ -191,7 +195,8 @@ SENSOR_TYPES: tuple[YoLinkSensorEntityDescription, ...] = (
|
||||
device_class=SensorDeviceClass.TEMPERATURE,
|
||||
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
exists_fn=lambda device: device.device_type in [ATTR_DEVICE_TH_SENSOR],
|
||||
exists_fn=lambda device: device.device_type
|
||||
in [ATTR_DEVICE_TH_SENSOR, ATTR_DEVICE_SOIL_TH_SENSOR],
|
||||
),
|
||||
# mcu temperature
|
||||
YoLinkSensorEntityDescription(
|
||||
@ -206,7 +211,7 @@ SENSOR_TYPES: tuple[YoLinkSensorEntityDescription, ...] = (
|
||||
key="loraInfo",
|
||||
device_class=SensorDeviceClass.SIGNAL_STRENGTH,
|
||||
native_unit_of_measurement=SIGNAL_STRENGTH_DECIBELS_MILLIWATT,
|
||||
value=lambda value: value["signal"] if value is not None else None,
|
||||
value=lambda value: value.get("signal") if value is not None else None,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
entity_registry_enabled_default=False,
|
||||
@ -302,6 +307,14 @@ SENSOR_TYPES: tuple[YoLinkSensorEntityDescription, ...] = (
|
||||
exists_fn=lambda device: device.device_model_name in POWER_SUPPORT_MODELS,
|
||||
value=lambda value: value / 100 if value is not None else None,
|
||||
),
|
||||
YoLinkSensorEntityDescription(
|
||||
key="conductivity",
|
||||
device_class=SensorDeviceClass.CONDUCTIVITY,
|
||||
native_unit_of_measurement=UnitOfConductivity.MICROSIEMENS_PER_CM,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
exists_fn=lambda device: device.device_type in [ATTR_DEVICE_SOIL_TH_SENSOR],
|
||||
should_update_entity=lambda value: value is not None,
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
|
2
requirements_all.txt
generated
2
requirements_all.txt
generated
@ -3163,7 +3163,7 @@ yeelight==0.7.16
|
||||
yeelightsunflower==0.0.10
|
||||
|
||||
# homeassistant.components.yolink
|
||||
yolink-api==0.5.5
|
||||
yolink-api==0.5.7
|
||||
|
||||
# homeassistant.components.youless
|
||||
youless-api==2.2.0
|
||||
|
2
requirements_test_all.txt
generated
2
requirements_test_all.txt
generated
@ -2610,7 +2610,7 @@ yalexs==8.10.0
|
||||
yeelight==0.7.16
|
||||
|
||||
# homeassistant.components.yolink
|
||||
yolink-api==0.5.5
|
||||
yolink-api==0.5.7
|
||||
|
||||
# homeassistant.components.youless
|
||||
youless-api==2.2.0
|
||||
|
Loading…
x
Reference in New Issue
Block a user