Use dataclass for abode system class (#101138)

This commit is contained in:
Jan Bouwhuis 2023-09-30 10:44:46 +02:00 committed by GitHub
parent 9444a474ec
commit 42eb849cae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,6 +1,7 @@
"""Support for the Abode Security System."""
from __future__ import annotations
from dataclasses import dataclass, field
from functools import partial
from jaraco.abode.automation import Automation as AbodeAuto
@ -25,7 +26,7 @@ from homeassistant.const import (
EVENT_HOMEASSISTANT_STOP,
Platform,
)
from homeassistant.core import Event, HomeAssistant, ServiceCall
from homeassistant.core import CALLBACK_TYPE, Event, HomeAssistant, ServiceCall
from homeassistant.exceptions import ConfigEntryAuthFailed, ConfigEntryNotReady
from homeassistant.helpers import config_validation as cv, entity
from homeassistant.helpers.device_registry import DeviceInfo
@ -71,15 +72,14 @@ PLATFORMS = [
]
@dataclass
class AbodeSystem:
"""Abode System class."""
def __init__(self, abode: Abode, polling: bool) -> None:
"""Initialize the system."""
self.abode = abode
self.polling = polling
self.entity_ids: set[str | None] = set()
self.logout_listener = None
abode: Abode
polling: bool
entity_ids: set[str | None] = field(default_factory=set)
logout_listener: CALLBACK_TYPE | None = None
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: