From 5fc7df2746aaee683e8e247597ff95fd46b03eb2 Mon Sep 17 00:00:00 2001 From: Shay Levy Date: Mon, 7 Dec 2020 10:27:33 +0200 Subject: [PATCH] Prevent firing Shelly input events at startup (#43986) Co-authored-by: Paulus Schoutsen --- homeassistant/components/shelly/__init__.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/shelly/__init__.py b/homeassistant/components/shelly/__init__.py index 3c34da574a6..298c7e111b2 100644 --- a/homeassistant/components/shelly/__init__.py +++ b/homeassistant/components/shelly/__init__.py @@ -158,7 +158,11 @@ class ShellyDeviceWrapper(update_coordinator.DataUpdateCoordinator): last_event_count = self._last_input_events_count.get(channel) self._last_input_events_count[channel] = block.inputEventCnt - if last_event_count == block.inputEventCnt or event_type == "": + if ( + last_event_count is None + or last_event_count == block.inputEventCnt + or event_type == "" + ): continue if event_type in INPUTS_EVENTS_DICT: