fix formatting errors

This commit is contained in:
Tim
2021-11-11 11:12:43 +10:30
parent c99a93bd6c
commit 9bf9b9f55d
2 changed files with 26 additions and 19 deletions

5
.vscode/settings.json vendored Normal file
View File

@@ -0,0 +1,5 @@
{
"files.associations": {
"*.yaml": "home-assistant"
}
}

View File

@@ -77,13 +77,13 @@ class LocaltuyaFan(LocalTuyaEntity, FanEntity):
if (type(self._ordered_list) is list and len(self._ordered_list) > 1): if (type(self._ordered_list) is list and len(self._ordered_list) > 1):
self._use_ordered_list = True self._use_ordered_list = True
_LOGGER.debug("Fan _use_ordered_list: %s > %s", self._use_ordered_list, self._ordered_list) _LOGGER.debug("Fan _use_ordered_list: %s > %s",
self._use_ordered_list, self._ordered_list)
else: else:
self._use_ordered_list = False self._use_ordered_list = False
_LOGGER.debug("Fan _use_ordered_list: %s", self._use_ordered_list) _LOGGER.debug("Fan _use_ordered_list: %s", self._use_ordered_list)
@property @property
def oscillating(self): def oscillating(self):
"""Return current oscillating status.""" """Return current oscillating status."""
@@ -125,7 +125,6 @@ class LocaltuyaFan(LocalTuyaEntity, FanEntity):
_LOGGER.debug("Fan async_set_percentage: %s", percentage) _LOGGER.debug("Fan async_set_percentage: %s", percentage)
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()
@@ -138,7 +137,8 @@ class LocaltuyaFan(LocalTuyaEntity, FanEntity):
), ),
self._config.get(CONF_FAN_SPEED_CONTROL) self._config.get(CONF_FAN_SPEED_CONTROL)
) )
_LOGGER.debug("Fan async_set_percentage: %s > %s", percentage, percentage_to_ordered_list_item(self._ordered_list, percentage)) _LOGGER.debug("Fan async_set_percentage: %s > %s",
percentage, percentage_to_ordered_list_item(self._ordered_list, percentage))
else: else:
await self._device.set_dp( await self._device.set_dp(
@@ -147,10 +147,10 @@ class LocaltuyaFan(LocalTuyaEntity, FanEntity):
)), )),
self._config.get(CONF_FAN_SPEED_CONTROL) self._config.get(CONF_FAN_SPEED_CONTROL)
) )
_LOGGER.debug("Fan async_set_percentage: %s > %s", percentage, percentage_to_ranged_value(self._speed_range, percentage)) _LOGGER.debug("Fan async_set_percentage: %s > %s",
percentage, percentage_to_ranged_value(self._speed_range, percentage))
self.schedule_update_ha_state() self.schedule_update_ha_state()
async def async_oscillate(self, oscillating: bool) -> None: async def async_oscillate(self, oscillating: bool) -> None:
"""Set oscillation.""" """Set oscillation."""
_LOGGER.debug("Fan async_oscillate: %s", oscillating) _LOGGER.debug("Fan async_oscillate: %s", oscillating)
@@ -197,7 +197,6 @@ class LocaltuyaFan(LocalTuyaEntity, FanEntity):
_LOGGER.debug("Fan speed_count: %s", speed_count) _LOGGER.debug("Fan speed_count: %s", speed_count)
return speed_count return speed_count
def status_updated(self): def status_updated(self):
"""Get state of Tuya fan.""" """Get state of Tuya fan."""
@@ -205,12 +204,17 @@ class LocaltuyaFan(LocalTuyaEntity, FanEntity):
current_speed = self.dps_conf(CONF_FAN_SPEED_CONTROL) current_speed = self.dps_conf(CONF_FAN_SPEED_CONTROL)
if self._use_ordered_list: if self._use_ordered_list:
_LOGGER.debug("Fan current_speed ordered_list_item_to_percentage: %s from %s", current_speed, self._ordered_list) _LOGGER.debug(
"Fan current_speed ordered_list_item_to_percentage: %s from %s",
current_speed, self._ordered_list
)
if current_speed is not None: if current_speed is not None:
self._percentage = ordered_list_item_to_percentage(self._ordered_list, current_speed) self._percentage = ordered_list_item_to_percentage(
self._ordered_list, current_speed)
else: else:
_LOGGER.debug("Fan current_speed ranged_value_to_percentage: %s from %s", current_speed, self._speed_range) _LOGGER.debug("Fan current_speed ranged_value_to_percentage: %s from %s",
current_speed, self._speed_range)
if current_speed is not None: if current_speed is not None:
self._percentage = ranged_value_to_percentage(self._speed_range, int(current_speed)) self._percentage = ranged_value_to_percentage(self._speed_range, int(current_speed))
@@ -220,7 +224,6 @@ class LocaltuyaFan(LocalTuyaEntity, FanEntity):
self._oscillating = self.dps_conf(CONF_FAN_OSCILLATING_CONTROL) self._oscillating = self.dps_conf(CONF_FAN_OSCILLATING_CONTROL)
_LOGGER.debug("Fan current_oscillating : %s", self._oscillating) _LOGGER.debug("Fan current_oscillating : %s", self._oscillating)
if self.has_config(CONF_FAN_DIRECTION): if self.has_config(CONF_FAN_DIRECTION):
value = self.dps_conf(CONF_FAN_DIRECTION) value = self.dps_conf(CONF_FAN_DIRECTION)
if value is not None: if value is not None:
@@ -231,5 +234,4 @@ class LocaltuyaFan(LocalTuyaEntity, FanEntity):
self._direction = DIRECTION_REVERSE self._direction = DIRECTION_REVERSE
_LOGGER.debug("Fan current_direction : %s > %s", value, self._direction) _LOGGER.debug("Fan current_direction : %s > %s", value, self._direction)
async_setup_entry = partial(async_setup_entry, DOMAIN, LocaltuyaFan, flow_schema) async_setup_entry = partial(async_setup_entry, DOMAIN, LocaltuyaFan, flow_schema)