mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 05:07:41 +00:00
Late review comment in edl21 (#53464)
* Late review comment. * Review comment. * pylint. * Update homeassistant/components/edl21/sensor.py * Callback typing. * Complete typing Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
This commit is contained in:
parent
f3ba71748b
commit
15ec9fbf6c
@ -10,13 +10,15 @@ import voluptuous as vol
|
|||||||
|
|
||||||
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||||
from homeassistant.const import CONF_NAME
|
from homeassistant.const import CONF_NAME
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.dispatcher import (
|
from homeassistant.helpers.dispatcher import (
|
||||||
async_dispatcher_connect,
|
async_dispatcher_connect,
|
||||||
async_dispatcher_send,
|
async_dispatcher_send,
|
||||||
)
|
)
|
||||||
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
from homeassistant.helpers.entity_registry import async_get_registry
|
from homeassistant.helpers.entity_registry import async_get_registry
|
||||||
|
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||||
from homeassistant.util.dt import utcnow
|
from homeassistant.util.dt import utcnow
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
@ -35,7 +37,12 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
|
async def async_setup_platform(
|
||||||
|
hass: HomeAssistant,
|
||||||
|
config: ConfigType,
|
||||||
|
async_add_entities: AddEntitiesCallback,
|
||||||
|
discovery_info: DiscoveryInfoType | None = None,
|
||||||
|
) -> None:
|
||||||
"""Set up the EDL21 sensor."""
|
"""Set up the EDL21 sensor."""
|
||||||
hass.data[DOMAIN] = EDL21(hass, config, async_add_entities)
|
hass.data[DOMAIN] = EDL21(hass, config, async_add_entities)
|
||||||
await hass.data[DOMAIN].connect()
|
await hass.data[DOMAIN].connect()
|
||||||
@ -126,7 +133,7 @@ class EDL21:
|
|||||||
|
|
||||||
def __init__(self, hass, config, async_add_entities) -> None:
|
def __init__(self, hass, config, async_add_entities) -> None:
|
||||||
"""Initialize an EDL21 object."""
|
"""Initialize an EDL21 object."""
|
||||||
self._registered_obis: set[()] = set()
|
self._registered_obis: set[tuple[str, str]] = set()
|
||||||
self._hass = hass
|
self._hass = hass
|
||||||
self._async_add_entities = async_add_entities
|
self._async_add_entities = async_add_entities
|
||||||
self._name = config[CONF_NAME]
|
self._name = config[CONF_NAME]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user