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.
This commit is contained in:
Andrei Pop 2018-03-15 17:27:42 +02:00 committed by Pascal Vizeli
parent 92f13ff60d
commit 1d2fd8a2e9

View File

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