Minor refactoring of keba integration (#54976)

* minor refactoring

* fix type annotation
This commit is contained in:
carstenschroeder 2021-08-21 14:17:19 +02:00 committed by GitHub
parent 59809503d1
commit 2cfd78bc49
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -16,7 +16,7 @@ from homeassistant.const import (
POWER_KILO_WATT,
)
from . import DOMAIN
from . import DOMAIN, KebaHandler
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
@ -90,14 +90,13 @@ class KebaSensor(SensorEntity):
def __init__(
self,
keba,
entity_type,
keba: KebaHandler,
entity_type: str,
description: SensorEntityDescription,
):
) -> None:
"""Initialize the KEBA Sensor."""
self._keba = keba
self.entity_description = description
self._entity_type = entity_type
self._attr_name = f"{keba.device_name} {description.name}"
self._attr_unique_id = f"{keba.device_id}_{entity_type}"