From b4b0332d79cfd6f397bf74c528c5826f6383d37e Mon Sep 17 00:00:00 2001 From: Dmitry Mamontov Date: Mon, 7 Feb 2022 18:26:18 +0300 Subject: [PATCH] Fix high load --- custom_components/systemd_manager/manifest.json | 2 +- custom_components/systemd_manager/switch.py | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/custom_components/systemd_manager/manifest.json b/custom_components/systemd_manager/manifest.json index a792db1..80d2748 100644 --- a/custom_components/systemd_manager/manifest.json +++ b/custom_components/systemd_manager/manifest.json @@ -1,7 +1,7 @@ { "domain": "systemd_manager", "name": "Systemd Manager", - "version": "1.0.0", + "version": "1.1.0", "documentation": "https://github.com/dmamontov/hass-systemd-manager", "issue_tracker": "https://github.com/dmamontov/hass-systemd-manager/issues", "config_flow": true, diff --git a/custom_components/systemd_manager/switch.py b/custom_components/systemd_manager/switch.py index bcc106b..c62d8ed 100644 --- a/custom_components/systemd_manager/switch.py +++ b/custom_components/systemd_manager/switch.py @@ -89,7 +89,12 @@ async def async_added_to_hass(self) -> None: @callback def _schedule_immediate_update(self) -> None: - self.async_schedule_update_ha_state(True) + if ( + self._is_available != self.service.is_available + or self._is_on != self.service.is_on + or self._extra != self.service.extra + ): + self.async_schedule_update_ha_state(True) async def will_remove_from_hass(self) -> None: if self.unsub_update: