Centrally define Watt (#21570)

* centralize Watt definition

* lint
This commit is contained in:
Diogo Gomes authored and Daniel Høyer Iversen committed 2019-03-02 11:29:59 +01:00
1 parent e55ce61100
commit ed2b9e5483
26 files changed
+70 -58

No files matched your search

+3 -2
View File
@@ -2,6 +2,7 @@
import logging
from homeassistant.helpers.entity import Entity
from homeassistant.const import POWER_WATT
from homeassistant.components.edp_redy import EdpRedyDevice, EDP_REDY
@@ -29,7 +30,7 @@ async def async_setup_platform(
# Create a sensor for global active power
devices.append(EdpRedySensor(session, ACTIVE_POWER_ID, "Power Home",
'mdi:flash', 'W'))
'mdi:flash', POWER_WATT))
async_add_entities(devices, True)
@@ -89,7 +90,7 @@ class EdpRedyModuleSensor(EdpRedyDevice, Entity):
@property
def unit_of_measurement(self):
"""Return the unit of measurement of this sensor."""
return 'W'
return POWER_WATT
async def async_update(self):
"""Parse the data for this sensor."""