From 1765ba2346ca024b42c663b08b64b02452ea39e6 Mon Sep 17 00:00:00 2001 From: Alberto Geniola Date: Mon, 1 Jul 2019 20:03:27 +0200 Subject: [PATCH] -Fixed bad door status being detected at MSG100 bootstrap --- custom_components/meross_cloud/cover.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/custom_components/meross_cloud/cover.py b/custom_components/meross_cloud/cover.py index 44ba99784b..bb7615a3a7 100644 --- a/custom_components/meross_cloud/cover.py +++ b/custom_components/meross_cloud/cover.py @@ -20,6 +20,14 @@ def __init__(self, device: GenericGarageDoorOpener, channel: int): self._device_name = "%s (channel: %d)" % (self._device.name, self._channel) device.register_event_callback(self.handler) + # If the device is online, we need to update its status from STATE_UNKNOWN + if device.online and self._state == STATE_UNKNOWN: + open = device.get_status().get(self._channel) + if open: + self._state = STATE_OPEN + else: + self._state = STATE_CLOSED + def handler(self, evt) -> None: if evt.channel == self._channel: # The underlying library only exposes "open" and "closed" statuses