Convert fjaraskupan to entity naming (#74723)

pull/74838/head
Joakim Plate 2022-07-09 19:46:53 +02:00 committed by GitHub
parent 4080d2b0da
commit 8ce897f462
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 12 additions and 7 deletions

View File

@ -30,13 +30,13 @@ class EntityDescription(BinarySensorEntityDescription):
SENSORS = (
EntityDescription(
key="grease-filter",
name="Grease Filter",
name="Grease filter",
device_class=BinarySensorDeviceClass.PROBLEM,
is_on=lambda state: state.grease_filter_full,
),
EntityDescription(
key="carbon-filter",
name="Carbon Filter",
name="Carbon filter",
device_class=BinarySensorDeviceClass.PROBLEM,
is_on=lambda state: state.carbon_filter_full,
),
@ -68,6 +68,7 @@ class BinarySensor(CoordinatorEntity[Coordinator], BinarySensorEntity):
"""Grease filter sensor."""
entity_description: EntityDescription
_attr_has_entity_name = True
def __init__(
self,
@ -82,7 +83,6 @@ class BinarySensor(CoordinatorEntity[Coordinator], BinarySensorEntity):
self._attr_unique_id = f"{device.address}-{entity_description.key}"
self._attr_device_info = device_info
self._attr_name = f"{device_info['name']} {entity_description.name}"
@property
def is_on(self) -> bool | None:

View File

@ -67,6 +67,7 @@ class Fan(CoordinatorEntity[Coordinator], FanEntity):
"""Fan entity."""
_attr_supported_features = FanEntityFeature.SET_SPEED | FanEntityFeature.PRESET_MODE
_attr_has_entity_name = True
def __init__(
self,
@ -78,7 +79,6 @@ class Fan(CoordinatorEntity[Coordinator], FanEntity):
super().__init__(coordinator)
self._device = device
self._default_on_speed = 25
self._attr_name = device_info["name"]
self._attr_unique_id = device.address
self._attr_device_info = device_info
self._percentage = 0

View File

@ -29,6 +29,8 @@ async def async_setup_entry(
class Light(CoordinatorEntity[Coordinator], LightEntity):
"""Light device."""
_attr_has_entity_name = True
def __init__(
self,
coordinator: Coordinator,
@ -42,7 +44,6 @@ class Light(CoordinatorEntity[Coordinator], LightEntity):
self._attr_supported_color_modes = {ColorMode.BRIGHTNESS}
self._attr_unique_id = device.address
self._attr_device_info = device_info
self._attr_name = device_info["name"]
async def async_turn_on(self, **kwargs):
"""Turn the light on."""

View File

@ -34,6 +34,8 @@ async def async_setup_entry(
class PeriodicVentingTime(CoordinatorEntity[Coordinator], NumberEntity):
"""Periodic Venting."""
_attr_has_entity_name = True
_attr_native_max_value: float = 59
_attr_native_min_value: float = 0
_attr_native_step: float = 1
@ -51,7 +53,7 @@ class PeriodicVentingTime(CoordinatorEntity[Coordinator], NumberEntity):
self._device = device
self._attr_unique_id = f"{device.address}-periodic-venting"
self._attr_device_info = device_info
self._attr_name = f"{device_info['name']} Periodic Venting"
self._attr_name = "Periodic venting"
@property
def native_value(self) -> float | None:

View File

@ -35,6 +35,8 @@ async def async_setup_entry(
class RssiSensor(CoordinatorEntity[Coordinator], SensorEntity):
"""Sensor device."""
_attr_has_entity_name = True
def __init__(
self,
coordinator: Coordinator,
@ -45,7 +47,7 @@ class RssiSensor(CoordinatorEntity[Coordinator], SensorEntity):
super().__init__(coordinator)
self._attr_unique_id = f"{device.address}-signal-strength"
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_state_class = SensorStateClass.MEASUREMENT
self._attr_native_unit_of_measurement = SIGNAL_STRENGTH_DECIBELS_MILLIWATT