diff --git a/README.md b/README.md index e14895e..fede1cd 100644 --- a/README.md +++ b/README.md @@ -81,7 +81,7 @@ The integration will create the following entities for each discovered SMARWI de | Name | Platform | Category | Description | ------------------- | ------------- | ---------- | --------------------------------------------------------------------------| | cover | cover | | Control the window tilt position (open, close, stop, set position). | -| ridge_fix | switch | | Fix or release the ridge (can be used only if the motor is currently not |moving). +| ridge_fix | switch | | Fix or release the ridge. | | ridge_inside | binary_sensor | diagnostic | Shows if the ridge is inside the device (i.e. it’s operational). | | rssi | sensor | diagnostic | Monitor WiFi signal strength (disabled by default). | | calibrated_distance | number | config | Set calibrated distance (finetune setting, disabled by default). | diff --git a/custom_components/smarwi/device.py b/custom_components/smarwi/device.py index e545f2f..8c2b9bc 100644 --- a/custom_components/smarwi/device.py +++ b/custom_components/smarwi/device.py @@ -248,15 +248,12 @@ async def async_stop(self) -> None: async def async_toggle_ridge_fixed(self, state: bool) -> None: """Fix (True) or release (False) the ridge.""" - if state: - if not self.ridge_fixed: - LOGGER.info(f"[{self.name}] Fixing ridge") - await self._async_mqtt_command("stop") - else: - # If the motor is moving, "stop" stops it. - if self.ridge_fixed and self.state_code.is_idle(): - LOGGER.info(f"[{self.name}] Releasing ridge") - await self._async_mqtt_command("stop") + if state and not self.ridge_fixed: + LOGGER.info(f"[{self.name}] Fixing ridge") + await self._async_mqtt_command("stop") + elif not state and self.ridge_fixed: + LOGGER.info(f"[{self.name}] Releasing ridge") + await self._async_mqtt_command("stop") async def async_init(self) -> None: """Connect to the device."""