mirror of
https://github.com/home-assistant/core.git
synced 2025-07-16 09:47:13 +00:00
Strictly type Twente Milieu integration (#50062)
This commit is contained in:
parent
af832e5434
commit
e3e9239798
@ -12,7 +12,7 @@ from twentemilieu import (
|
|||||||
|
|
||||||
from homeassistant.components.sensor import SensorEntity
|
from homeassistant.components.sensor import SensorEntity
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import CONF_ID
|
from homeassistant.const import ATTR_IDENTIFIERS, ATTR_MANUFACTURER, ATTR_NAME, CONF_ID
|
||||||
from homeassistant.core import HomeAssistant, callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
from homeassistant.exceptions import PlatformNotReady
|
from homeassistant.exceptions import PlatformNotReady
|
||||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||||
@ -89,7 +89,6 @@ class TwenteMilieuSensor(SensorEntity):
|
|||||||
self._name = name
|
self._name = name
|
||||||
self._twentemilieu = twentemilieu
|
self._twentemilieu = twentemilieu
|
||||||
self._waste_type = waste_type
|
self._waste_type = waste_type
|
||||||
self._unsub_dispatcher = None
|
|
||||||
|
|
||||||
self._state = None
|
self._state = None
|
||||||
|
|
||||||
@ -120,14 +119,12 @@ class TwenteMilieuSensor(SensorEntity):
|
|||||||
|
|
||||||
async def async_added_to_hass(self) -> None:
|
async def async_added_to_hass(self) -> None:
|
||||||
"""Connect to dispatcher listening for entity data notifications."""
|
"""Connect to dispatcher listening for entity data notifications."""
|
||||||
self._unsub_dispatcher = async_dispatcher_connect(
|
self.async_on_remove(
|
||||||
self.hass, DATA_UPDATE, self._schedule_immediate_update
|
async_dispatcher_connect(
|
||||||
|
self.hass, DATA_UPDATE, self._schedule_immediate_update
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
async def async_will_remove_from_hass(self) -> None:
|
|
||||||
"""Disconnect from update signal."""
|
|
||||||
self._unsub_dispatcher()
|
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
def _schedule_immediate_update(self, unique_id: str) -> None:
|
def _schedule_immediate_update(self, unique_id: str) -> None:
|
||||||
"""Schedule an immediate update of the entity."""
|
"""Schedule an immediate update of the entity."""
|
||||||
@ -149,7 +146,7 @@ class TwenteMilieuSensor(SensorEntity):
|
|||||||
def device_info(self) -> DeviceInfo:
|
def device_info(self) -> DeviceInfo:
|
||||||
"""Return device information about Twente Milieu."""
|
"""Return device information about Twente Milieu."""
|
||||||
return {
|
return {
|
||||||
"identifiers": {(DOMAIN, self._unique_id)},
|
ATTR_IDENTIFIERS: {(DOMAIN, self._unique_id)},
|
||||||
"name": "Twente Milieu",
|
ATTR_NAME: "Twente Milieu",
|
||||||
"manufacturer": "Twente Milieu",
|
ATTR_MANUFACTURER: "Twente Milieu",
|
||||||
}
|
}
|
||||||
|
3
mypy.ini
3
mypy.ini
@ -1269,9 +1269,6 @@ ignore_errors = true
|
|||||||
[mypy-homeassistant.components.tuya.*]
|
[mypy-homeassistant.components.tuya.*]
|
||||||
ignore_errors = true
|
ignore_errors = true
|
||||||
|
|
||||||
[mypy-homeassistant.components.twentemilieu.*]
|
|
||||||
ignore_errors = true
|
|
||||||
|
|
||||||
[mypy-homeassistant.components.unifi.*]
|
[mypy-homeassistant.components.unifi.*]
|
||||||
ignore_errors = true
|
ignore_errors = true
|
||||||
|
|
||||||
|
@ -226,7 +226,6 @@ IGNORED_MODULES: Final[list[str]] = [
|
|||||||
"homeassistant.components.trace.*",
|
"homeassistant.components.trace.*",
|
||||||
"homeassistant.components.tradfri.*",
|
"homeassistant.components.tradfri.*",
|
||||||
"homeassistant.components.tuya.*",
|
"homeassistant.components.tuya.*",
|
||||||
"homeassistant.components.twentemilieu.*",
|
|
||||||
"homeassistant.components.unifi.*",
|
"homeassistant.components.unifi.*",
|
||||||
"homeassistant.components.upcloud.*",
|
"homeassistant.components.upcloud.*",
|
||||||
"homeassistant.components.updater.*",
|
"homeassistant.components.updater.*",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user