diff --git a/meross_iot/controller/mixins/roller_shutter.py b/meross_iot/controller/mixins/roller_shutter.py index 5201357..f9cbc1e 100644 --- a/meross_iot/controller/mixins/roller_shutter.py +++ b/meross_iot/controller/mixins/roller_shutter.py @@ -112,6 +112,7 @@ async def async_update(self, timeout: Optional[float] = None, *args, **kwargs) - await super().async_update(*args, **kwargs) # Update the configuration at the same time await self.async_fetch_config() + await self.async_fetch_position() async def async_fetch_config(self, timeout: Optional[float] = None, *args, **kwargs) -> None: data = await self._execute_command(method="GET", @@ -124,6 +125,16 @@ async def async_fetch_config(self, timeout: Optional[float] = None, *args, **kwa channel_config = d.copy() self._shutter__config_by_channel[channel] = channel_config + async def async_fetch_position(self, timeout: Optional[float] = None, *args, **kwargs) -> None: + data = await self._execute_command(method="GET", + namespace=Namespace.ROLLER_SHUTTER_POSITION, + payload={}, + timeout=timeout) + positions = data.get('position') + for p in positions: + channel = p['channel'] + self._shutter__position_by_channel[channel] = p["position"] + def get_open_timer_duration_millis(self, channel: int = 0, *args, **kwargs) -> int: self.check_full_update_done() return self._shutter__config_by_channel.get(channel).get("signalOpen")