From 17cbd0f3c9d9d5d3ef2caa7d15ada64266206c94 Mon Sep 17 00:00:00 2001 From: Martin Hjelmare Date: Wed, 21 Mar 2018 23:55:49 +0100 Subject: [PATCH] Add watt to mysensors switch attributes (#13370) --- homeassistant/components/switch/mysensors.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/homeassistant/components/switch/mysensors.py b/homeassistant/components/switch/mysensors.py index 51184859fc6..b4a1dcde3e6 100644 --- a/homeassistant/components/switch/mysensors.py +++ b/homeassistant/components/switch/mysensors.py @@ -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."""