From 765275fac89acd735f46ff6c2c3a250b43ec6529 Mon Sep 17 00:00:00 2001 From: ericcorleone Date: Thu, 11 Jul 2024 15:27:38 +0800 Subject: [PATCH] Fix bug where actions were not reset correctly --- custom_components/aqara_gateway/binary_sensor.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/custom_components/aqara_gateway/binary_sensor.py b/custom_components/aqara_gateway/binary_sensor.py index 04bb969..d3bd224 100755 --- a/custom_components/aqara_gateway/binary_sensor.py +++ b/custom_components/aqara_gateway/binary_sensor.py @@ -714,9 +714,15 @@ def update(self, data: dict = None): 'entity_id': self.entity_id, 'click_type': self._state }) - time.sleep(.1) + # time.sleep(.1) + + # self._state = '' - self._state = '' + # reset the state to empty after 0.1 second + self.hass.loop.call_later(.1, self.reset_state) self.schedule_update_ha_state() + def reset_state(self): + self._state = '' + self.async_write_ha_state()