mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 13:17:32 +00:00
Migrate Verisure to new entity naming style (#74997)
This commit is contained in:
parent
a30d7e5104
commit
4a39087fe7
@ -33,7 +33,7 @@ class VerisureAlarm(
|
||||
"""Representation of a Verisure alarm status."""
|
||||
|
||||
_attr_code_format = CodeFormat.NUMBER
|
||||
_attr_name = "Verisure Alarm"
|
||||
_attr_has_entity_name = True
|
||||
_attr_supported_features = (
|
||||
AlarmControlPanelEntityFeature.ARM_HOME
|
||||
| AlarmControlPanelEntityFeature.ARM_AWAY
|
||||
|
@ -39,13 +39,13 @@ class VerisureDoorWindowSensor(
|
||||
"""Representation of a Verisure door window sensor."""
|
||||
|
||||
_attr_device_class = BinarySensorDeviceClass.OPENING
|
||||
_attr_has_entity_name = True
|
||||
|
||||
def __init__(
|
||||
self, coordinator: VerisureDataUpdateCoordinator, serial_number: str
|
||||
) -> None:
|
||||
"""Initialize the Verisure door window sensor."""
|
||||
super().__init__(coordinator)
|
||||
self._attr_name = coordinator.data["door_window"][serial_number]["area"]
|
||||
self._attr_unique_id = f"{serial_number}_door_window"
|
||||
self.serial_number = serial_number
|
||||
|
||||
@ -84,9 +84,10 @@ class VerisureEthernetStatus(
|
||||
):
|
||||
"""Representation of a Verisure VBOX internet status."""
|
||||
|
||||
_attr_name = "Verisure Ethernet status"
|
||||
_attr_device_class = BinarySensorDeviceClass.CONNECTIVITY
|
||||
_attr_entity_category = EntityCategory.DIAGNOSTIC
|
||||
_attr_has_entity_name = True
|
||||
_attr_name = "Ethernet status"
|
||||
|
||||
@property
|
||||
def unique_id(self) -> str:
|
||||
|
@ -46,6 +46,8 @@ async def async_setup_entry(
|
||||
class VerisureSmartcam(CoordinatorEntity[VerisureDataUpdateCoordinator], Camera):
|
||||
"""Representation of a Verisure camera."""
|
||||
|
||||
_attr_has_entity_name = True
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
coordinator: VerisureDataUpdateCoordinator,
|
||||
@ -56,7 +58,6 @@ class VerisureSmartcam(CoordinatorEntity[VerisureDataUpdateCoordinator], Camera)
|
||||
super().__init__(coordinator)
|
||||
Camera.__init__(self)
|
||||
|
||||
self._attr_name = coordinator.data["cameras"][serial_number]["area"]
|
||||
self._attr_unique_id = serial_number
|
||||
|
||||
self.serial_number = serial_number
|
||||
|
@ -59,13 +59,13 @@ async def async_setup_entry(
|
||||
class VerisureDoorlock(CoordinatorEntity[VerisureDataUpdateCoordinator], LockEntity):
|
||||
"""Representation of a Verisure doorlock."""
|
||||
|
||||
_attr_has_entity_name = True
|
||||
|
||||
def __init__(
|
||||
self, coordinator: VerisureDataUpdateCoordinator, serial_number: str
|
||||
) -> None:
|
||||
"""Initialize the Verisure lock."""
|
||||
super().__init__(coordinator)
|
||||
|
||||
self._attr_name = coordinator.data["locks"][serial_number]["area"]
|
||||
self._attr_unique_id = serial_number
|
||||
|
||||
self.serial_number = serial_number
|
||||
|
@ -51,6 +51,8 @@ class VerisureThermometer(
|
||||
"""Representation of a Verisure thermometer."""
|
||||
|
||||
_attr_device_class = SensorDeviceClass.TEMPERATURE
|
||||
_attr_has_entity_name = True
|
||||
_attr_name = "Temperature"
|
||||
_attr_native_unit_of_measurement = TEMP_CELSIUS
|
||||
_attr_state_class = SensorStateClass.MEASUREMENT
|
||||
|
||||
@ -62,12 +64,6 @@ class VerisureThermometer(
|
||||
self._attr_unique_id = f"{serial_number}_temperature"
|
||||
self.serial_number = serial_number
|
||||
|
||||
@property
|
||||
def name(self) -> str:
|
||||
"""Return the name of the entity."""
|
||||
name = self.coordinator.data["climate"][self.serial_number]["deviceArea"]
|
||||
return f"{name} Temperature"
|
||||
|
||||
@property
|
||||
def device_info(self) -> DeviceInfo:
|
||||
"""Return device information about this entity."""
|
||||
@ -106,6 +102,8 @@ class VerisureHygrometer(
|
||||
"""Representation of a Verisure hygrometer."""
|
||||
|
||||
_attr_device_class = SensorDeviceClass.HUMIDITY
|
||||
_attr_has_entity_name = True
|
||||
_attr_name = "Humidity"
|
||||
_attr_native_unit_of_measurement = PERCENTAGE
|
||||
_attr_state_class = SensorStateClass.MEASUREMENT
|
||||
|
||||
@ -117,12 +115,6 @@ class VerisureHygrometer(
|
||||
self._attr_unique_id = f"{serial_number}_humidity"
|
||||
self.serial_number = serial_number
|
||||
|
||||
@property
|
||||
def name(self) -> str:
|
||||
"""Return the name of the entity."""
|
||||
name = self.coordinator.data["climate"][self.serial_number]["deviceArea"]
|
||||
return f"{name} Humidity"
|
||||
|
||||
@property
|
||||
def device_info(self) -> DeviceInfo:
|
||||
"""Return device information about this entity."""
|
||||
@ -160,6 +152,8 @@ class VerisureMouseDetection(
|
||||
):
|
||||
"""Representation of a Verisure mouse detector."""
|
||||
|
||||
_attr_name = "Mouse"
|
||||
_attr_has_entity_name = True
|
||||
_attr_native_unit_of_measurement = "Mice"
|
||||
|
||||
def __init__(
|
||||
@ -170,12 +164,6 @@ class VerisureMouseDetection(
|
||||
self._attr_unique_id = f"{serial_number}_mice"
|
||||
self.serial_number = serial_number
|
||||
|
||||
@property
|
||||
def name(self) -> str:
|
||||
"""Return the name of the entity."""
|
||||
name = self.coordinator.data["mice"][self.serial_number]["area"]
|
||||
return f"{name} Mouse"
|
||||
|
||||
@property
|
||||
def device_info(self) -> DeviceInfo:
|
||||
"""Return device information about this entity."""
|
||||
|
@ -30,13 +30,13 @@ async def async_setup_entry(
|
||||
class VerisureSmartplug(CoordinatorEntity[VerisureDataUpdateCoordinator], SwitchEntity):
|
||||
"""Representation of a Verisure smartplug."""
|
||||
|
||||
_attr_has_entity_name = True
|
||||
|
||||
def __init__(
|
||||
self, coordinator: VerisureDataUpdateCoordinator, serial_number: str
|
||||
) -> None:
|
||||
"""Initialize the Verisure device."""
|
||||
super().__init__(coordinator)
|
||||
|
||||
self._attr_name = coordinator.data["smart_plugs"][serial_number]["area"]
|
||||
self._attr_unique_id = serial_number
|
||||
|
||||
self.serial_number = serial_number
|
||||
|
Loading…
x
Reference in New Issue
Block a user