Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _hold_quarter_hours(deadline):
if deadline.minute not in (0, 15, 30, 45):
raise SomeComfortError('Invalid time: must be on a 15-minute boundary')
return int(((deadline.hour * 60) + deadline.minute) / 15)
'Status%s' % which: HOLD_TYPES.index('permanent'),
'%sNextPeriod' % which: 0,
}
elif hold is False:
settings = {
'Status%s' % which: HOLD_TYPES.index('schedule'),
'%sNextPeriod' % which: 0,
}
elif isinstance(hold, datetime.time):
qh = _hold_quarter_hours(hold)
settings = {
'Status%s' % which: HOLD_TYPES.index('temporary'),
'%sNextPeriod' % which: qh,
}
else:
raise SomeComfortError(
'Hold should be True, False, or datetime.time')
self._client._set_thermostat_settings(self.deviceid, settings)
self._data['uiData'].update(settings)
EQUIPMENT_OUTPUT_STATUS = ['off/fan', 'heat', 'cool']
class SomeComfortError(Exception):
pass
class ConnectionTimeout(SomeComfortError):
pass
class ConnectionError(SomeComfortError):
pass
class AuthError(SomeComfortError):
pass
class APIError(SomeComfortError):
pass
class APIRateLimited(APIError):
def __init__(self):
super(APIRateLimited, self).__init__(
'You are being rate-limited. Try waiting a bit.')
class SessionTimedOut(SomeComfortError):
pass
pass
class ConnectionTimeout(SomeComfortError):
pass
class ConnectionError(SomeComfortError):
pass
class AuthError(SomeComfortError):
pass
class APIError(SomeComfortError):
pass
class APIRateLimited(APIError):
def __init__(self):
super(APIRateLimited, self).__init__(
'You are being rate-limited. Try waiting a bit.')
class SessionTimedOut(SomeComfortError):
pass
def _convert_errors(fn):
def wrapper(*args, **kwargs):
try:
import requests
import time
_LOG = logging.getLogger('somecomfort')
FAN_MODES = ['auto', 'on', 'circulate', 'follow schedule']
SYSTEM_MODES = ['emheat', 'heat', 'off', 'cool', 'auto', 'auto']
HOLD_TYPES = ['schedule', 'temporary', 'permanent']
EQUIPMENT_OUTPUT_STATUS = ['off/fan', 'heat', 'cool']
class SomeComfortError(Exception):
pass
class ConnectionTimeout(SomeComfortError):
pass
class ConnectionError(SomeComfortError):
pass
class AuthError(SomeComfortError):
pass
class APIError(SomeComfortError):
pass
class APIRateLimited(APIError):
_LOG = logging.getLogger('somecomfort')
FAN_MODES = ['auto', 'on', 'circulate', 'follow schedule']
SYSTEM_MODES = ['emheat', 'heat', 'off', 'cool', 'auto', 'auto']
HOLD_TYPES = ['schedule', 'temporary', 'permanent']
EQUIPMENT_OUTPUT_STATUS = ['off/fan', 'heat', 'cool']
class SomeComfortError(Exception):
pass
class ConnectionTimeout(SomeComfortError):
pass
class ConnectionError(SomeComfortError):
pass
class AuthError(SomeComfortError):
pass
class APIError(SomeComfortError):
pass
class APIRateLimited(APIError):
def __init__(self):
super(APIRateLimited, self).__init__(
'You are being rate-limited. Try waiting a bit.')