diff --git a/homeassistant/components/light/mystrom.py b/homeassistant/components/light/mystrom.py index 8d7fb807c6d..9abd96664f2 100644 --- a/homeassistant/components/light/mystrom.py +++ b/homeassistant/components/light/mystrom.py @@ -13,9 +13,9 @@ from homeassistant.components.light import ( Light, PLATFORM_SCHEMA, ATTR_BRIGHTNESS, SUPPORT_BRIGHTNESS, SUPPORT_EFFECT, ATTR_EFFECT, SUPPORT_FLASH, SUPPORT_COLOR, ATTR_HS_COLOR) -from homeassistant.const import CONF_HOST, CONF_MAC, CONF_NAME, STATE_UNKNOWN +from homeassistant.const import CONF_HOST, CONF_MAC, CONF_NAME -REQUIREMENTS = ['python-mystrom==0.4.2'] +REQUIREMENTS = ['python-mystrom==0.4.4'] _LOGGER = logging.getLogger(__name__) @@ -54,9 +54,9 @@ def setup_platform(hass, config, add_devices, discovery_info=None): try: if bulb.get_status()['type'] != 'rgblamp': _LOGGER.error("Device %s (%s) is not a myStrom bulb", host, mac) - return False + return except MyStromConnectionError: - _LOGGER.warning("myStrom bulb not online") + _LOGGER.warning("No route to device: %s", host) add_devices([MyStromLight(bulb, name)], True) @@ -107,7 +107,7 @@ class MyStromLight(Light): @property def is_on(self): """Return true if light is on.""" - return self._state['on'] if self._state is not None else STATE_UNKNOWN + return self._state['on'] if self._state is not None else None def turn_on(self, **kwargs): """Turn on the light.""" @@ -136,7 +136,7 @@ class MyStromLight(Light): if effect == EFFECT_RAINBOW: self._bulb.set_rainbow(30) except MyStromConnectionError: - _LOGGER.warning("myStrom bulb not online") + _LOGGER.warning("No route to device") def turn_off(self, **kwargs): """Turn off the bulb.""" @@ -163,5 +163,5 @@ class MyStromLight(Light): self._available = True except MyStromConnectionError: - _LOGGER.warning("myStrom bulb not online") + _LOGGER.warning("No route to device") self._available = False diff --git a/homeassistant/components/switch/mystrom.py b/homeassistant/components/switch/mystrom.py index 0a87d41d2fe..85fc546d00e 100644 --- a/homeassistant/components/switch/mystrom.py +++ b/homeassistant/components/switch/mystrom.py @@ -12,7 +12,7 @@ from homeassistant.components.switch import (SwitchDevice, PLATFORM_SCHEMA) from homeassistant.const import (CONF_NAME, CONF_HOST) import homeassistant.helpers.config_validation as cv -REQUIREMENTS = ['python-mystrom==0.4.2'] +REQUIREMENTS = ['python-mystrom==0.4.4'] DEFAULT_NAME = 'myStrom Switch' @@ -34,8 +34,8 @@ def setup_platform(hass, config, add_devices, discovery_info=None): try: MyStromPlug(host).get_status() except exceptions.MyStromConnectionError: - _LOGGER.error("No route to device '%s'", host) - return False + _LOGGER.error("No route to device: %s", host) + return add_devices([MyStromSwitch(name, host)]) @@ -74,8 +74,7 @@ class MyStromSwitch(SwitchDevice): try: self.plug.set_relay_on() except exceptions.MyStromConnectionError: - _LOGGER.error("No route to device '%s'. Is device offline?", - self._resource) + _LOGGER.error("No route to device: %s", self._resource) def turn_off(self, **kwargs): """Turn the switch off.""" @@ -83,8 +82,7 @@ class MyStromSwitch(SwitchDevice): try: self.plug.set_relay_off() except exceptions.MyStromConnectionError: - _LOGGER.error("No route to device '%s'. Is device offline?", - self._resource) + _LOGGER.error("No route to device: %s", self._resource) def update(self): """Get the latest data from the device and update the data.""" @@ -93,5 +91,4 @@ class MyStromSwitch(SwitchDevice): self.data = self.plug.get_status() except exceptions.MyStromConnectionError: self.data = {'power': 0, 'relay': False} - _LOGGER.error("No route to device '%s'. Is device offline?", - self._resource) + _LOGGER.error("No route to device: %s", self._resource) diff --git a/requirements_all.txt b/requirements_all.txt index 17eb8455377..7e91ccc59d3 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -1045,7 +1045,7 @@ python-mpd2==1.0.0 # homeassistant.components.light.mystrom # homeassistant.components.switch.mystrom -python-mystrom==0.4.2 +python-mystrom==0.4.4 # homeassistant.components.nest python-nest==4.0.1