mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Restore typeerror check for units sans energy tracking (#13824)
This commit is contained in:
parent
cd8935cbd2
commit
c69f37500a
@ -84,12 +84,12 @@ class SmartPlugSwitch(SwitchDevice):
|
|||||||
"""Update edimax switch."""
|
"""Update edimax switch."""
|
||||||
try:
|
try:
|
||||||
self._now_power = float(self.smartplug.now_power)
|
self._now_power = float(self.smartplug.now_power)
|
||||||
except ValueError:
|
except (TypeError, ValueError):
|
||||||
self._now_power = None
|
self._now_power = None
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self._now_energy_day = float(self.smartplug.now_energy_day)
|
self._now_energy_day = float(self.smartplug.now_energy_day)
|
||||||
except ValueError:
|
except (TypeError, ValueError):
|
||||||
self._now_energy_day = None
|
self._now_energy_day = None
|
||||||
|
|
||||||
self._state = self.smartplug.state == 'ON'
|
self._state = self.smartplug.state == 'ON'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user