1
0
mirror of https://github.com/no2chem/wideq.git synced 2025-05-16 15:20:09 -07:00

Style fixes

This commit is contained in:
Adrian Sampson 2018-06-17 10:37:41 -04:00
parent 2dc1c331a6
commit 4cde35597a
2 changed files with 11 additions and 4 deletions

View File

@ -124,6 +124,7 @@ def ac_config(client, device_id):
print(ac.get_light()) print(ac.get_light())
print(ac.get_zones()) print(ac.get_zones())
EXAMPLE_COMMANDS = { EXAMPLE_COMMANDS = {
'ls': ls, 'ls': ls,
'mon': mon, 'mon': mon,

View File

@ -746,6 +746,7 @@ class ACMode(enum.Enum):
AROMA = "@AC_MAIN_OPERATION_MODE_AROMA_W" AROMA = "@AC_MAIN_OPERATION_MODE_AROMA_W"
ENERGY_SAVING = "@AC_MAIN_OPERATION_MODE_ENERGY_SAVING_W" ENERGY_SAVING = "@AC_MAIN_OPERATION_MODE_ENERGY_SAVING_W"
class ACFanSpeed(enum.Enum): class ACFanSpeed(enum.Enum):
"""The fan speed for an AC/HVAC device.""" """The fan speed for an AC/HVAC device."""
@ -759,6 +760,7 @@ class ACFanSpeed(enum.Enum):
POWER = '@AC_MAIN_WIND_STRENGTH_POWER_W' POWER = '@AC_MAIN_WIND_STRENGTH_POWER_W'
AUTO = '@AC_MAIN_WIND_STRENGTH_AUTO_W' AUTO = '@AC_MAIN_WIND_STRENGTH_AUTO_W'
class ACOp(enum.Enum): class ACOp(enum.Enum):
"""Whether a device is on or off.""" """Whether a device is on or off."""
@ -826,7 +828,9 @@ class ACDevice(Device):
isOpen is a 1/0 typed as string isOpen is a 1/0 typed as string
[{'No':zone_no, 'Cfg':enabled, 'State':isOpen},] [{'No':zone_no, 'Cfg':enabled, 'State':isOpen},]
""" """
#ensure at least 1 zone is enabled. Can't turn all zones off
# Ensure at least one zone is enabled: we can't turn all zones
# off simultaneously.
on_count = sum(int(zone['State']) for zone in zones) on_count = sum(int(zone['State']) for zone in zones)
if on_count > 0: if on_count > 0:
zone_cmd = '/'.join( zone_cmd = '/'.join(
@ -839,12 +843,14 @@ class ACDevice(Device):
"""Gets the status of the zones, including whether a zone is configured. """Gets the status of the zones, including whether a zone is configured.
Result is a list of dicts with the same format as set_zones() Result is a list of dicts with the same format as set_zones()
""" """
return self._get_config('DuctZone') return self._get_config('DuctZone')
def set_fan_speed(self, speed): def set_fan_speed(self, speed):
"""Sets the fan speed according to the WindStrength operation """Sets the fan speed according to the WindStrength operation
Speed arg is a value of the ACFanSpeed enum Speed arg is a value of the ACFanSpeed enum
""" """
speed_value = self.model.enum_value('WindStrength', speed.value) speed_value = self.model.enum_value('WindStrength', speed.value)
self._set_control('WindStrength', speed_value) self._set_control('WindStrength', speed_value)