Skip to content

Commit

Permalink
Merge pull request #36 from kk7ds/add_aux_heat_support
Browse files Browse the repository at this point in the history
Add aux heat support
  • Loading branch information
schreyack committed Sep 30, 2021
2 parents 5ad2af1 + 11d06c2 commit 48d9c60
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions somecomfort/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,16 @@ def system_mode(self, mode):
mode_index = SYSTEM_MODES.index(mode)
except ValueError:
raise SomeComfortError('Invalid system mode `%s`' % mode)

key = 'Switch%sAllowed' % mode.title()
if not self._data['uiData'][key]:
raise SomeComfortError('Device does not support %s' % mode)
if mode == 'emheat':
key = 'SwitchEmergencyHeatAllowed'
else:
key = 'Switch%sAllowed' % mode.title()
try:
if not self._data['uiData'][key]:
raise SomeComfortError('Device does not support %s' % mode)
except KeyError:
raise APIError(
'Unknown Key: %s' % key)
self._client._set_thermostat_settings(
self.deviceid, {'SystemSwitch': mode_index})
self._data['uiData']['SystemSwitchPosition'] = mode_index
Expand Down

0 comments on commit 48d9c60

Please sign in to comment.