mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 13:17:32 +00:00
Add YoLink YS8017 support (#122064)
This commit is contained in:
parent
16434b5306
commit
8cb7e9785f
@ -17,3 +17,5 @@ YOLINK_OFFLINE_TIME = 32400
|
||||
|
||||
DEV_MODEL_WATER_METER_YS5007 = "YS5007"
|
||||
DEV_MODEL_MULTI_OUTLET_YS6801 = "YS6801"
|
||||
DEV_MODEL_TH_SENSOR_YS8017_UC = "YS8017-UC"
|
||||
DEV_MODEL_TH_SENSOR_YS8017_EC = "YS8017-EC"
|
||||
|
@ -48,7 +48,7 @@ from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
from homeassistant.util import percentage
|
||||
|
||||
from .const import DOMAIN
|
||||
from .const import DEV_MODEL_TH_SENSOR_YS8017_EC, DEV_MODEL_TH_SENSOR_YS8017_UC, DOMAIN
|
||||
from .coordinator import YoLinkCoordinator
|
||||
from .entity import YoLinkEntity
|
||||
|
||||
@ -108,6 +108,11 @@ MCU_DEV_TEMPERATURE_SENSOR = [
|
||||
ATTR_DEVICE_CO_SMOKE_SENSOR,
|
||||
]
|
||||
|
||||
NONE_HUMIDITY_SENSOR_MODELS = [
|
||||
DEV_MODEL_TH_SENSOR_YS8017_UC,
|
||||
DEV_MODEL_TH_SENSOR_YS8017_EC,
|
||||
]
|
||||
|
||||
|
||||
def cvt_battery(val: int | None) -> int | None:
|
||||
"""Convert battery to percentage."""
|
||||
@ -141,7 +146,8 @@ SENSOR_TYPES: tuple[YoLinkSensorEntityDescription, ...] = (
|
||||
device_class=SensorDeviceClass.HUMIDITY,
|
||||
native_unit_of_measurement=PERCENTAGE,
|
||||
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]
|
||||
and device.device_model_name not in NONE_HUMIDITY_SENSOR_MODELS,
|
||||
),
|
||||
YoLinkSensorEntityDescription(
|
||||
key="temperature",
|
||||
|
Loading…
x
Reference in New Issue
Block a user