mirror of
https://github.com/home-assistant/core.git
synced 2025-07-14 00:37:13 +00:00
Convert fjaraskupan to entity naming (#74723)
This commit is contained in:
parent
4080d2b0da
commit
8ce897f462
@ -30,13 +30,13 @@ class EntityDescription(BinarySensorEntityDescription):
|
|||||||
SENSORS = (
|
SENSORS = (
|
||||||
EntityDescription(
|
EntityDescription(
|
||||||
key="grease-filter",
|
key="grease-filter",
|
||||||
name="Grease Filter",
|
name="Grease filter",
|
||||||
device_class=BinarySensorDeviceClass.PROBLEM,
|
device_class=BinarySensorDeviceClass.PROBLEM,
|
||||||
is_on=lambda state: state.grease_filter_full,
|
is_on=lambda state: state.grease_filter_full,
|
||||||
),
|
),
|
||||||
EntityDescription(
|
EntityDescription(
|
||||||
key="carbon-filter",
|
key="carbon-filter",
|
||||||
name="Carbon Filter",
|
name="Carbon filter",
|
||||||
device_class=BinarySensorDeviceClass.PROBLEM,
|
device_class=BinarySensorDeviceClass.PROBLEM,
|
||||||
is_on=lambda state: state.carbon_filter_full,
|
is_on=lambda state: state.carbon_filter_full,
|
||||||
),
|
),
|
||||||
@ -68,6 +68,7 @@ class BinarySensor(CoordinatorEntity[Coordinator], BinarySensorEntity):
|
|||||||
"""Grease filter sensor."""
|
"""Grease filter sensor."""
|
||||||
|
|
||||||
entity_description: EntityDescription
|
entity_description: EntityDescription
|
||||||
|
_attr_has_entity_name = True
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
@ -82,7 +83,6 @@ class BinarySensor(CoordinatorEntity[Coordinator], BinarySensorEntity):
|
|||||||
|
|
||||||
self._attr_unique_id = f"{device.address}-{entity_description.key}"
|
self._attr_unique_id = f"{device.address}-{entity_description.key}"
|
||||||
self._attr_device_info = device_info
|
self._attr_device_info = device_info
|
||||||
self._attr_name = f"{device_info['name']} {entity_description.name}"
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_on(self) -> bool | None:
|
def is_on(self) -> bool | None:
|
||||||
|
@ -67,6 +67,7 @@ class Fan(CoordinatorEntity[Coordinator], FanEntity):
|
|||||||
"""Fan entity."""
|
"""Fan entity."""
|
||||||
|
|
||||||
_attr_supported_features = FanEntityFeature.SET_SPEED | FanEntityFeature.PRESET_MODE
|
_attr_supported_features = FanEntityFeature.SET_SPEED | FanEntityFeature.PRESET_MODE
|
||||||
|
_attr_has_entity_name = True
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
@ -78,7 +79,6 @@ class Fan(CoordinatorEntity[Coordinator], FanEntity):
|
|||||||
super().__init__(coordinator)
|
super().__init__(coordinator)
|
||||||
self._device = device
|
self._device = device
|
||||||
self._default_on_speed = 25
|
self._default_on_speed = 25
|
||||||
self._attr_name = device_info["name"]
|
|
||||||
self._attr_unique_id = device.address
|
self._attr_unique_id = device.address
|
||||||
self._attr_device_info = device_info
|
self._attr_device_info = device_info
|
||||||
self._percentage = 0
|
self._percentage = 0
|
||||||
|
@ -29,6 +29,8 @@ async def async_setup_entry(
|
|||||||
class Light(CoordinatorEntity[Coordinator], LightEntity):
|
class Light(CoordinatorEntity[Coordinator], LightEntity):
|
||||||
"""Light device."""
|
"""Light device."""
|
||||||
|
|
||||||
|
_attr_has_entity_name = True
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
coordinator: Coordinator,
|
coordinator: Coordinator,
|
||||||
@ -42,7 +44,6 @@ class Light(CoordinatorEntity[Coordinator], LightEntity):
|
|||||||
self._attr_supported_color_modes = {ColorMode.BRIGHTNESS}
|
self._attr_supported_color_modes = {ColorMode.BRIGHTNESS}
|
||||||
self._attr_unique_id = device.address
|
self._attr_unique_id = device.address
|
||||||
self._attr_device_info = device_info
|
self._attr_device_info = device_info
|
||||||
self._attr_name = device_info["name"]
|
|
||||||
|
|
||||||
async def async_turn_on(self, **kwargs):
|
async def async_turn_on(self, **kwargs):
|
||||||
"""Turn the light on."""
|
"""Turn the light on."""
|
||||||
|
@ -34,6 +34,8 @@ async def async_setup_entry(
|
|||||||
class PeriodicVentingTime(CoordinatorEntity[Coordinator], NumberEntity):
|
class PeriodicVentingTime(CoordinatorEntity[Coordinator], NumberEntity):
|
||||||
"""Periodic Venting."""
|
"""Periodic Venting."""
|
||||||
|
|
||||||
|
_attr_has_entity_name = True
|
||||||
|
|
||||||
_attr_native_max_value: float = 59
|
_attr_native_max_value: float = 59
|
||||||
_attr_native_min_value: float = 0
|
_attr_native_min_value: float = 0
|
||||||
_attr_native_step: float = 1
|
_attr_native_step: float = 1
|
||||||
@ -51,7 +53,7 @@ class PeriodicVentingTime(CoordinatorEntity[Coordinator], NumberEntity):
|
|||||||
self._device = device
|
self._device = device
|
||||||
self._attr_unique_id = f"{device.address}-periodic-venting"
|
self._attr_unique_id = f"{device.address}-periodic-venting"
|
||||||
self._attr_device_info = device_info
|
self._attr_device_info = device_info
|
||||||
self._attr_name = f"{device_info['name']} Periodic Venting"
|
self._attr_name = "Periodic venting"
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def native_value(self) -> float | None:
|
def native_value(self) -> float | None:
|
||||||
|
@ -35,6 +35,8 @@ async def async_setup_entry(
|
|||||||
class RssiSensor(CoordinatorEntity[Coordinator], SensorEntity):
|
class RssiSensor(CoordinatorEntity[Coordinator], SensorEntity):
|
||||||
"""Sensor device."""
|
"""Sensor device."""
|
||||||
|
|
||||||
|
_attr_has_entity_name = True
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
coordinator: Coordinator,
|
coordinator: Coordinator,
|
||||||
@ -45,7 +47,7 @@ class RssiSensor(CoordinatorEntity[Coordinator], SensorEntity):
|
|||||||
super().__init__(coordinator)
|
super().__init__(coordinator)
|
||||||
self._attr_unique_id = f"{device.address}-signal-strength"
|
self._attr_unique_id = f"{device.address}-signal-strength"
|
||||||
self._attr_device_info = device_info
|
self._attr_device_info = device_info
|
||||||
self._attr_name = f"{device_info['name']} Signal Strength"
|
self._attr_name = "Signal strength"
|
||||||
self._attr_device_class = SensorDeviceClass.SIGNAL_STRENGTH
|
self._attr_device_class = SensorDeviceClass.SIGNAL_STRENGTH
|
||||||
self._attr_state_class = SensorStateClass.MEASUREMENT
|
self._attr_state_class = SensorStateClass.MEASUREMENT
|
||||||
self._attr_native_unit_of_measurement = SIGNAL_STRENGTH_DECIBELS_MILLIWATT
|
self._attr_native_unit_of_measurement = SIGNAL_STRENGTH_DECIBELS_MILLIWATT
|
||||||
|
Loading…
x
Reference in New Issue
Block a user