How to use the somecomfort.client.SomeComfortError function in somecomfort

To help you get started, we’ve selected a few somecomfort examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github kk7ds / somecomfort / somecomfort / client.py View on Github external
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)
github kk7ds / somecomfort / somecomfort / client.py View on Github external
'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)
github kk7ds / somecomfort / somecomfort / client.py View on Github external
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
github kk7ds / somecomfort / somecomfort / client.py View on Github external
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:
github kk7ds / somecomfort / somecomfort / client.py View on Github external
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):
github kk7ds / somecomfort / somecomfort / client.py View on Github external
_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.')