How to use the somecomfort.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 home-assistant / home-assistant / tests / components / honeywell / test_climate.py View on Github external
def test_setup_us_failures(self, mock_sc):
        """Test the US setup."""
        hass = mock.MagicMock()
        add_entities = mock.MagicMock()
        config = {
            CONF_USERNAME: "user",
            CONF_PASSWORD: "pass",
            honeywell.CONF_REGION: "us",
        }

        mock_sc.side_effect = somecomfort.AuthError
        result = honeywell.setup_platform(hass, config, add_entities)
        assert not result
        assert not add_entities.called

        mock_sc.side_effect = somecomfort.SomeComfortError
        result = honeywell.setup_platform(hass, config, add_entities)
        assert not result
        assert not add_entities.called
github home-assistant / home-assistant / tests / components / honeywell / test_climate.py View on Github external
def test_set_temp_fail(self):
        """Test if setting the temperature fails."""
        self.device.setpoint_heat = mock.MagicMock(
            side_effect=somecomfort.SomeComfortError
        )
        self.honeywell.set_temperature(temperature=123)
github home-assistant / home-assistant / tests / components / thermostat / test_honeywell.py View on Github external
def test_setup_us_failures(self, mock_sc):
        """Test the US setup."""
        hass = mock.MagicMock()
        add_devices = mock.MagicMock()
        config = {
            CONF_USERNAME: 'user',
            CONF_PASSWORD: 'pass',
            'region': 'us',
        }

        mock_sc.side_effect = somecomfort.AuthError
        result = honeywell.setup_platform(hass, config, add_devices)
        self.assertFalse(result)
        self.assertFalse(add_devices.called)

        mock_sc.side_effect = somecomfort.SomeComfortError
        result = honeywell.setup_platform(hass, config, add_devices)
        self.assertFalse(result)
        self.assertFalse(add_devices.called)
github home-assistant / home-assistant / tests / components / thermostat / test_honeywell.py View on Github external
def test_set_temp_fail(self):
        """Test if setting the temperature fails."""
        self.device.setpoint_heat = mock.MagicMock(
            side_effect=somecomfort.SomeComfortError)
        self.honeywell.set_temperature(123)
github Haynie-Research-and-Development / jarvis / deps / lib / python3.4 / site-packages / somecomfort / __main__.py View on Github external
if not device:
        print('Device not found')
        return 1

    if any([args.hold_until, args.cancel_hold, args.permanent_hold,
            args.get_hold]):
        cont = do_holds(client, args, device)
        if not cont:
            return

    try:
        return get_or_set_things(
            client, args, device,
            number_things + string_things,
            number_things + string_things + readonly_things)
    except somecomfort.SomeComfortError as ex:
        print('%s: %s' % (ex.__class__.__name__, str(ex)))
github home-assistant / home-assistant / homeassistant / components / honeywell / climate.py View on Github external
def _turn_away_mode_on(self) -> None:
        """Turn away on.

        Somecomfort does have a proprietary away mode, but it doesn't really
        work the way it should. For example: If you set a temperature manually
        it doesn't get overwritten when away mode is switched on.
        """
        self._away = True
        try:
            # Get current mode
            mode = self._device.system_mode
        except somecomfort.SomeComfortError:
            _LOGGER.error("Can not get system mode")
            return
        try:

            # Set permanent hold
            setattr(self._device, f"hold_{mode}", True)
            # Set temperature
            setattr(
                self._device, f"setpoint_{mode}", getattr(self, f"_{mode}_away_temp")
            )
        except somecomfort.SomeComfortError:
            _LOGGER.error(
                "Temperature %.1f out of range", getattr(self, f"_{mode}_away_temp")
            )
github kk7ds / somecomfort / somecomfort / __main__.py View on Github external
if not device:
        print('Device not found')
        return 1

    if any([args.hold_until, args.cancel_hold, args.permanent_hold,
            args.get_hold]):
        cont = do_holds(client, args, device)
        if not cont:
            return

    try:
        return get_or_set_things(
            client, args, device,
            number_things + string_things,
            number_things + string_things + readonly_things)
    except somecomfort.SomeComfortError as ex:
        print('%s: %s' % (ex.__class__.__name__, str(ex)))
github home-assistant / home-assistant / homeassistant / components / thermostat / honeywell.py View on Github external
def set_temperature(self, temperature):
        """Set target temperature."""
        import somecomfort
        try:
            if self._device.system_mode == 'cool':
                self._device.setpoint_cool = temperature
            else:
                self._device.setpoint_heat = temperature
        except somecomfort.SomeComfortError:
            _LOGGER.error('Temperature %.1f out of range', temperature)