Centrally define Watt (#21570)

* centralize Watt definition

* lint
This commit is contained in:
Diogo Gomes
2019-03-02 10:29:59 +00:00
committed by Daniel Høyer Iversen
parent e55ce61100
commit ed2b9e5483
26 changed files with 70 additions and 58 deletions

View File

@@ -3,6 +3,7 @@ from datetime import timedelta
import logging
from homeassistant.components.sense import SENSE_DATA
from homeassistant.const import POWER_WATT
from homeassistant.helpers.entity import Entity
from homeassistant.util import Throttle
@@ -90,7 +91,7 @@ class Sense(Entity):
self._state = None
if sensor_type == ACTIVE_TYPE:
self._unit_of_measurement = 'W'
self._unit_of_measurement = POWER_WATT
else:
self._unit_of_measurement = 'kWh'