Centrally define Energy Units (kWh and Wh) (#21719)

* centralize energy units kWh and Wh

* lint
This commit is contained in:
Diogo Gomes authored and Robbie Trencheny committed 2019-03-12 18:46:41 -07:00
1 parent c0b859d8da
commit a99d83390e
19 files changed
+70 -51

No files matched your search

+3 -2
View File
@@ -10,7 +10,8 @@ import requests
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import CONF_CURRENCY, POWER_WATT
from homeassistant.const import (CONF_CURRENCY, POWER_WATT,
ENERGY_KILO_WATT_HOUR)
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity import Entity
@@ -35,7 +36,7 @@ DEFAULT_UTC_OFFSET = '0'
SENSOR_TYPES = {
CONF_INSTANT: ['Energy Usage', POWER_WATT],
CONF_AMOUNT: ['Energy Consumed', 'kWh'],
CONF_AMOUNT: ['Energy Consumed', ENERGY_KILO_WATT_HOUR],
CONF_BUDGET: ['Energy Budget', None],
CONF_COST: ['Energy Cost', None],
CONF_CURRENT_VALUES: ['Per-Device Usage', POWER_WATT]