1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-26 14:08:21 +00:00
This commit is contained in:
Paulus Schoutsen
2019-07-31 12:25:30 -07:00
parent da05dfe708
commit 4de97abc3a
2676 changed files with 163166 additions and 140084 deletions

View File

@@ -15,8 +15,8 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
return
add_entities(
[FibaroSwitch(device) for
device in hass.data[FIBARO_DEVICES]['switch']], True)
[FibaroSwitch(device) for device in hass.data[FIBARO_DEVICES]["switch"]], True
)
class FibaroSwitch(FibaroDevice, SwitchDevice):
@@ -41,14 +41,14 @@ class FibaroSwitch(FibaroDevice, SwitchDevice):
@property
def current_power_w(self):
"""Return the current power usage in W."""
if 'power' in self.fibaro_device.interfaces:
if "power" in self.fibaro_device.interfaces:
return convert(self.fibaro_device.properties.power, float, 0.0)
return None
@property
def today_energy_kwh(self):
"""Return the today total energy usage in kWh."""
if 'energy' in self.fibaro_device.interfaces:
if "energy" in self.fibaro_device.interfaces:
return convert(self.fibaro_device.properties.energy, float, 0.0)
return None