Add watt to mysensors switch attributes (#13370)

This commit is contained in:
Martin Hjelmare 2018-03-21 23:55:49 +01:00 committed by Lukas Barth
parent 2d7d8848cb
commit 17cbd0f3c9

View file

@ -72,6 +72,12 @@ class MySensorsSwitch(mysensors.MySensorsEntity, SwitchDevice):
"""Return True if unable to access real state of entity."""
return self.gateway.optimistic
@property
def current_power_w(self):
"""Return the current power usage in W."""
set_req = self.gateway.const.SetReq
return self._values.get(set_req.V_WATT)
@property
def is_on(self):
"""Return True if switch is on."""