From 4f0a7cc9e937b5fff60fa001556d6039ee58d1b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johan=20Nenz=C3=A9n?= Date: Fri, 6 Oct 2023 17:09:30 +0200 Subject: [PATCH 1/2] Handle ready event --- pyflichub/client.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pyflichub/client.py b/pyflichub/client.py index 7479dd9..71093a2 100644 --- a/pyflichub/client.py +++ b/pyflichub/client.py @@ -163,10 +163,18 @@ def _handle_command(self, cmd: Command): def _handle_event(self, event: Event): button = None - if event.event == 'button': + if event.event == 'button' or event.event == 'buttonConnected': button = self._get_button(event.button) _LOGGER.debug(f"Button {button.name} was {event.action}") + if event.event == 'buttonConnected': + button = self._get_button(event.button) + _LOGGER.debug(f"Button {button.name} is connected") + + if event.event == 'buttonReady': + button = self._get_button(event.button) + _LOGGER.debug(f"Button {button.name} is ready") + if self._event_callback is not None and button is not None: self._event_callback(button, event) From dfc48523a100cccc5b86c5196db376d7fcec0bca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johan=20Nenz=C3=A9n?= Date: Fri, 6 Oct 2023 17:24:49 +0200 Subject: [PATCH 2/2] Fix --- pyflichub/client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyflichub/client.py b/pyflichub/client.py index 71093a2..0b6f881 100644 --- a/pyflichub/client.py +++ b/pyflichub/client.py @@ -163,7 +163,7 @@ def _handle_command(self, cmd: Command): def _handle_event(self, event: Event): button = None - if event.event == 'button' or event.event == 'buttonConnected': + if event.event == 'button': button = self._get_button(event.button) _LOGGER.debug(f"Button {button.name} was {event.action}")