diff --git a/homeassistant/components/switch/__init__.py b/homeassistant/components/switch/__init__.py index 7f7a70e1842..c2d110393f1 100644 --- a/homeassistant/components/switch/__init__.py +++ b/homeassistant/components/switch/__init__.py @@ -22,10 +22,8 @@ ENTITY_ID_ALL_SWITCHES = group.ENTITY_ID_FORMAT.format( ENTITY_ID_FORMAT = DOMAIN + '.{}' -ATTR_TODAY_KWH = "today_kwh" -ATTR_CURRENT_POWER = "current_power" -ATTR_TODAY_ON_TIME = "today_on_time" -ATTR_TODAY_STANDBY_TIME = "today_standby_time" +ATTR_TODAY_MWH = "today_mwh" +ATTR_CURRENT_POWER_MWH = "current_power_mwh" MIN_TIME_BETWEEN_SCANS = timedelta(seconds=10) diff --git a/homeassistant/components/switch/wemo.py b/homeassistant/components/switch/wemo.py index b6392ec0f0c..c27da0b69ef 100644 --- a/homeassistant/components/switch/wemo.py +++ b/homeassistant/components/switch/wemo.py @@ -3,6 +3,8 @@ import logging from homeassistant.helpers import ToggleDevice from homeassistant.const import ATTR_FRIENDLY_NAME, CONF_HOSTS +from homeassistant.components.switch import ( + ATTR_TODAY_MWH, ATTR_CURRENT_POWER_MWH) # pylint: disable=unused-argument @@ -38,7 +40,6 @@ class WemoSwitch(ToggleDevice): """ represents a WeMo switch within home assistant. """ def __init__(self, wemo): self.wemo = wemo - self.state_attr = {ATTR_FRIENDLY_NAME: wemo.name} def get_name(self): """ Returns the name of the switch if any. """ @@ -58,4 +59,13 @@ class WemoSwitch(ToggleDevice): def get_state_attributes(self): """ Returns optional state attributes. """ - return self.state_attr + if self.wemo.model.startswith('Belkin Insight'): + cur_info = self.wemo.insight_params + + return { + ATTR_FRIENDLY_NAME: self.wemo.name, + ATTR_CURRENT_POWER_MWH: cur_info['currentpower'], + ATTR_TODAY_MWH: cur_info['todaymw'] + } + else: + return {ATTR_FRIENDLY_NAME: self.wemo.name} diff --git a/homeassistant/external/pywemo b/homeassistant/external/pywemo index 10e7d7ba12b..b86d410cd67 160000 --- a/homeassistant/external/pywemo +++ b/homeassistant/external/pywemo @@ -1 +1 @@ -Subproject commit 10e7d7ba12b2326d69e3afe335d663b236790d3d +Subproject commit b86d410cd67ea1e3a60355aa23d17fe6761cb8c5