From acbadce9fc2c16ef65321507b0f1bef7e76624e8 Mon Sep 17 00:00:00 2001 From: G Johansson Date: Mon, 12 Oct 2026 03:24:52 +0200 Subject: [PATCH] Split event subscriptions from async_added_to_hass in isy994 (#185867) Co-authored-by: Claude Opus 5.5 --- homeassistant/components/isy994/entity.py | 12 ++++++++++++ homeassistant/components/isy994/event.py | 4 ++-- homeassistant/components/isy994/sensor.py | 4 ++-- homeassistant/components/isy994/switch.py | 4 ++-- 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/homeassistant/components/isy994/entity.py b/homeassistant/components/isy994/entity.py index 407a57731564..16ca3aa97d38 100644 --- a/homeassistant/components/isy994/entity.py +++ b/homeassistant/components/isy994/entity.py @@ -53,6 +53,12 @@ class ISYEntity(Entity): @override async def async_added_to_hass(self) -> None: + """Subscribe to the node change events.""" + await super().async_added_to_hass() + self._async_subscribe_to_events() + + @callback + def _async_subscribe_to_events(self) -> None: """Subscribe to the node change events.""" self._change_handler = self._node.status_events.subscribe(self.async_on_update) self.async_on_remove(self._change_handler.unsubscribe) @@ -248,6 +254,12 @@ class ISYAuxControlEntity(Entity): @override async def async_added_to_hass(self) -> None: + """Subscribe to the node control change events.""" + await super().async_added_to_hass() + self._async_subscribe_to_events() + + @callback + def _async_subscribe_to_events(self) -> None: """Subscribe to the node control change events.""" self._change_handler = self._node.control_events.subscribe( self.async_on_update, diff --git a/homeassistant/components/isy994/event.py b/homeassistant/components/isy994/event.py index 7d363b150a1a..4e5bbdda4cb5 100644 --- a/homeassistant/components/isy994/event.py +++ b/homeassistant/components/isy994/event.py @@ -136,9 +136,9 @@ class ISYButtonEvent(ISYNodeEntity, EventEntity): # these and most users only automate a few. self._attr_entity_registry_enabled_default = False + @callback @override - # pylint: disable-next=home-assistant-missing-super-call - async def async_added_to_hass(self) -> None: + def _async_subscribe_to_events(self) -> None: """Subscribe to control events and node enabled/disabled changes only. Skipping the base class's status_events subscription avoids a state diff --git a/homeassistant/components/isy994/sensor.py b/homeassistant/components/isy994/sensor.py index df779572323f..4bd226197cf9 100644 --- a/homeassistant/components/isy994/sensor.py +++ b/homeassistant/components/isy994/sensor.py @@ -365,9 +365,9 @@ class ISYAuxSensorEntity(ISYSensorEntity): """Return the target value.""" return None if self.target is None else self.target.value + @callback @override - # pylint: disable-next=home-assistant-missing-super-call - async def async_added_to_hass(self) -> None: + def _async_subscribe_to_events(self) -> None: """Subscribe to the node control change events. Overloads the default ISYNodeEntity updater to only update when diff --git a/homeassistant/components/isy994/switch.py b/homeassistant/components/isy994/switch.py index 18ca8445cc02..563c87eb7c72 100644 --- a/homeassistant/components/isy994/switch.py +++ b/homeassistant/components/isy994/switch.py @@ -162,9 +162,9 @@ class ISYEnableSwitchEntity(ISYAuxControlEntity, SwitchEntity): self._attr_name = description.name # Override super self._change_handler: EventListener | None = None + @callback @override - # pylint: disable-next=home-assistant-missing-super-call - async def async_added_to_hass(self) -> None: + def _async_subscribe_to_events(self) -> None: """Subscribe to the node control change events.""" self._change_handler = self._node.isy.nodes.status_events.subscribe( self.async_on_update,