forked from home-assistant/core
Minor refactoring of keba integration (#54976)
* minor refactoring * fix type annotation
This commit is contained in:
@@ -16,7 +16,7 @@ from homeassistant.const import (
|
|||||||
POWER_KILO_WATT,
|
POWER_KILO_WATT,
|
||||||
)
|
)
|
||||||
|
|
||||||
from . import DOMAIN
|
from . import DOMAIN, KebaHandler
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
|
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
|
||||||
@@ -90,14 +90,13 @@ class KebaSensor(SensorEntity):
|
|||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
keba,
|
keba: KebaHandler,
|
||||||
entity_type,
|
entity_type: str,
|
||||||
description: SensorEntityDescription,
|
description: SensorEntityDescription,
|
||||||
):
|
) -> None:
|
||||||
"""Initialize the KEBA Sensor."""
|
"""Initialize the KEBA Sensor."""
|
||||||
self._keba = keba
|
self._keba = keba
|
||||||
self.entity_description = description
|
self.entity_description = description
|
||||||
self._entity_type = entity_type
|
|
||||||
|
|
||||||
self._attr_name = f"{keba.device_name} {description.name}"
|
self._attr_name = f"{keba.device_name} {description.name}"
|
||||||
self._attr_unique_id = f"{keba.device_id}_{entity_type}"
|
self._attr_unique_id = f"{keba.device_id}_{entity_type}"
|
||||||
|
Reference in New Issue
Block a user