From fc5e25a07bab728452936833053f7b96a25e6df7 Mon Sep 17 00:00:00 2001 From: jumpkick Date: Thu, 23 Feb 2017 18:03:49 -0500 Subject: [PATCH] Incorporate comment suggestions - Separate attribs from coffeemaker condition - Set power units for threshold to mW to be consistent with others - Adjust on-time labels to be more clear --- homeassistant/components/switch/wemo.py | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/homeassistant/components/switch/wemo.py b/homeassistant/components/switch/wemo.py index 0768b62062d..1c9cbe15a33 100644 --- a/homeassistant/components/switch/wemo.py +++ b/homeassistant/components/switch/wemo.py @@ -110,18 +110,16 @@ class WemoSwitch(SwitchDevice): if self.insight_params or (self.coffeemaker_mode is not None): attr[ATTR_CURRENT_STATE_DETAIL] = self.detail_state - attr['current_power_w'] = \ - self.insight_params['currentpower'] / 1000 - attr['today_power_mW_min'] = self.insight_params['todaymw'] - attr['total_power_mW_min'] = self.insight_params['totalmw'] - attr['on_time_most_recent'] = \ + + if self.insight_params: + attr['on_latest_time'] = \ WemoSwitch.as_uptime(self.insight_params['onfor']) - attr['on_time_today'] = \ + attr['on_today_time'] = \ WemoSwitch.as_uptime(self.insight_params['ontoday']) - attr['on_time_total'] = \ + attr['on_total_time'] = \ WemoSwitch.as_uptime(self.insight_params['ontotal']) - attr['power_threshold_w'] = \ - self.insight_params['powerthreshold'] / 1000 + attr['power_threshold_mw'] = \ + self.insight_params['powerthreshold'] if self.coffeemaker_mode is not None: attr[ATTR_COFFEMAKER_MODE] = self.coffeemaker_mode