Add and use UNIT_VOLT constant (#33994)

* Add and use UNIT_VOLT constant

* Run isort
This commit is contained in:
springstan authored and GitHub committed 2020-04-11 02:04:58 +02:00
1 parent 32e87fc4c7
commit 04c4501455
22 files changed
+125 -64

No files matched your search

@@ -16,6 +16,7 @@ from homeassistant.const import (
POWER_WATT,
TEMP_CELSIUS,
TEMP_FAHRENHEIT,
UNIT_VOLT,
)
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity import Entity
@@ -40,8 +41,20 @@ INVERTER_MODES = (
# Supported sensor types:
# Key: ['json_key', 'name', unit, icon, attribute name]
SENSOR_TYPES = {
"current_AC_voltage": ["gridvoltage", "Grid Voltage", "V", "mdi:current-ac", None],
"current_DC_voltage": ["dcvoltage", "DC Voltage", "V", "mdi:current-dc", None],
"current_AC_voltage": [
"gridvoltage",
"Grid Voltage",
UNIT_VOLT,
"mdi:current-ac",
None,
],
"current_DC_voltage": [
"dcvoltage",
"DC Voltage",
UNIT_VOLT,
"mdi:current-dc",
None,
],
"current_frequency": [
"gridfrequency",
"Grid Frequency",
@@ -122,7 +135,7 @@ SENSOR_TYPES = {
"optimizer_voltage": [
"optimizervoltage",
"Average Optimizer Voltage",
"V",
UNIT_VOLT,
"mdi:solar-panel",
None,
],