From e13e92e4146f2f494ee2514c0b5d4bcb57e963a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5kan=20=C3=85kerberg?= Date: Wed, 25 Nov 2020 01:32:25 +0100 Subject: [PATCH] 0.2.1-b3 --- custom_components/shelly/__init__.py | 2 +- custom_components/shelly/block.py | 8 ++------ custom_components/shelly/device.py | 7 +------ custom_components/shelly/switch.py | 1 - 4 files changed, 4 insertions(+), 14 deletions(-) diff --git a/custom_components/shelly/__init__.py b/custom_components/shelly/__init__.py index dd5f44d..1cc2b2c 100755 --- a/custom_components/shelly/__init__.py +++ b/custom_components/shelly/__init__.py @@ -45,7 +45,7 @@ _LOGGER = logging.getLogger(__name__) -__version__ = "0.2.1-b2" +__version__ = "0.2.1-b3" VERSION = __version__ async def async_setup(hass, config): diff --git a/custom_components/shelly/block.py b/custom_components/shelly/block.py index 5c6cfc5..6a659f6 100644 --- a/custom_components/shelly/block.py +++ b/custom_components/shelly/block.py @@ -38,7 +38,6 @@ def __init__(self, block, instance, prefix=""): self.async_on_remove(self._remove_handler) self._master_unit = False self._settings = instance.get_settings(block.id) - self.last_ha_update = None def _remove_handler(self): self._is_removed = True @@ -57,11 +56,8 @@ def name(self): name += " [" + self._block.id + "]" return name - def _update_ha_state(self): - #snapshot = { "attr" : self.device_state_attributes, "state" : self.state, "available": self.available } - #if self.last_ha_update != snapshot: - self.schedule_update_ha_state() - #self.last_ha_update = snapshot + def _update_ha_state(self): + self.schedule_update_ha_state(True) def _updated(self, _block): """Receive events when the switch state changed (by mobile, diff --git a/custom_components/shelly/device.py b/custom_components/shelly/device.py index 4133a69..a0d5c75 100644 --- a/custom_components/shelly/device.py +++ b/custom_components/shelly/device.py @@ -47,13 +47,8 @@ def __init__(self, dev, instance): self._settings = instance.get_settings(dev.id, dev.block.id) - self.last_ha_update = None - def _update_ha_state(self): - #snapshot = { "attr" : self.device_state_attributes, "state" : self.state, "available": self.available } - #if self.last_ha_update != snapshot: - self.schedule_update_ha_state() - #self.last_ha_update = snapshot + self.schedule_update_ha_state(True) def _updated(self, _block): """Receive events when the switch state changed (by mobile, diff --git a/custom_components/shelly/switch.py b/custom_components/shelly/switch.py index ff9e473..75e1ff9 100755 --- a/custom_components/shelly/switch.py +++ b/custom_components/shelly/switch.py @@ -143,7 +143,6 @@ async def async_turn_off(self, **_kwargs): self._update_ha_state() def remove(self): - print("REMOVE*******************") if self._removing: return self._removing = True