How to use the somecomfort.client 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 Haynie-Research-and-Development / jarvis / deps / lib / python3.4 / site-packages / somecomfort / __main__.py View on Github external
device.hold_heat = False
        device.hold_cool = False
    elif args.permanent_hold:
        device.hold_heat = True
        device.hold_cool = True
    elif args.hold_until:
        try:
            holdtime = datetime.datetime.strptime(args.hold_until,
                                                  '%H:%M')
        except ValueError:
            print('Invalid time (use HH:MM)')
            return False
        try:
            device.hold_heat = holdtime.time()
            device.hold_cool = holdtime.time()
        except somecomfort.client.SomeComfortError as ex:
            print('Failed to set hold: %s' % str(ex))
            return False
    elif args.get_hold:
        modes = {}
        for mode in ['cool', 'heat']:
            hold = getattr(device, 'hold_%s' % mode)
            if hold is True:
                modes[mode] = 'permanent'
            elif hold is False:
                modes[mode] = 'schedule'
            else:
                modes[mode] = str(hold)
        print('heat:%s cool:%s' % (modes['heat'], modes['cool']))
        return False
    return True
github home-assistant / home-assistant / homeassistant / components / honeywell / climate.py View on Github external
def update(self) -> None:
        """Update the state."""
        retries = 3
        while retries > 0:
            try:
                self._device.refresh()
                break
            except (
                somecomfort.client.APIRateLimited,
                OSError,
                requests.exceptions.ReadTimeout,
            ) as exp:
                retries -= 1
                if retries == 0:
                    raise exp
                if not self._retry():
                    raise exp
                _LOGGER.error("SomeComfort update failed, Retrying - Error: %s", exp)

        _LOGGER.debug(
            "latestData = %s ", self._device._data  # pylint: disable=protected-access
        )
github kk7ds / somecomfort / somecomfort / __main__.py View on Github external
device.hold_heat = False
        device.hold_cool = False
    elif args.permanent_hold:
        device.hold_heat = True
        device.hold_cool = True
    elif args.hold_until:
        try:
            holdtime = datetime.datetime.strptime(args.hold_until,
                                                  '%H:%M')
        except ValueError:
            print('Invalid time (use HH:MM)')
            return False
        try:
            device.hold_heat = holdtime.time()
            device.hold_cool = holdtime.time()
        except somecomfort.client.SomeComfortError as ex:
            print('Failed to set hold: %s' % str(ex))
            return False
    elif args.get_hold:
        modes = {}
        for mode in ['cool', 'heat']:
            hold = getattr(device, 'hold_%s' % mode)
            if hold is True:
                modes[mode] = 'permanent'
            elif hold is False:
                modes[mode] = 'schedule'
            else:
                modes[mode] = str(hold)
        print('heat:%s cool:%s' % (modes['heat'], modes['cool']))
        return False
    return True