From 1d2fd8a2e9c4c89ff3d6155d2447eccdfa71a619 Mon Sep 17 00:00:00 2001 From: Andrei Pop <andreipop2005@gmail.com> Date: Thu, 15 Mar 2018 17:27:42 +0200 Subject: [PATCH] Edimax component reports wrong power values (#13011) * Fixed Edimax switch authentication error for newer firmware. * pyedimax moved to pypi * Added pyedimax to gen_requirements_all.py * Cleanup * Fixed https://github.com/home-assistant/home-assistant/issues/13008 * Only ValueError now * Trivial error. --- homeassistant/components/switch/edimax.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/homeassistant/components/switch/edimax.py b/homeassistant/components/switch/edimax.py index 50b5ba93b85..49eb5d32110 100644 --- a/homeassistant/components/switch/edimax.py +++ b/homeassistant/components/switch/edimax.py @@ -83,14 +83,13 @@ class SmartPlugSwitch(SwitchDevice): def update(self): """Update edimax switch.""" try: - self._now_power = float(self.smartplug.now_power) / 1000000.0 - except (TypeError, ValueError): + self._now_power = float(self.smartplug.now_power) + except ValueError: self._now_power = None try: - self._now_energy_day = (float(self.smartplug.now_energy_day) / - 1000.0) - except (TypeError, ValueError): + self._now_energy_day = float(self.smartplug.now_energy_day) + except ValueError: self._now_energy_day = None self._state = self.smartplug.state == 'ON' -- GitLab