Add Yolink lock support (#73069)
* Add yolink lock support * Update .coveragerct * extract the commons
This commit is contained in:
parent
1744e7224b
commit
db53ab5fd0
9 changed files with 105 additions and 34 deletions
|
@ -21,6 +21,7 @@ from homeassistant.util import percentage
|
|||
from .const import (
|
||||
ATTR_COORDINATORS,
|
||||
ATTR_DEVICE_DOOR_SENSOR,
|
||||
ATTR_DEVICE_LOCK,
|
||||
ATTR_DEVICE_MOTION_SENSOR,
|
||||
ATTR_DEVICE_TH_SENSOR,
|
||||
ATTR_DEVICE_VIBRATION_SENSOR,
|
||||
|
@ -51,6 +52,7 @@ SENSOR_DEVICE_TYPE = [
|
|||
ATTR_DEVICE_MOTION_SENSOR,
|
||||
ATTR_DEVICE_TH_SENSOR,
|
||||
ATTR_DEVICE_VIBRATION_SENSOR,
|
||||
ATTR_DEVICE_LOCK,
|
||||
]
|
||||
|
||||
BATTERY_POWER_SENSOR = [
|
||||
|
@ -58,6 +60,7 @@ BATTERY_POWER_SENSOR = [
|
|||
ATTR_DEVICE_TH_SENSOR,
|
||||
ATTR_DEVICE_MOTION_SENSOR,
|
||||
ATTR_DEVICE_VIBRATION_SENSOR,
|
||||
ATTR_DEVICE_LOCK,
|
||||
]
|
||||
|
||||
|
||||
|
@ -112,6 +115,7 @@ async def async_setup_entry(
|
|||
if description.exists_fn(sensor_device_coordinator.device):
|
||||
entities.append(
|
||||
YoLinkSensorEntity(
|
||||
config_entry,
|
||||
sensor_device_coordinator,
|
||||
description,
|
||||
)
|
||||
|
@ -126,11 +130,12 @@ class YoLinkSensorEntity(YoLinkEntity, SensorEntity):
|
|||
|
||||
def __init__(
|
||||
self,
|
||||
config_entry: ConfigEntry,
|
||||
coordinator: YoLinkCoordinator,
|
||||
description: YoLinkSensorEntityDescription,
|
||||
) -> None:
|
||||
"""Init YoLink Sensor."""
|
||||
super().__init__(coordinator)
|
||||
super().__init__(config_entry, coordinator)
|
||||
self.entity_description = description
|
||||
self._attr_unique_id = (
|
||||
f"{coordinator.device.device_id} {self.entity_description.key}"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue