Extract Plugwise DataUpdateCoordinator into module (#65915)
This commit is contained in:
parent
92856bab56
commit
34a636ef0b
7 changed files with 62 additions and 46 deletions
|
@ -9,7 +9,6 @@ from homeassistant.config_entries import ConfigEntry
|
|||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.helpers.entity import EntityCategory
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator
|
||||
|
||||
from .const import (
|
||||
COORDINATOR,
|
||||
|
@ -22,6 +21,7 @@ from .const import (
|
|||
NO_NOTIFICATION_ICON,
|
||||
NOTIFICATION_ICON,
|
||||
)
|
||||
from .coordinator import PlugwiseDataUpdateCoordinator
|
||||
from .entity import PlugwiseEntity
|
||||
|
||||
SEVERITIES = ["other", "info", "warning", "error"]
|
||||
|
@ -46,9 +46,9 @@ async def async_setup_entry(
|
|||
) -> None:
|
||||
"""Set up the Smile binary_sensors from a config entry."""
|
||||
api: Smile = hass.data[DOMAIN][config_entry.entry_id]["api"]
|
||||
coordinator: DataUpdateCoordinator = hass.data[DOMAIN][config_entry.entry_id][
|
||||
COORDINATOR
|
||||
]
|
||||
coordinator: PlugwiseDataUpdateCoordinator = hass.data[DOMAIN][
|
||||
config_entry.entry_id
|
||||
][COORDINATOR]
|
||||
|
||||
entities: list[BinarySensorEntity] = []
|
||||
is_thermostat = api.single_master_thermostat()
|
||||
|
@ -95,7 +95,7 @@ class SmileBinarySensor(PlugwiseEntity, BinarySensorEntity):
|
|||
def __init__(
|
||||
self,
|
||||
api: Smile,
|
||||
coordinator: DataUpdateCoordinator,
|
||||
coordinator: PlugwiseDataUpdateCoordinator,
|
||||
name: str,
|
||||
dev_id: str,
|
||||
description: BinarySensorEntityDescription,
|
||||
|
@ -151,7 +151,7 @@ class PwNotifySensor(SmileBinarySensor):
|
|||
def __init__(
|
||||
self,
|
||||
api: Smile,
|
||||
coordinator: DataUpdateCoordinator,
|
||||
coordinator: PlugwiseDataUpdateCoordinator,
|
||||
name: str,
|
||||
dev_id: str,
|
||||
description: BinarySensorEntityDescription,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue