tox fixes

This commit is contained in:
Tim
2021-12-22 19:45:16 +10:30
parent e1ac7deace
commit a25bf75a4d

View File

@@ -107,6 +107,7 @@ class LocaltuyaFan(LocalTuyaEntity, FanEntity):
async def async_turn_on( async def async_turn_on(
self, self,
speed: str = None,
percentage: int = None, percentage: int = None,
preset_mode: str = None, preset_mode: str = None,
**kwargs, **kwargs,
@@ -116,9 +117,12 @@ class LocaltuyaFan(LocalTuyaEntity, FanEntity):
await self._device.set_dp(True, self._dp_id) await self._device.set_dp(True, self._dp_id)
if percentage is not None: if percentage is not None:
await self.async_set_percentage(percentage) await self.async_set_percentage(percentage)
elif preset_mode is not None:
_LOGGER.debug("Preset_mode not supported yet")
else: else:
self.schedule_update_ha_state() self.schedule_update_ha_state()
async def async_turn_off(self, **kwargs) -> None: async def async_turn_off(self, **kwargs) -> None:
"""Turn off the entity.""" """Turn off the entity."""
_LOGGER.debug("Fan async_turn_off") _LOGGER.debug("Fan async_turn_off")
@@ -133,7 +137,7 @@ class LocaltuyaFan(LocalTuyaEntity, FanEntity):
if percentage is not None: if percentage is not None:
if percentage == 0: if percentage == 0:
return await self.async_turn_off() return await self.async_turn_off()
elif not self.is_on: if not self.is_on:
await self.async_turn_on() await self.async_turn_on()
if self._use_ordered_list: if self._use_ordered_list:
await self._device.set_dp( await self._device.set_dp(