Skip to content

Commit

Permalink
no mode will be used if power is off
Browse files Browse the repository at this point in the history
  • Loading branch information
simonepsp committed Nov 6, 2022
1 parent a2c9ea0 commit 4a56a65
Showing 1 changed file with 46 additions and 46 deletions.
92 changes: 46 additions & 46 deletions PyTado/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,71 +356,71 @@ def setZoneOverlay(self, zone, overlayMode, setTemp=None, duration=None, deviceT
"termination": {"typeSkillBasedApp": overlayMode},
}

# Check if zone exists and if it requires V2/V3 ac set of commands
capabilities = self.getCapabilities(zone=zone)
if power == "ON" and mode:
# Check if zone exists and if it requires V2/V3 ac set of commands
capabilities = self.getCapabilities(zone=zone)

if not capabilities:
raise Exception('Could\'t fetch zone details')

if not capabilities:
raise Exception('Could\'t fetch zone details')
if mode not in capabilities:
raise Exception('Unsupported mode for this zone')

if mode not in capabilities:
raise Exception('Unsupported mode for this zone')
mode_capabilities = capabilities[mode]

mode_capabilities = capabilities[mode]
# FanSpeed / FanLevel
if 'fanSpeeds' in mode_capabilities:

# FanSpeed / FanLevel
if 'fanSpeeds' in mode_capabilities:
# If fanLevel hasn't been provided, the one provided by Tado will be used
if fanLevel is None:
fanLevel = 'AUTO'

# If fanLevel hasn't been provided, the one provided by Tado will be used
if fanLevel is None:
fanLevel = 'AUTO'
post_data["setting"]["fanSpeed"] = fanLevel

post_data["setting"]["fanSpeed"] = fanLevel
# TODO is Swing is only allowed in fanSpeed?
if mode == 'FAN':
if swing is None:
swing = "ON"

# TODO is Swing is only allowed in fanSpeed?
if mode == 'FAN':
if swing is None:
swing = "ON"
post_data["setting"]["swing"] = swing

post_data["setting"]["swing"] = swing
elif 'fanLevel' in mode_capabilities:
# If fanLevel hasn't been provided, the one provided by Tado will be used
if fanLevel is None:
fanLevel = 'AUTO'

elif 'fanLevel' in mode_capabilities:
# If fanLevel hasn't been provided, the one provided by Tado will be used
if fanLevel is None:
fanLevel = 'AUTO'
post_data["setting"]["fanLevel"] = fanLevel

post_data["setting"]["fanLevel"] = fanLevel
# Vertical Swing
if 'verticalSwing' in mode_capabilities:
if verticalSwing is None:
verticalSwing = 'ON'

# Vertical Swing
if 'verticalSwing' in mode_capabilities:
if verticalSwing is None:
verticalSwing = 'ON'
post_data["setting"]["verticalSwing"] = verticalSwing

post_data["setting"]["verticalSwing"] = verticalSwing
# Horizontal Swing
if 'horizontalSwing' in mode_capabilities:
if horizontalSwing is None:
horizontalSwing = 'ON'

# Horizontal Swing
if 'horizontalSwing' in mode_capabilities:
if horizontalSwing is None:
horizontalSwing = 'ON'
post_data["setting"]["horizontalSwing"] = horizontalSwing

post_data["setting"]["horizontalSwing"] = horizontalSwing
# Light
if 'light' in mode_capabilities:
if light is None:
light = 'OFF'

# Light
if 'light' in mode_capabilities:
if light is None:
light = 'OFF'
post_data["setting"]["light"] = light

post_data["setting"]["light"] = light
if setTemp is not None:
post_data["setting"]["temperature"] = {"celsius": setTemp}

if setTemp is not None:
post_data["setting"]["temperature"] = {"celsius": setTemp}
if mode is not None:
post_data["setting"]["mode"] = mode

if mode is not None:
post_data["setting"]["mode"] = mode
if duration is not None:
post_data["termination"]["durationInSeconds"] = duration

if duration is not None:
post_data["termination"]["durationInSeconds"] = duration

print(post_data)
data = self._apiCall(cmd, "PUT", post_data)

_LOGGER.error(data)
Expand Down

0 comments on commit 4a56a65

Please sign in to comment.