1 """Support for AquaLogic devices."""
3 from __future__
import annotations
5 from datetime
import timedelta
10 from aqualogic.core
import AquaLogic
11 import voluptuous
as vol
16 EVENT_HOMEASSISTANT_START,
17 EVENT_HOMEASSISTANT_STOP,
24 _LOGGER = logging.getLogger(__name__)
27 UPDATE_TOPIC = f
"{DOMAIN}_update"
31 CONFIG_SCHEMA = vol.Schema(
34 {vol.Required(CONF_HOST): cv.string, vol.Required(CONF_PORT): cv.port}
37 extra=vol.ALLOW_EXTRA,
41 def setup(hass: HomeAssistant, config: ConfigType) -> bool:
42 """Set up AquaLogic platform."""
43 host = config[DOMAIN][CONF_HOST]
44 port = config[DOMAIN][CONF_PORT]
46 hass.data[DOMAIN] = processor
47 hass.bus.listen_once(EVENT_HOMEASSISTANT_START, processor.start_listen)
48 hass.bus.listen_once(EVENT_HOMEASSISTANT_STOP, processor.shutdown)
49 _LOGGER.debug(
"AquaLogicProcessor %s:%i initialized", host, port)
54 """AquaLogic event processor thread."""
56 def __init__(self, hass: HomeAssistant, host: str, port: int) ->
None:
57 """Initialize the data object."""
66 """Start event-processing thread."""
67 _LOGGER.debug(
"Event processing thread started")
71 """Signal shutdown of processing event."""
72 _LOGGER.debug(
"Event processing signaled exit")
76 """Aqualogic data changed callback."""
79 def run(self) -> None:
85 panel.connect(self.
_host_host, self.
_port_port)
91 _LOGGER.error(
"Connection to %s:%d lost", self.
_host_host, self.
_port_port)
92 time.sleep(RECONNECT_INTERVAL.total_seconds())
95 def panel(self) -> AquaLogic | None:
96 """Retrieve the AquaLogic object."""
None shutdown(self, Event event)
None __init__(self, HomeAssistant hass, str host, int port)
AquaLogic|None panel(self)
None start_listen(self, Event event)
None data_changed(self, AquaLogic panel)
bool setup(HomeAssistant hass, ConfigType config)
None dispatcher_send(HomeAssistant hass, str signal, *Any args)