Upgrade python-mystrom to 0.4.4 (#14889)

This commit is contained in:
Fabian Affolter 2018-06-10 11:38:23 +02:00 committed by GitHub
parent ce0ca7ff90
commit 703b4354e0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 17 deletions

View File

@ -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

View File

@ -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)

View File

@ -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