mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 04:07:08 +00:00
Upgrade python-mystrom to 0.4.4 (#14889)
This commit is contained in:
parent
ce0ca7ff90
commit
703b4354e0
@ -13,9 +13,9 @@ from homeassistant.components.light import (
|
|||||||
Light, PLATFORM_SCHEMA, ATTR_BRIGHTNESS, SUPPORT_BRIGHTNESS,
|
Light, PLATFORM_SCHEMA, ATTR_BRIGHTNESS, SUPPORT_BRIGHTNESS,
|
||||||
SUPPORT_EFFECT, ATTR_EFFECT, SUPPORT_FLASH, SUPPORT_COLOR,
|
SUPPORT_EFFECT, ATTR_EFFECT, SUPPORT_FLASH, SUPPORT_COLOR,
|
||||||
ATTR_HS_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__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -54,9 +54,9 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||||||
try:
|
try:
|
||||||
if bulb.get_status()['type'] != 'rgblamp':
|
if bulb.get_status()['type'] != 'rgblamp':
|
||||||
_LOGGER.error("Device %s (%s) is not a myStrom bulb", host, mac)
|
_LOGGER.error("Device %s (%s) is not a myStrom bulb", host, mac)
|
||||||
return False
|
return
|
||||||
except MyStromConnectionError:
|
except MyStromConnectionError:
|
||||||
_LOGGER.warning("myStrom bulb not online")
|
_LOGGER.warning("No route to device: %s", host)
|
||||||
|
|
||||||
add_devices([MyStromLight(bulb, name)], True)
|
add_devices([MyStromLight(bulb, name)], True)
|
||||||
|
|
||||||
@ -107,7 +107,7 @@ class MyStromLight(Light):
|
|||||||
@property
|
@property
|
||||||
def is_on(self):
|
def is_on(self):
|
||||||
"""Return true if light is on."""
|
"""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):
|
def turn_on(self, **kwargs):
|
||||||
"""Turn on the light."""
|
"""Turn on the light."""
|
||||||
@ -136,7 +136,7 @@ class MyStromLight(Light):
|
|||||||
if effect == EFFECT_RAINBOW:
|
if effect == EFFECT_RAINBOW:
|
||||||
self._bulb.set_rainbow(30)
|
self._bulb.set_rainbow(30)
|
||||||
except MyStromConnectionError:
|
except MyStromConnectionError:
|
||||||
_LOGGER.warning("myStrom bulb not online")
|
_LOGGER.warning("No route to device")
|
||||||
|
|
||||||
def turn_off(self, **kwargs):
|
def turn_off(self, **kwargs):
|
||||||
"""Turn off the bulb."""
|
"""Turn off the bulb."""
|
||||||
@ -163,5 +163,5 @@ class MyStromLight(Light):
|
|||||||
|
|
||||||
self._available = True
|
self._available = True
|
||||||
except MyStromConnectionError:
|
except MyStromConnectionError:
|
||||||
_LOGGER.warning("myStrom bulb not online")
|
_LOGGER.warning("No route to device")
|
||||||
self._available = False
|
self._available = False
|
||||||
|
@ -12,7 +12,7 @@ from homeassistant.components.switch import (SwitchDevice, PLATFORM_SCHEMA)
|
|||||||
from homeassistant.const import (CONF_NAME, CONF_HOST)
|
from homeassistant.const import (CONF_NAME, CONF_HOST)
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
|
|
||||||
REQUIREMENTS = ['python-mystrom==0.4.2']
|
REQUIREMENTS = ['python-mystrom==0.4.4']
|
||||||
|
|
||||||
DEFAULT_NAME = 'myStrom Switch'
|
DEFAULT_NAME = 'myStrom Switch'
|
||||||
|
|
||||||
@ -34,8 +34,8 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||||||
try:
|
try:
|
||||||
MyStromPlug(host).get_status()
|
MyStromPlug(host).get_status()
|
||||||
except exceptions.MyStromConnectionError:
|
except exceptions.MyStromConnectionError:
|
||||||
_LOGGER.error("No route to device '%s'", host)
|
_LOGGER.error("No route to device: %s", host)
|
||||||
return False
|
return
|
||||||
|
|
||||||
add_devices([MyStromSwitch(name, host)])
|
add_devices([MyStromSwitch(name, host)])
|
||||||
|
|
||||||
@ -74,8 +74,7 @@ class MyStromSwitch(SwitchDevice):
|
|||||||
try:
|
try:
|
||||||
self.plug.set_relay_on()
|
self.plug.set_relay_on()
|
||||||
except exceptions.MyStromConnectionError:
|
except exceptions.MyStromConnectionError:
|
||||||
_LOGGER.error("No route to device '%s'. Is device offline?",
|
_LOGGER.error("No route to device: %s", self._resource)
|
||||||
self._resource)
|
|
||||||
|
|
||||||
def turn_off(self, **kwargs):
|
def turn_off(self, **kwargs):
|
||||||
"""Turn the switch off."""
|
"""Turn the switch off."""
|
||||||
@ -83,8 +82,7 @@ class MyStromSwitch(SwitchDevice):
|
|||||||
try:
|
try:
|
||||||
self.plug.set_relay_off()
|
self.plug.set_relay_off()
|
||||||
except exceptions.MyStromConnectionError:
|
except exceptions.MyStromConnectionError:
|
||||||
_LOGGER.error("No route to device '%s'. Is device offline?",
|
_LOGGER.error("No route to device: %s", self._resource)
|
||||||
self._resource)
|
|
||||||
|
|
||||||
def update(self):
|
def update(self):
|
||||||
"""Get the latest data from the device and update the data."""
|
"""Get the latest data from the device and update the data."""
|
||||||
@ -93,5 +91,4 @@ class MyStromSwitch(SwitchDevice):
|
|||||||
self.data = self.plug.get_status()
|
self.data = self.plug.get_status()
|
||||||
except exceptions.MyStromConnectionError:
|
except exceptions.MyStromConnectionError:
|
||||||
self.data = {'power': 0, 'relay': False}
|
self.data = {'power': 0, 'relay': False}
|
||||||
_LOGGER.error("No route to device '%s'. Is device offline?",
|
_LOGGER.error("No route to device: %s", self._resource)
|
||||||
self._resource)
|
|
||||||
|
@ -1045,7 +1045,7 @@ python-mpd2==1.0.0
|
|||||||
|
|
||||||
# homeassistant.components.light.mystrom
|
# homeassistant.components.light.mystrom
|
||||||
# homeassistant.components.switch.mystrom
|
# homeassistant.components.switch.mystrom
|
||||||
python-mystrom==0.4.2
|
python-mystrom==0.4.4
|
||||||
|
|
||||||
# homeassistant.components.nest
|
# homeassistant.components.nest
|
||||||
python-nest==4.0.1
|
python-nest==4.0.1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user