Drop UNIT_ prefix for constants (#34164)
* Drop UNIT_ prefix for VOLT * Drop UNIT_ prefix for DEGREE * Drop UNIT_ prefix for CONDUCTIVITY * Drop UNIT_ prefix for UV_INDEX * Run isortpull/34509/head
parent
fbde040f59
commit
ef9d9b17bd
|
@ -12,11 +12,11 @@ from homeassistant.const import (
|
||||||
ATTR_NAME,
|
ATTR_NAME,
|
||||||
CONCENTRATION_PARTS_PER_MILLION,
|
CONCENTRATION_PARTS_PER_MILLION,
|
||||||
CONF_API_KEY,
|
CONF_API_KEY,
|
||||||
|
DEGREE,
|
||||||
EVENT_HOMEASSISTANT_STOP,
|
EVENT_HOMEASSISTANT_STOP,
|
||||||
POWER_WATT,
|
POWER_WATT,
|
||||||
SPEED_MILES_PER_HOUR,
|
SPEED_MILES_PER_HOUR,
|
||||||
TEMP_FAHRENHEIT,
|
TEMP_FAHRENHEIT,
|
||||||
UNIT_DEGREE,
|
|
||||||
UNIT_PERCENTAGE,
|
UNIT_PERCENTAGE,
|
||||||
)
|
)
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
|
@ -219,10 +219,10 @@ SENSOR_TYPES = {
|
||||||
TYPE_TOTALRAININ: ("Lifetime Rain", "in", TYPE_SENSOR, None),
|
TYPE_TOTALRAININ: ("Lifetime Rain", "in", TYPE_SENSOR, None),
|
||||||
TYPE_UV: ("uv", "Index", TYPE_SENSOR, None),
|
TYPE_UV: ("uv", "Index", TYPE_SENSOR, None),
|
||||||
TYPE_WEEKLYRAININ: ("Weekly Rain", "in", TYPE_SENSOR, None),
|
TYPE_WEEKLYRAININ: ("Weekly Rain", "in", TYPE_SENSOR, None),
|
||||||
TYPE_WINDDIR: ("Wind Dir", UNIT_DEGREE, TYPE_SENSOR, None),
|
TYPE_WINDDIR: ("Wind Dir", DEGREE, TYPE_SENSOR, None),
|
||||||
TYPE_WINDDIR_AVG10M: ("Wind Dir Avg 10m", UNIT_DEGREE, TYPE_SENSOR, None),
|
TYPE_WINDDIR_AVG10M: ("Wind Dir Avg 10m", DEGREE, TYPE_SENSOR, None),
|
||||||
TYPE_WINDDIR_AVG2M: ("Wind Dir Avg 2m", SPEED_MILES_PER_HOUR, TYPE_SENSOR, None),
|
TYPE_WINDDIR_AVG2M: ("Wind Dir Avg 2m", SPEED_MILES_PER_HOUR, TYPE_SENSOR, None),
|
||||||
TYPE_WINDGUSTDIR: ("Gust Dir", UNIT_DEGREE, TYPE_SENSOR, None),
|
TYPE_WINDGUSTDIR: ("Gust Dir", DEGREE, TYPE_SENSOR, None),
|
||||||
TYPE_WINDGUSTMPH: ("Wind Gust", SPEED_MILES_PER_HOUR, TYPE_SENSOR, None),
|
TYPE_WINDGUSTMPH: ("Wind Gust", SPEED_MILES_PER_HOUR, TYPE_SENSOR, None),
|
||||||
TYPE_WINDSPDMPH_AVG10M: ("Wind Avg 10m", SPEED_MILES_PER_HOUR, TYPE_SENSOR, None),
|
TYPE_WINDSPDMPH_AVG10M: ("Wind Avg 10m", SPEED_MILES_PER_HOUR, TYPE_SENSOR, None),
|
||||||
TYPE_WINDSPDMPH_AVG2M: ("Wind Avg 2m", SPEED_MILES_PER_HOUR, TYPE_SENSOR, None),
|
TYPE_WINDSPDMPH_AVG2M: ("Wind Avg 2m", SPEED_MILES_PER_HOUR, TYPE_SENSOR, None),
|
||||||
|
|
|
@ -13,7 +13,7 @@ from homeassistant.const import (
|
||||||
TIME_MINUTES,
|
TIME_MINUTES,
|
||||||
TIME_SECONDS,
|
TIME_SECONDS,
|
||||||
UNIT_PERCENTAGE,
|
UNIT_PERCENTAGE,
|
||||||
UNIT_VOLT,
|
VOLT,
|
||||||
)
|
)
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.entity import Entity
|
from homeassistant.helpers.entity import Entity
|
||||||
|
@ -31,7 +31,7 @@ SENSOR_TYPES = {
|
||||||
"badbatts": ["Bad Batteries", "", "mdi:information-outline"],
|
"badbatts": ["Bad Batteries", "", "mdi:information-outline"],
|
||||||
"battdate": ["Battery Replaced", "", "mdi:calendar-clock"],
|
"battdate": ["Battery Replaced", "", "mdi:calendar-clock"],
|
||||||
"battstat": ["Battery Status", "", "mdi:information-outline"],
|
"battstat": ["Battery Status", "", "mdi:information-outline"],
|
||||||
"battv": ["Battery Voltage", UNIT_VOLT, "mdi:flash"],
|
"battv": ["Battery Voltage", VOLT, "mdi:flash"],
|
||||||
"bcharge": ["Battery", UNIT_PERCENTAGE, "mdi:battery"],
|
"bcharge": ["Battery", UNIT_PERCENTAGE, "mdi:battery"],
|
||||||
"cable": ["Cable Type", "", "mdi:ethernet-cable"],
|
"cable": ["Cable Type", "", "mdi:ethernet-cable"],
|
||||||
"cumonbatt": ["Total Time on Battery", "", "mdi:timer"],
|
"cumonbatt": ["Total Time on Battery", "", "mdi:timer"],
|
||||||
|
@ -44,33 +44,33 @@ SENSOR_TYPES = {
|
||||||
"endapc": ["Date and Time", "", "mdi:calendar-clock"],
|
"endapc": ["Date and Time", "", "mdi:calendar-clock"],
|
||||||
"extbatts": ["External Batteries", "", "mdi:information-outline"],
|
"extbatts": ["External Batteries", "", "mdi:information-outline"],
|
||||||
"firmware": ["Firmware Version", "", "mdi:information-outline"],
|
"firmware": ["Firmware Version", "", "mdi:information-outline"],
|
||||||
"hitrans": ["Transfer High", UNIT_VOLT, "mdi:flash"],
|
"hitrans": ["Transfer High", VOLT, "mdi:flash"],
|
||||||
"hostname": ["Hostname", "", "mdi:information-outline"],
|
"hostname": ["Hostname", "", "mdi:information-outline"],
|
||||||
"humidity": ["Ambient Humidity", UNIT_PERCENTAGE, "mdi:water-percent"],
|
"humidity": ["Ambient Humidity", UNIT_PERCENTAGE, "mdi:water-percent"],
|
||||||
"itemp": ["Internal Temperature", TEMP_CELSIUS, "mdi:thermometer"],
|
"itemp": ["Internal Temperature", TEMP_CELSIUS, "mdi:thermometer"],
|
||||||
"lastxfer": ["Last Transfer", "", "mdi:transfer"],
|
"lastxfer": ["Last Transfer", "", "mdi:transfer"],
|
||||||
"linefail": ["Input Voltage Status", "", "mdi:information-outline"],
|
"linefail": ["Input Voltage Status", "", "mdi:information-outline"],
|
||||||
"linefreq": ["Line Frequency", FREQUENCY_HERTZ, "mdi:information-outline"],
|
"linefreq": ["Line Frequency", FREQUENCY_HERTZ, "mdi:information-outline"],
|
||||||
"linev": ["Input Voltage", UNIT_VOLT, "mdi:flash"],
|
"linev": ["Input Voltage", VOLT, "mdi:flash"],
|
||||||
"loadpct": ["Load", UNIT_PERCENTAGE, "mdi:gauge"],
|
"loadpct": ["Load", UNIT_PERCENTAGE, "mdi:gauge"],
|
||||||
"loadapnt": ["Load Apparent Power", UNIT_PERCENTAGE, "mdi:gauge"],
|
"loadapnt": ["Load Apparent Power", UNIT_PERCENTAGE, "mdi:gauge"],
|
||||||
"lotrans": ["Transfer Low", UNIT_VOLT, "mdi:flash"],
|
"lotrans": ["Transfer Low", VOLT, "mdi:flash"],
|
||||||
"mandate": ["Manufacture Date", "", "mdi:calendar"],
|
"mandate": ["Manufacture Date", "", "mdi:calendar"],
|
||||||
"masterupd": ["Master Update", "", "mdi:information-outline"],
|
"masterupd": ["Master Update", "", "mdi:information-outline"],
|
||||||
"maxlinev": ["Input Voltage High", UNIT_VOLT, "mdi:flash"],
|
"maxlinev": ["Input Voltage High", VOLT, "mdi:flash"],
|
||||||
"maxtime": ["Battery Timeout", "", "mdi:timer-off"],
|
"maxtime": ["Battery Timeout", "", "mdi:timer-off"],
|
||||||
"mbattchg": ["Battery Shutdown", UNIT_PERCENTAGE, "mdi:battery-alert"],
|
"mbattchg": ["Battery Shutdown", UNIT_PERCENTAGE, "mdi:battery-alert"],
|
||||||
"minlinev": ["Input Voltage Low", UNIT_VOLT, "mdi:flash"],
|
"minlinev": ["Input Voltage Low", VOLT, "mdi:flash"],
|
||||||
"mintimel": ["Shutdown Time", "", "mdi:timer"],
|
"mintimel": ["Shutdown Time", "", "mdi:timer"],
|
||||||
"model": ["Model", "", "mdi:information-outline"],
|
"model": ["Model", "", "mdi:information-outline"],
|
||||||
"nombattv": ["Battery Nominal Voltage", UNIT_VOLT, "mdi:flash"],
|
"nombattv": ["Battery Nominal Voltage", VOLT, "mdi:flash"],
|
||||||
"nominv": ["Nominal Input Voltage", UNIT_VOLT, "mdi:flash"],
|
"nominv": ["Nominal Input Voltage", VOLT, "mdi:flash"],
|
||||||
"nomoutv": ["Nominal Output Voltage", UNIT_VOLT, "mdi:flash"],
|
"nomoutv": ["Nominal Output Voltage", VOLT, "mdi:flash"],
|
||||||
"nompower": ["Nominal Output Power", POWER_WATT, "mdi:flash"],
|
"nompower": ["Nominal Output Power", POWER_WATT, "mdi:flash"],
|
||||||
"nomapnt": ["Nominal Apparent Power", "VA", "mdi:flash"],
|
"nomapnt": ["Nominal Apparent Power", "VA", "mdi:flash"],
|
||||||
"numxfers": ["Transfer Count", "", "mdi:counter"],
|
"numxfers": ["Transfer Count", "", "mdi:counter"],
|
||||||
"outcurnt": ["Output Current", "A", "mdi:flash"],
|
"outcurnt": ["Output Current", "A", "mdi:flash"],
|
||||||
"outputv": ["Output Voltage", UNIT_VOLT, "mdi:flash"],
|
"outputv": ["Output Voltage", VOLT, "mdi:flash"],
|
||||||
"reg1": ["Register 1 Fault", "", "mdi:information-outline"],
|
"reg1": ["Register 1 Fault", "", "mdi:information-outline"],
|
||||||
"reg2": ["Register 2 Fault", "", "mdi:information-outline"],
|
"reg2": ["Register 2 Fault", "", "mdi:information-outline"],
|
||||||
"reg3": ["Register 3 Fault", "", "mdi:information-outline"],
|
"reg3": ["Register 3 Fault", "", "mdi:information-outline"],
|
||||||
|
@ -97,7 +97,7 @@ INFERRED_UNITS = {
|
||||||
" Minutes": TIME_MINUTES,
|
" Minutes": TIME_MINUTES,
|
||||||
" Seconds": TIME_SECONDS,
|
" Seconds": TIME_SECONDS,
|
||||||
" Percent": UNIT_PERCENTAGE,
|
" Percent": UNIT_PERCENTAGE,
|
||||||
" Volts": UNIT_VOLT,
|
" Volts": VOLT,
|
||||||
" Ampere": "A",
|
" Ampere": "A",
|
||||||
" Volt-Ampere": "VA",
|
" Volt-Ampere": "VA",
|
||||||
" Watts": POWER_WATT,
|
" Watts": POWER_WATT,
|
||||||
|
|
|
@ -3,7 +3,7 @@ import json
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from homeassistant.components import mqtt
|
from homeassistant.components import mqtt
|
||||||
from homeassistant.const import TEMP_CELSIUS, TEMP_FAHRENHEIT, UNIT_DEGREE
|
from homeassistant.const import DEGREE, TEMP_CELSIUS, TEMP_FAHRENHEIT
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
from homeassistant.helpers.entity import Entity
|
from homeassistant.helpers.entity import Entity
|
||||||
from homeassistant.util import slugify
|
from homeassistant.util import slugify
|
||||||
|
@ -45,7 +45,7 @@ def discover_sensors(topic, payload):
|
||||||
return (
|
return (
|
||||||
ArwnSensor("Wind Speed", "speed", unit, "mdi:speedometer"),
|
ArwnSensor("Wind Speed", "speed", unit, "mdi:speedometer"),
|
||||||
ArwnSensor("Wind Gust", "gust", unit, "mdi:speedometer"),
|
ArwnSensor("Wind Gust", "gust", unit, "mdi:speedometer"),
|
||||||
ArwnSensor("Wind Direction", "direction", UNIT_DEGREE, "mdi:compass"),
|
ArwnSensor("Wind Direction", "direction", DEGREE, "mdi:compass"),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -27,12 +27,12 @@ from homeassistant.const import (
|
||||||
CONF_LONGITUDE,
|
CONF_LONGITUDE,
|
||||||
CONF_MONITORED_CONDITIONS,
|
CONF_MONITORED_CONDITIONS,
|
||||||
CONF_NAME,
|
CONF_NAME,
|
||||||
|
DEGREE,
|
||||||
IRRADIATION_WATTS_PER_SQUARE_METER,
|
IRRADIATION_WATTS_PER_SQUARE_METER,
|
||||||
LENGTH_KILOMETERS,
|
LENGTH_KILOMETERS,
|
||||||
SPEED_KILOMETERS_PER_HOUR,
|
SPEED_KILOMETERS_PER_HOUR,
|
||||||
TEMP_CELSIUS,
|
TEMP_CELSIUS,
|
||||||
TIME_HOURS,
|
TIME_HOURS,
|
||||||
UNIT_DEGREE,
|
|
||||||
UNIT_PERCENTAGE,
|
UNIT_PERCENTAGE,
|
||||||
)
|
)
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
|
@ -77,7 +77,7 @@ SENSOR_TYPES = {
|
||||||
"windspeed": ["Wind speed", SPEED_KILOMETERS_PER_HOUR, "mdi:weather-windy"],
|
"windspeed": ["Wind speed", SPEED_KILOMETERS_PER_HOUR, "mdi:weather-windy"],
|
||||||
"windforce": ["Wind force", "Bft", "mdi:weather-windy"],
|
"windforce": ["Wind force", "Bft", "mdi:weather-windy"],
|
||||||
"winddirection": ["Wind direction", None, "mdi:compass-outline"],
|
"winddirection": ["Wind direction", None, "mdi:compass-outline"],
|
||||||
"windazimuth": ["Wind direction azimuth", UNIT_DEGREE, "mdi:compass-outline"],
|
"windazimuth": ["Wind direction azimuth", DEGREE, "mdi:compass-outline"],
|
||||||
"pressure": ["Pressure", "hPa", "mdi:gauge"],
|
"pressure": ["Pressure", "hPa", "mdi:gauge"],
|
||||||
"visibility": ["Visibility", LENGTH_KILOMETERS, None],
|
"visibility": ["Visibility", LENGTH_KILOMETERS, None],
|
||||||
"windgust": ["Wind gust", SPEED_KILOMETERS_PER_HOUR, "mdi:weather-windy"],
|
"windgust": ["Wind gust", SPEED_KILOMETERS_PER_HOUR, "mdi:weather-windy"],
|
||||||
|
@ -149,11 +149,11 @@ SENSOR_TYPES = {
|
||||||
"winddirection_3d": ["Wind direction 3d", None, "mdi:compass-outline"],
|
"winddirection_3d": ["Wind direction 3d", None, "mdi:compass-outline"],
|
||||||
"winddirection_4d": ["Wind direction 4d", None, "mdi:compass-outline"],
|
"winddirection_4d": ["Wind direction 4d", None, "mdi:compass-outline"],
|
||||||
"winddirection_5d": ["Wind direction 5d", None, "mdi:compass-outline"],
|
"winddirection_5d": ["Wind direction 5d", None, "mdi:compass-outline"],
|
||||||
"windazimuth_1d": ["Wind direction azimuth 1d", UNIT_DEGREE, "mdi:compass-outline"],
|
"windazimuth_1d": ["Wind direction azimuth 1d", DEGREE, "mdi:compass-outline"],
|
||||||
"windazimuth_2d": ["Wind direction azimuth 2d", UNIT_DEGREE, "mdi:compass-outline"],
|
"windazimuth_2d": ["Wind direction azimuth 2d", DEGREE, "mdi:compass-outline"],
|
||||||
"windazimuth_3d": ["Wind direction azimuth 3d", UNIT_DEGREE, "mdi:compass-outline"],
|
"windazimuth_3d": ["Wind direction azimuth 3d", DEGREE, "mdi:compass-outline"],
|
||||||
"windazimuth_4d": ["Wind direction azimuth 4d", UNIT_DEGREE, "mdi:compass-outline"],
|
"windazimuth_4d": ["Wind direction azimuth 4d", DEGREE, "mdi:compass-outline"],
|
||||||
"windazimuth_5d": ["Wind direction azimuth 5d", UNIT_DEGREE, "mdi:compass-outline"],
|
"windazimuth_5d": ["Wind direction azimuth 5d", DEGREE, "mdi:compass-outline"],
|
||||||
"condition_1d": ["Condition 1d", None, None],
|
"condition_1d": ["Condition 1d", None, None],
|
||||||
"condition_2d": ["Condition 2d", None, None],
|
"condition_2d": ["Condition 2d", None, None],
|
||||||
"condition_3d": ["Condition 3d", None, None],
|
"condition_3d": ["Condition 3d", None, None],
|
||||||
|
|
|
@ -15,6 +15,7 @@ from homeassistant.const import (
|
||||||
CONF_MONITORED_CONDITIONS,
|
CONF_MONITORED_CONDITIONS,
|
||||||
CONF_NAME,
|
CONF_NAME,
|
||||||
CONF_SCAN_INTERVAL,
|
CONF_SCAN_INTERVAL,
|
||||||
|
DEGREE,
|
||||||
LENGTH_CENTIMETERS,
|
LENGTH_CENTIMETERS,
|
||||||
LENGTH_KILOMETERS,
|
LENGTH_KILOMETERS,
|
||||||
SPEED_KILOMETERS_PER_HOUR,
|
SPEED_KILOMETERS_PER_HOUR,
|
||||||
|
@ -23,9 +24,8 @@ from homeassistant.const import (
|
||||||
TEMP_CELSIUS,
|
TEMP_CELSIUS,
|
||||||
TEMP_FAHRENHEIT,
|
TEMP_FAHRENHEIT,
|
||||||
TIME_HOURS,
|
TIME_HOURS,
|
||||||
UNIT_DEGREE,
|
|
||||||
UNIT_PERCENTAGE,
|
UNIT_PERCENTAGE,
|
||||||
UNIT_UV_INDEX,
|
UV_INDEX,
|
||||||
)
|
)
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.entity import Entity
|
from homeassistant.helpers.entity import Entity
|
||||||
|
@ -89,11 +89,11 @@ SENSOR_TYPES = {
|
||||||
],
|
],
|
||||||
"nearest_storm_bearing": [
|
"nearest_storm_bearing": [
|
||||||
"Nearest Storm Bearing",
|
"Nearest Storm Bearing",
|
||||||
UNIT_DEGREE,
|
DEGREE,
|
||||||
UNIT_DEGREE,
|
DEGREE,
|
||||||
UNIT_DEGREE,
|
DEGREE,
|
||||||
UNIT_DEGREE,
|
DEGREE,
|
||||||
UNIT_DEGREE,
|
DEGREE,
|
||||||
"mdi:weather-lightning",
|
"mdi:weather-lightning",
|
||||||
["currently"],
|
["currently"],
|
||||||
],
|
],
|
||||||
|
@ -179,11 +179,11 @@ SENSOR_TYPES = {
|
||||||
],
|
],
|
||||||
"wind_bearing": [
|
"wind_bearing": [
|
||||||
"Wind Bearing",
|
"Wind Bearing",
|
||||||
UNIT_DEGREE,
|
DEGREE,
|
||||||
UNIT_DEGREE,
|
DEGREE,
|
||||||
UNIT_DEGREE,
|
DEGREE,
|
||||||
UNIT_DEGREE,
|
DEGREE,
|
||||||
UNIT_DEGREE,
|
DEGREE,
|
||||||
"mdi:compass",
|
"mdi:compass",
|
||||||
["currently", "hourly", "daily"],
|
["currently", "hourly", "daily"],
|
||||||
],
|
],
|
||||||
|
@ -339,11 +339,11 @@ SENSOR_TYPES = {
|
||||||
],
|
],
|
||||||
"uv_index": [
|
"uv_index": [
|
||||||
"UV Index",
|
"UV Index",
|
||||||
UNIT_UV_INDEX,
|
UV_INDEX,
|
||||||
UNIT_UV_INDEX,
|
UV_INDEX,
|
||||||
UNIT_UV_INDEX,
|
UV_INDEX,
|
||||||
UNIT_UV_INDEX,
|
UV_INDEX,
|
||||||
UNIT_UV_INDEX,
|
UV_INDEX,
|
||||||
"mdi:weather-sunny",
|
"mdi:weather-sunny",
|
||||||
["currently", "hourly", "daily"],
|
["currently", "hourly", "daily"],
|
||||||
],
|
],
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
"""Definitions for DSMR Reader sensors added to MQTT."""
|
"""Definitions for DSMR Reader sensors added to MQTT."""
|
||||||
|
|
||||||
from homeassistant.const import ENERGY_KILO_WATT_HOUR, UNIT_VOLT, VOLUME_CUBIC_METERS
|
from homeassistant.const import ENERGY_KILO_WATT_HOUR, VOLT, VOLUME_CUBIC_METERS
|
||||||
|
|
||||||
|
|
||||||
def dsmr_transform(value):
|
def dsmr_transform(value):
|
||||||
|
@ -86,17 +86,17 @@ DEFINITIONS = {
|
||||||
"dsmr/reading/phase_voltage_l1": {
|
"dsmr/reading/phase_voltage_l1": {
|
||||||
"name": "Current voltage L1",
|
"name": "Current voltage L1",
|
||||||
"icon": "mdi:flash",
|
"icon": "mdi:flash",
|
||||||
"unit": UNIT_VOLT,
|
"unit": VOLT,
|
||||||
},
|
},
|
||||||
"dsmr/reading/phase_voltage_l2": {
|
"dsmr/reading/phase_voltage_l2": {
|
||||||
"name": "Current voltage L2",
|
"name": "Current voltage L2",
|
||||||
"icon": "mdi:flash",
|
"icon": "mdi:flash",
|
||||||
"unit": UNIT_VOLT,
|
"unit": VOLT,
|
||||||
},
|
},
|
||||||
"dsmr/reading/phase_voltage_l3": {
|
"dsmr/reading/phase_voltage_l3": {
|
||||||
"name": "Current voltage L3",
|
"name": "Current voltage L3",
|
||||||
"icon": "mdi:flash",
|
"icon": "mdi:flash",
|
||||||
"unit": UNIT_VOLT,
|
"unit": VOLT,
|
||||||
},
|
},
|
||||||
"dsmr/consumption/gas/delivered": {
|
"dsmr/consumption/gas/delivered": {
|
||||||
"name": "Gas usage",
|
"name": "Gas usage",
|
||||||
|
|
|
@ -7,7 +7,7 @@ from elkm1_lib.const import (
|
||||||
)
|
)
|
||||||
from elkm1_lib.util import pretty_const, username
|
from elkm1_lib.util import pretty_const, username
|
||||||
|
|
||||||
from homeassistant.const import UNIT_VOLT
|
from homeassistant.const import VOLT
|
||||||
|
|
||||||
from . import ElkAttachedEntity, create_elk_entities
|
from . import ElkAttachedEntity, create_elk_entities
|
||||||
from .const import DOMAIN
|
from .const import DOMAIN
|
||||||
|
@ -197,7 +197,7 @@ class ElkZone(ElkSensor):
|
||||||
if self._element.definition == ZoneType.TEMPERATURE.value:
|
if self._element.definition == ZoneType.TEMPERATURE.value:
|
||||||
return self._temperature_unit
|
return self._temperature_unit
|
||||||
if self._element.definition == ZoneType.ANALOG_ZONE.value:
|
if self._element.definition == ZoneType.ANALOG_ZONE.value:
|
||||||
return UNIT_VOLT
|
return VOLT
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def _element_changed(self, element, changeset):
|
def _element_changed(self, element, changeset):
|
||||||
|
|
|
@ -6,7 +6,7 @@ import logging
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||||
from homeassistant.const import CONF_DISPLAY_OPTIONS, CONF_NAME, TEMP_CELSIUS, UNIT_VOLT
|
from homeassistant.const import CONF_DISPLAY_OPTIONS, CONF_NAME, TEMP_CELSIUS, VOLT
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.entity import Entity
|
from homeassistant.helpers.entity import Entity
|
||||||
from homeassistant.util import Throttle
|
from homeassistant.util import Throttle
|
||||||
|
@ -31,10 +31,10 @@ SENSOR_TYPES = {
|
||||||
"magnetometer_z": ["magnetometer_z", " ", "mdi:magnet"],
|
"magnetometer_z": ["magnetometer_z", " ", "mdi:magnet"],
|
||||||
"temperature": ["temperature", TEMP_CELSIUS, "mdi:thermometer"],
|
"temperature": ["temperature", TEMP_CELSIUS, "mdi:thermometer"],
|
||||||
"pressure": ["pressure", "hPa", "mdi:gauge"],
|
"pressure": ["pressure", "hPa", "mdi:gauge"],
|
||||||
"voltage_0": ["voltage_0", UNIT_VOLT, "mdi:flash"],
|
"voltage_0": ["voltage_0", VOLT, "mdi:flash"],
|
||||||
"voltage_1": ["voltage_1", UNIT_VOLT, "mdi:flash"],
|
"voltage_1": ["voltage_1", VOLT, "mdi:flash"],
|
||||||
"voltage_2": ["voltage_2", UNIT_VOLT, "mdi:flash"],
|
"voltage_2": ["voltage_2", VOLT, "mdi:flash"],
|
||||||
"voltage_3": ["voltage_3", UNIT_VOLT, "mdi:flash"],
|
"voltage_3": ["voltage_3", VOLT, "mdi:flash"],
|
||||||
}
|
}
|
||||||
|
|
||||||
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
|
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
|
||||||
|
|
|
@ -8,7 +8,7 @@ from homeassistant.const import (
|
||||||
TIME_HOURS,
|
TIME_HOURS,
|
||||||
TIME_MINUTES,
|
TIME_MINUTES,
|
||||||
TIME_SECONDS,
|
TIME_SECONDS,
|
||||||
UNIT_VOLT,
|
VOLT,
|
||||||
)
|
)
|
||||||
from homeassistant.helpers.entity import Entity
|
from homeassistant.helpers.entity import Entity
|
||||||
|
|
||||||
|
@ -311,4 +311,4 @@ class VoltageSensor(GEMSensor):
|
||||||
@property
|
@property
|
||||||
def unit_of_measurement(self):
|
def unit_of_measurement(self):
|
||||||
"""Return the unit of measurement for this sensor."""
|
"""Return the unit of measurement for this sensor."""
|
||||||
return UNIT_VOLT
|
return VOLT
|
||||||
|
|
|
@ -15,7 +15,7 @@ from homeassistant.const import (
|
||||||
ENERGY_KILO_WATT_HOUR,
|
ENERGY_KILO_WATT_HOUR,
|
||||||
FREQUENCY_HERTZ,
|
FREQUENCY_HERTZ,
|
||||||
POWER_WATT,
|
POWER_WATT,
|
||||||
UNIT_VOLT,
|
VOLT,
|
||||||
)
|
)
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.entity import Entity
|
from homeassistant.helpers.entity import Entity
|
||||||
|
@ -60,17 +60,17 @@ INVERTER_SENSOR_TYPES = {
|
||||||
"e_total",
|
"e_total",
|
||||||
"power",
|
"power",
|
||||||
),
|
),
|
||||||
"inverter_voltage_input_1": ("Input 1 voltage", UNIT_VOLT, "vpv1", None),
|
"inverter_voltage_input_1": ("Input 1 voltage", VOLT, "vpv1", None),
|
||||||
"inverter_amperage_input_1": ("Input 1 Amperage", "A", "ipv1", None),
|
"inverter_amperage_input_1": ("Input 1 Amperage", "A", "ipv1", None),
|
||||||
"inverter_wattage_input_1": ("Input 1 Wattage", POWER_WATT, "ppv1", "power"),
|
"inverter_wattage_input_1": ("Input 1 Wattage", POWER_WATT, "ppv1", "power"),
|
||||||
"inverter_voltage_input_2": ("Input 2 voltage", UNIT_VOLT, "vpv2", None),
|
"inverter_voltage_input_2": ("Input 2 voltage", VOLT, "vpv2", None),
|
||||||
"inverter_amperage_input_2": ("Input 2 Amperage", "A", "ipv2", None),
|
"inverter_amperage_input_2": ("Input 2 Amperage", "A", "ipv2", None),
|
||||||
"inverter_wattage_input_2": ("Input 2 Wattage", POWER_WATT, "ppv2", "power"),
|
"inverter_wattage_input_2": ("Input 2 Wattage", POWER_WATT, "ppv2", "power"),
|
||||||
"inverter_voltage_input_3": ("Input 3 voltage", UNIT_VOLT, "vpv3", None),
|
"inverter_voltage_input_3": ("Input 3 voltage", VOLT, "vpv3", None),
|
||||||
"inverter_amperage_input_3": ("Input 3 Amperage", "A", "ipv3", None),
|
"inverter_amperage_input_3": ("Input 3 Amperage", "A", "ipv3", None),
|
||||||
"inverter_wattage_input_3": ("Input 3 Wattage", POWER_WATT, "ppv3", "power"),
|
"inverter_wattage_input_3": ("Input 3 Wattage", POWER_WATT, "ppv3", "power"),
|
||||||
"inverter_internal_wattage": ("Internal wattage", POWER_WATT, "ppv", "power"),
|
"inverter_internal_wattage": ("Internal wattage", POWER_WATT, "ppv", "power"),
|
||||||
"inverter_reactive_voltage": ("Reactive voltage", UNIT_VOLT, "vacr", None),
|
"inverter_reactive_voltage": ("Reactive voltage", VOLT, "vacr", None),
|
||||||
"inverter_inverter_reactive_amperage": ("Reactive amperage", "A", "iacr", None),
|
"inverter_inverter_reactive_amperage": ("Reactive amperage", "A", "iacr", None),
|
||||||
"inverter_frequency": ("AC frequency", FREQUENCY_HERTZ, "fac", None),
|
"inverter_frequency": ("AC frequency", FREQUENCY_HERTZ, "fac", None),
|
||||||
"inverter_current_wattage": ("Output power", POWER_WATT, "pac", "power"),
|
"inverter_current_wattage": ("Output power", POWER_WATT, "pac", "power"),
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
|
DEGREE,
|
||||||
DEVICE_CLASS_HUMIDITY,
|
DEVICE_CLASS_HUMIDITY,
|
||||||
DEVICE_CLASS_ILLUMINANCE,
|
DEVICE_CLASS_ILLUMINANCE,
|
||||||
DEVICE_CLASS_POWER,
|
DEVICE_CLASS_POWER,
|
||||||
|
@ -11,9 +12,8 @@ from homeassistant.const import (
|
||||||
POWER_WATT,
|
POWER_WATT,
|
||||||
SPEED_KILOMETERS_PER_HOUR,
|
SPEED_KILOMETERS_PER_HOUR,
|
||||||
TEMP_CELSIUS,
|
TEMP_CELSIUS,
|
||||||
UNIT_DEGREE,
|
|
||||||
UNIT_PERCENTAGE,
|
UNIT_PERCENTAGE,
|
||||||
UNIT_VOLT,
|
VOLT,
|
||||||
VOLUME_CUBIC_METERS,
|
VOLUME_CUBIC_METERS,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ HM_UNIT_HA_CAST = {
|
||||||
"BRIGHTNESS": "#",
|
"BRIGHTNESS": "#",
|
||||||
"POWER": POWER_WATT,
|
"POWER": POWER_WATT,
|
||||||
"CURRENT": "mA",
|
"CURRENT": "mA",
|
||||||
"VOLTAGE": UNIT_VOLT,
|
"VOLTAGE": VOLT,
|
||||||
"ENERGY_COUNTER": ENERGY_WATT_HOUR,
|
"ENERGY_COUNTER": ENERGY_WATT_HOUR,
|
||||||
"GAS_POWER": VOLUME_CUBIC_METERS,
|
"GAS_POWER": VOLUME_CUBIC_METERS,
|
||||||
"GAS_ENERGY_COUNTER": VOLUME_CUBIC_METERS,
|
"GAS_ENERGY_COUNTER": VOLUME_CUBIC_METERS,
|
||||||
|
@ -55,8 +55,8 @@ HM_UNIT_HA_CAST = {
|
||||||
"HIGHEST_ILLUMINATION": "lx",
|
"HIGHEST_ILLUMINATION": "lx",
|
||||||
"RAIN_COUNTER": "mm",
|
"RAIN_COUNTER": "mm",
|
||||||
"WIND_SPEED": SPEED_KILOMETERS_PER_HOUR,
|
"WIND_SPEED": SPEED_KILOMETERS_PER_HOUR,
|
||||||
"WIND_DIRECTION": UNIT_DEGREE,
|
"WIND_DIRECTION": DEGREE,
|
||||||
"WIND_DIRECTION_RANGE": UNIT_DEGREE,
|
"WIND_DIRECTION_RANGE": DEGREE,
|
||||||
"SUNSHINEDURATION": "#",
|
"SUNSHINEDURATION": "#",
|
||||||
"AIR_PRESSURE": "hPa",
|
"AIR_PRESSURE": "hPa",
|
||||||
"FREQUENCY": FREQUENCY_HERTZ,
|
"FREQUENCY": FREQUENCY_HERTZ,
|
||||||
|
|
|
@ -5,6 +5,7 @@ from typing import Callable
|
||||||
from homeassistant.components.sensor import DOMAIN
|
from homeassistant.components.sensor import DOMAIN
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
CONCENTRATION_PARTS_PER_MILLION,
|
CONCENTRATION_PARTS_PER_MILLION,
|
||||||
|
DEGREE,
|
||||||
FREQUENCY_HERTZ,
|
FREQUENCY_HERTZ,
|
||||||
LENGTH_CENTIMETERS,
|
LENGTH_CENTIMETERS,
|
||||||
LENGTH_KILOMETERS,
|
LENGTH_KILOMETERS,
|
||||||
|
@ -23,10 +24,9 @@ from homeassistant.const import (
|
||||||
TIME_MONTHS,
|
TIME_MONTHS,
|
||||||
TIME_SECONDS,
|
TIME_SECONDS,
|
||||||
TIME_YEARS,
|
TIME_YEARS,
|
||||||
UNIT_DEGREE,
|
|
||||||
UNIT_PERCENTAGE,
|
UNIT_PERCENTAGE,
|
||||||
UNIT_UV_INDEX,
|
UV_INDEX,
|
||||||
UNIT_VOLT,
|
VOLT,
|
||||||
)
|
)
|
||||||
from homeassistant.helpers.typing import ConfigType
|
from homeassistant.helpers.typing import ConfigType
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ UOM_FRIENDLY_NAME = {
|
||||||
"10": TIME_DAYS,
|
"10": TIME_DAYS,
|
||||||
"12": "dB",
|
"12": "dB",
|
||||||
"13": "dB A",
|
"13": "dB A",
|
||||||
"14": UNIT_DEGREE,
|
"14": DEGREE,
|
||||||
"16": "macroseismic",
|
"16": "macroseismic",
|
||||||
"17": TEMP_FAHRENHEIT,
|
"17": TEMP_FAHRENHEIT,
|
||||||
"18": "ft",
|
"18": "ft",
|
||||||
|
@ -97,12 +97,12 @@ UOM_FRIENDLY_NAME = {
|
||||||
"64": "shindo",
|
"64": "shindo",
|
||||||
"65": "SML",
|
"65": "SML",
|
||||||
"69": "gal",
|
"69": "gal",
|
||||||
"71": UNIT_UV_INDEX,
|
"71": UV_INDEX,
|
||||||
"72": UNIT_VOLT,
|
"72": VOLT,
|
||||||
"73": POWER_WATT,
|
"73": POWER_WATT,
|
||||||
"74": f"{POWER_WATT}/m²",
|
"74": f"{POWER_WATT}/m²",
|
||||||
"75": "weekday",
|
"75": "weekday",
|
||||||
"76": f"Wind Direction ({UNIT_DEGREE})",
|
"76": f"Wind Direction ({DEGREE})",
|
||||||
"77": TIME_YEARS,
|
"77": TIME_YEARS,
|
||||||
"82": "mm",
|
"82": "mm",
|
||||||
"83": LENGTH_KILOMETERS,
|
"83": LENGTH_KILOMETERS,
|
||||||
|
@ -112,8 +112,8 @@ UOM_FRIENDLY_NAME = {
|
||||||
"88": "Water activity",
|
"88": "Water activity",
|
||||||
"89": "RPM",
|
"89": "RPM",
|
||||||
"90": FREQUENCY_HERTZ,
|
"90": FREQUENCY_HERTZ,
|
||||||
"91": f"{UNIT_DEGREE} (Relative to North)",
|
"91": f"{DEGREE} (Relative to North)",
|
||||||
"92": f"{UNIT_DEGREE} (Relative to South)",
|
"92": f"{DEGREE} (Relative to South)",
|
||||||
}
|
}
|
||||||
|
|
||||||
UOM_TO_STATES = {
|
UOM_TO_STATES = {
|
||||||
|
|
|
@ -6,7 +6,7 @@ from homeassistant.const import (
|
||||||
POWER_WATT,
|
POWER_WATT,
|
||||||
TEMP_CELSIUS,
|
TEMP_CELSIUS,
|
||||||
TIME_SECONDS,
|
TIME_SECONDS,
|
||||||
UNIT_VOLT,
|
VOLT,
|
||||||
)
|
)
|
||||||
from homeassistant.helpers.entity import Entity
|
from homeassistant.helpers.entity import Entity
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ _LOGGER = logging.getLogger(__name__)
|
||||||
SENSOR_TYPES = {
|
SENSOR_TYPES = {
|
||||||
"status": ["Charging Status", None],
|
"status": ["Charging Status", None],
|
||||||
"temperature": ["Temperature", TEMP_CELSIUS],
|
"temperature": ["Temperature", TEMP_CELSIUS],
|
||||||
"voltage": ["Voltage", UNIT_VOLT],
|
"voltage": ["Voltage", VOLT],
|
||||||
"amps": ["Amps", "A"],
|
"amps": ["Amps", "A"],
|
||||||
"watts": ["Watts", POWER_WATT],
|
"watts": ["Watts", POWER_WATT],
|
||||||
"charge_time": ["Charge time", TIME_SECONDS],
|
"charge_time": ["Charge time", TIME_SECONDS],
|
||||||
|
|
|
@ -2,12 +2,12 @@
|
||||||
from itertools import product
|
from itertools import product
|
||||||
|
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
|
DEGREE,
|
||||||
TEMP_CELSIUS,
|
TEMP_CELSIUS,
|
||||||
TEMP_FAHRENHEIT,
|
TEMP_FAHRENHEIT,
|
||||||
TEMP_KELVIN,
|
TEMP_KELVIN,
|
||||||
UNIT_DEGREE,
|
|
||||||
UNIT_PERCENTAGE,
|
UNIT_PERCENTAGE,
|
||||||
UNIT_VOLT,
|
VOLT,
|
||||||
)
|
)
|
||||||
|
|
||||||
DOMAIN = "lcn"
|
DOMAIN = "lcn"
|
||||||
|
@ -164,12 +164,12 @@ VAR_UNITS = [
|
||||||
"PERCENT",
|
"PERCENT",
|
||||||
"PPM",
|
"PPM",
|
||||||
"VOLT",
|
"VOLT",
|
||||||
UNIT_VOLT,
|
VOLT,
|
||||||
"AMPERE",
|
"AMPERE",
|
||||||
"AMP",
|
"AMP",
|
||||||
"A",
|
"A",
|
||||||
"DEGREE",
|
"DEGREE",
|
||||||
UNIT_DEGREE,
|
DEGREE,
|
||||||
]
|
]
|
||||||
|
|
||||||
RELVARREF = ["CURRENT", "PROG"]
|
RELVARREF = ["CURRENT", "PROG"]
|
||||||
|
|
|
@ -17,7 +17,7 @@ from homeassistant.const import (
|
||||||
SPEED_MILES_PER_HOUR,
|
SPEED_MILES_PER_HOUR,
|
||||||
TEMP_CELSIUS,
|
TEMP_CELSIUS,
|
||||||
UNIT_PERCENTAGE,
|
UNIT_PERCENTAGE,
|
||||||
UNIT_UV_INDEX,
|
UV_INDEX,
|
||||||
)
|
)
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.entity import Entity
|
from homeassistant.helpers.entity import Entity
|
||||||
|
@ -73,7 +73,7 @@ SENSOR_TYPES = {
|
||||||
"wind_gust": ["Wind Gust", SPEED_MILES_PER_HOUR],
|
"wind_gust": ["Wind Gust", SPEED_MILES_PER_HOUR],
|
||||||
"visibility": ["Visibility", None],
|
"visibility": ["Visibility", None],
|
||||||
"visibility_distance": ["Visibility Distance", LENGTH_KILOMETERS],
|
"visibility_distance": ["Visibility Distance", LENGTH_KILOMETERS],
|
||||||
"uv": ["UV", UNIT_UV_INDEX],
|
"uv": ["UV", UV_INDEX],
|
||||||
"precipitation": ["Probability of Precipitation", UNIT_PERCENTAGE],
|
"precipitation": ["Probability of Precipitation", UNIT_PERCENTAGE],
|
||||||
"humidity": ["Humidity", UNIT_PERCENTAGE],
|
"humidity": ["Humidity", UNIT_PERCENTAGE],
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@ import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
|
CONDUCTIVITY,
|
||||||
CONF_FORCE_UPDATE,
|
CONF_FORCE_UPDATE,
|
||||||
CONF_MAC,
|
CONF_MAC,
|
||||||
CONF_MONITORED_CONDITIONS,
|
CONF_MONITORED_CONDITIONS,
|
||||||
|
@ -18,7 +19,6 @@ from homeassistant.const import (
|
||||||
EVENT_HOMEASSISTANT_START,
|
EVENT_HOMEASSISTANT_START,
|
||||||
TEMP_CELSIUS,
|
TEMP_CELSIUS,
|
||||||
TEMP_FAHRENHEIT,
|
TEMP_FAHRENHEIT,
|
||||||
UNIT_CONDUCTIVITY,
|
|
||||||
UNIT_PERCENTAGE,
|
UNIT_PERCENTAGE,
|
||||||
)
|
)
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
|
@ -55,7 +55,7 @@ SENSOR_TYPES = {
|
||||||
"temperature": ["Temperature", TEMP_CELSIUS, "mdi:thermometer"],
|
"temperature": ["Temperature", TEMP_CELSIUS, "mdi:thermometer"],
|
||||||
"light": ["Light intensity", "lx", "mdi:white-balance-sunny"],
|
"light": ["Light intensity", "lx", "mdi:white-balance-sunny"],
|
||||||
"moisture": ["Moisture", UNIT_PERCENTAGE, "mdi:water-percent"],
|
"moisture": ["Moisture", UNIT_PERCENTAGE, "mdi:water-percent"],
|
||||||
"conductivity": ["Conductivity", UNIT_CONDUCTIVITY, "mdi:flash-circle"],
|
"conductivity": ["Conductivity", CONDUCTIVITY, "mdi:flash-circle"],
|
||||||
"battery": ["Battery", UNIT_PERCENTAGE, "mdi:battery-charging"],
|
"battery": ["Battery", UNIT_PERCENTAGE, "mdi:battery-charging"],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
from homeassistant.components import mysensors
|
from homeassistant.components import mysensors
|
||||||
from homeassistant.components.sensor import DOMAIN
|
from homeassistant.components.sensor import DOMAIN
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
|
CONDUCTIVITY,
|
||||||
|
DEGREE,
|
||||||
ENERGY_KILO_WATT_HOUR,
|
ENERGY_KILO_WATT_HOUR,
|
||||||
FREQUENCY_HERTZ,
|
FREQUENCY_HERTZ,
|
||||||
LENGTH_METERS,
|
LENGTH_METERS,
|
||||||
|
@ -9,10 +11,8 @@ from homeassistant.const import (
|
||||||
POWER_WATT,
|
POWER_WATT,
|
||||||
TEMP_CELSIUS,
|
TEMP_CELSIUS,
|
||||||
TEMP_FAHRENHEIT,
|
TEMP_FAHRENHEIT,
|
||||||
UNIT_CONDUCTIVITY,
|
|
||||||
UNIT_DEGREE,
|
|
||||||
UNIT_PERCENTAGE,
|
UNIT_PERCENTAGE,
|
||||||
UNIT_VOLT,
|
VOLT,
|
||||||
)
|
)
|
||||||
|
|
||||||
SENSORS = {
|
SENSORS = {
|
||||||
|
@ -26,7 +26,7 @@ SENSORS = {
|
||||||
"V_RAINRATE": [None, "mdi:weather-rainy"],
|
"V_RAINRATE": [None, "mdi:weather-rainy"],
|
||||||
"V_WIND": [None, "mdi:weather-windy"],
|
"V_WIND": [None, "mdi:weather-windy"],
|
||||||
"V_GUST": [None, "mdi:weather-windy"],
|
"V_GUST": [None, "mdi:weather-windy"],
|
||||||
"V_DIRECTION": [UNIT_DEGREE, "mdi:compass"],
|
"V_DIRECTION": [DEGREE, "mdi:compass"],
|
||||||
"V_WEIGHT": [MASS_KILOGRAMS, "mdi:weight-kilogram"],
|
"V_WEIGHT": [MASS_KILOGRAMS, "mdi:weight-kilogram"],
|
||||||
"V_DISTANCE": [LENGTH_METERS, "mdi:ruler"],
|
"V_DISTANCE": [LENGTH_METERS, "mdi:ruler"],
|
||||||
"V_IMPEDANCE": ["ohm", None],
|
"V_IMPEDANCE": ["ohm", None],
|
||||||
|
@ -40,11 +40,11 @@ SENSORS = {
|
||||||
"S_VIBRATION": [FREQUENCY_HERTZ, None],
|
"S_VIBRATION": [FREQUENCY_HERTZ, None],
|
||||||
"S_LIGHT_LEVEL": ["lx", "mdi:white-balance-sunny"],
|
"S_LIGHT_LEVEL": ["lx", "mdi:white-balance-sunny"],
|
||||||
},
|
},
|
||||||
"V_VOLTAGE": [UNIT_VOLT, "mdi:flash"],
|
"V_VOLTAGE": [VOLT, "mdi:flash"],
|
||||||
"V_CURRENT": ["A", "mdi:flash-auto"],
|
"V_CURRENT": ["A", "mdi:flash-auto"],
|
||||||
"V_PH": ["pH", None],
|
"V_PH": ["pH", None],
|
||||||
"V_ORP": ["mV", None],
|
"V_ORP": ["mV", None],
|
||||||
"V_EC": [UNIT_CONDUCTIVITY, None],
|
"V_EC": [CONDUCTIVITY, None],
|
||||||
"V_VAR": ["var", None],
|
"V_VAR": ["var", None],
|
||||||
"V_VA": ["VA", None],
|
"V_VA": ["VA", None],
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ from homeassistant.const import (
|
||||||
TEMP_CELSIUS,
|
TEMP_CELSIUS,
|
||||||
TIME_SECONDS,
|
TIME_SECONDS,
|
||||||
UNIT_PERCENTAGE,
|
UNIT_PERCENTAGE,
|
||||||
UNIT_VOLT,
|
VOLT,
|
||||||
)
|
)
|
||||||
|
|
||||||
DOMAIN = "nut"
|
DOMAIN = "nut"
|
||||||
|
@ -102,15 +102,10 @@ SENSOR_TYPES = {
|
||||||
None,
|
None,
|
||||||
],
|
],
|
||||||
"battery.charger.status": ["Charging Status", "", "mdi:information-outline", None],
|
"battery.charger.status": ["Charging Status", "", "mdi:information-outline", None],
|
||||||
"battery.voltage": ["Battery Voltage", UNIT_VOLT, "mdi:flash", None],
|
"battery.voltage": ["Battery Voltage", VOLT, "mdi:flash", None],
|
||||||
"battery.voltage.nominal": [
|
"battery.voltage.nominal": ["Nominal Battery Voltage", VOLT, "mdi:flash", None],
|
||||||
"Nominal Battery Voltage",
|
"battery.voltage.low": ["Low Battery Voltage", VOLT, "mdi:flash", None],
|
||||||
UNIT_VOLT,
|
"battery.voltage.high": ["High Battery Voltage", VOLT, "mdi:flash", None],
|
||||||
"mdi:flash",
|
|
||||||
None,
|
|
||||||
],
|
|
||||||
"battery.voltage.low": ["Low Battery Voltage", UNIT_VOLT, "mdi:flash", None],
|
|
||||||
"battery.voltage.high": ["High Battery Voltage", UNIT_VOLT, "mdi:flash", None],
|
|
||||||
"battery.capacity": ["Battery Capacity", "Ah", "mdi:flash", None],
|
"battery.capacity": ["Battery Capacity", "Ah", "mdi:flash", None],
|
||||||
"battery.current": ["Battery Current", "A", "mdi:flash", None],
|
"battery.current": ["Battery Current", "A", "mdi:flash", None],
|
||||||
"battery.current.total": ["Total Battery Current", "A", "mdi:flash", None],
|
"battery.current.total": ["Total Battery Current", "A", "mdi:flash", None],
|
||||||
|
@ -150,16 +145,16 @@ SENSOR_TYPES = {
|
||||||
"mdi:information-outline",
|
"mdi:information-outline",
|
||||||
None,
|
None,
|
||||||
],
|
],
|
||||||
"input.transfer.low": ["Low Voltage Transfer", UNIT_VOLT, "mdi:flash", None],
|
"input.transfer.low": ["Low Voltage Transfer", VOLT, "mdi:flash", None],
|
||||||
"input.transfer.high": ["High Voltage Transfer", UNIT_VOLT, "mdi:flash", None],
|
"input.transfer.high": ["High Voltage Transfer", VOLT, "mdi:flash", None],
|
||||||
"input.transfer.reason": [
|
"input.transfer.reason": [
|
||||||
"Voltage Transfer Reason",
|
"Voltage Transfer Reason",
|
||||||
"",
|
"",
|
||||||
"mdi:information-outline",
|
"mdi:information-outline",
|
||||||
None,
|
None,
|
||||||
],
|
],
|
||||||
"input.voltage": ["Input Voltage", UNIT_VOLT, "mdi:flash", None],
|
"input.voltage": ["Input Voltage", VOLT, "mdi:flash", None],
|
||||||
"input.voltage.nominal": ["Nominal Input Voltage", UNIT_VOLT, "mdi:flash", None],
|
"input.voltage.nominal": ["Nominal Input Voltage", VOLT, "mdi:flash", None],
|
||||||
"input.frequency": ["Input Line Frequency", FREQUENCY_HERTZ, "mdi:flash", None],
|
"input.frequency": ["Input Line Frequency", FREQUENCY_HERTZ, "mdi:flash", None],
|
||||||
"input.frequency.nominal": [
|
"input.frequency.nominal": [
|
||||||
"Nominal Input Line Frequency",
|
"Nominal Input Line Frequency",
|
||||||
|
@ -175,8 +170,8 @@ SENSOR_TYPES = {
|
||||||
],
|
],
|
||||||
"output.current": ["Output Current", "A", "mdi:flash", None],
|
"output.current": ["Output Current", "A", "mdi:flash", None],
|
||||||
"output.current.nominal": ["Nominal Output Current", "A", "mdi:flash", None],
|
"output.current.nominal": ["Nominal Output Current", "A", "mdi:flash", None],
|
||||||
"output.voltage": ["Output Voltage", UNIT_VOLT, "mdi:flash", None],
|
"output.voltage": ["Output Voltage", VOLT, "mdi:flash", None],
|
||||||
"output.voltage.nominal": ["Nominal Output Voltage", UNIT_VOLT, "mdi:flash", None],
|
"output.voltage.nominal": ["Nominal Output Voltage", VOLT, "mdi:flash", None],
|
||||||
"output.frequency": ["Output Frequency", FREQUENCY_HERTZ, "mdi:flash", None],
|
"output.frequency": ["Output Frequency", FREQUENCY_HERTZ, "mdi:flash", None],
|
||||||
"output.frequency.nominal": [
|
"output.frequency.nominal": [
|
||||||
"Nominal Output Frequency",
|
"Nominal Output Frequency",
|
||||||
|
|
|
@ -13,7 +13,7 @@ from homeassistant.const import (
|
||||||
CONF_PORT,
|
CONF_PORT,
|
||||||
TEMP_CELSIUS,
|
TEMP_CELSIUS,
|
||||||
UNIT_PERCENTAGE,
|
UNIT_PERCENTAGE,
|
||||||
UNIT_VOLT,
|
VOLT,
|
||||||
)
|
)
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.entity import Entity
|
from homeassistant.helpers.entity import Entity
|
||||||
|
@ -81,9 +81,9 @@ SENSOR_TYPES = {
|
||||||
"counter_a": ["counter", "count"],
|
"counter_a": ["counter", "count"],
|
||||||
"counter_b": ["counter", "count"],
|
"counter_b": ["counter", "count"],
|
||||||
"HobbyBoard": ["none", "none"],
|
"HobbyBoard": ["none", "none"],
|
||||||
"voltage": ["voltage", UNIT_VOLT],
|
"voltage": ["voltage", VOLT],
|
||||||
"voltage_VAD": ["voltage", UNIT_VOLT],
|
"voltage_VAD": ["voltage", VOLT],
|
||||||
"voltage_VDD": ["voltage", UNIT_VOLT],
|
"voltage_VDD": ["voltage", VOLT],
|
||||||
"current": ["current", "A"],
|
"current": ["current", "A"],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
"""Support for OpenUV sensors."""
|
"""Support for OpenUV sensors."""
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from homeassistant.const import TIME_MINUTES, UNIT_UV_INDEX
|
from homeassistant.const import TIME_MINUTES, UV_INDEX
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
from homeassistant.util.dt import as_local, parse_datetime
|
from homeassistant.util.dt import as_local, parse_datetime
|
||||||
|
|
||||||
|
@ -43,9 +43,9 @@ UV_LEVEL_LOW = "Low"
|
||||||
|
|
||||||
SENSORS = {
|
SENSORS = {
|
||||||
TYPE_CURRENT_OZONE_LEVEL: ("Current Ozone Level", "mdi:vector-triangle", "du"),
|
TYPE_CURRENT_OZONE_LEVEL: ("Current Ozone Level", "mdi:vector-triangle", "du"),
|
||||||
TYPE_CURRENT_UV_INDEX: ("Current UV Index", "mdi:weather-sunny", UNIT_UV_INDEX),
|
TYPE_CURRENT_UV_INDEX: ("Current UV Index", "mdi:weather-sunny", UV_INDEX),
|
||||||
TYPE_CURRENT_UV_LEVEL: ("Current UV Level", "mdi:weather-sunny", None),
|
TYPE_CURRENT_UV_LEVEL: ("Current UV Level", "mdi:weather-sunny", None),
|
||||||
TYPE_MAX_UV_INDEX: ("Max UV Index", "mdi:weather-sunny", UNIT_UV_INDEX),
|
TYPE_MAX_UV_INDEX: ("Max UV Index", "mdi:weather-sunny", UV_INDEX),
|
||||||
TYPE_SAFE_EXPOSURE_TIME_1: (
|
TYPE_SAFE_EXPOSURE_TIME_1: (
|
||||||
"Skin Type 1 Safe Exposure Time",
|
"Skin Type 1 Safe Exposure Time",
|
||||||
"mdi:timer",
|
"mdi:timer",
|
||||||
|
|
|
@ -12,10 +12,10 @@ from homeassistant.const import (
|
||||||
CONF_API_KEY,
|
CONF_API_KEY,
|
||||||
CONF_MONITORED_CONDITIONS,
|
CONF_MONITORED_CONDITIONS,
|
||||||
CONF_NAME,
|
CONF_NAME,
|
||||||
|
DEGREE,
|
||||||
SPEED_METERS_PER_SECOND,
|
SPEED_METERS_PER_SECOND,
|
||||||
TEMP_CELSIUS,
|
TEMP_CELSIUS,
|
||||||
TEMP_FAHRENHEIT,
|
TEMP_FAHRENHEIT,
|
||||||
UNIT_DEGREE,
|
|
||||||
UNIT_PERCENTAGE,
|
UNIT_PERCENTAGE,
|
||||||
)
|
)
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
|
@ -37,7 +37,7 @@ SENSOR_TYPES = {
|
||||||
"weather": ["Condition", None],
|
"weather": ["Condition", None],
|
||||||
"temperature": ["Temperature", None],
|
"temperature": ["Temperature", None],
|
||||||
"wind_speed": ["Wind speed", SPEED_METERS_PER_SECOND],
|
"wind_speed": ["Wind speed", SPEED_METERS_PER_SECOND],
|
||||||
"wind_bearing": ["Wind bearing", UNIT_DEGREE],
|
"wind_bearing": ["Wind bearing", DEGREE],
|
||||||
"humidity": ["Humidity", UNIT_PERCENTAGE],
|
"humidity": ["Humidity", UNIT_PERCENTAGE],
|
||||||
"pressure": ["Pressure", "mbar"],
|
"pressure": ["Pressure", "mbar"],
|
||||||
"clouds": ["Cloud coverage", UNIT_PERCENTAGE],
|
"clouds": ["Cloud coverage", UNIT_PERCENTAGE],
|
||||||
|
|
|
@ -10,13 +10,13 @@ from homeassistant.components.recorder.util import execute, session_scope
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
ATTR_TEMPERATURE,
|
ATTR_TEMPERATURE,
|
||||||
ATTR_UNIT_OF_MEASUREMENT,
|
ATTR_UNIT_OF_MEASUREMENT,
|
||||||
|
CONDUCTIVITY,
|
||||||
CONF_SENSORS,
|
CONF_SENSORS,
|
||||||
STATE_OK,
|
STATE_OK,
|
||||||
STATE_PROBLEM,
|
STATE_PROBLEM,
|
||||||
STATE_UNAVAILABLE,
|
STATE_UNAVAILABLE,
|
||||||
STATE_UNKNOWN,
|
STATE_UNKNOWN,
|
||||||
TEMP_CELSIUS,
|
TEMP_CELSIUS,
|
||||||
UNIT_CONDUCTIVITY,
|
|
||||||
UNIT_PERCENTAGE,
|
UNIT_PERCENTAGE,
|
||||||
)
|
)
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
|
@ -148,7 +148,7 @@ class Plant(Entity):
|
||||||
"max": CONF_MAX_MOISTURE,
|
"max": CONF_MAX_MOISTURE,
|
||||||
},
|
},
|
||||||
READING_CONDUCTIVITY: {
|
READING_CONDUCTIVITY: {
|
||||||
ATTR_UNIT_OF_MEASUREMENT: UNIT_CONDUCTIVITY,
|
ATTR_UNIT_OF_MEASUREMENT: CONDUCTIVITY,
|
||||||
"min": CONF_MIN_CONDUCTIVITY,
|
"min": CONF_MIN_CONDUCTIVITY,
|
||||||
"max": CONF_MAX_CONDUCTIVITY,
|
"max": CONF_MAX_CONDUCTIVITY,
|
||||||
},
|
},
|
||||||
|
|
|
@ -19,7 +19,7 @@ from homeassistant.const import (
|
||||||
POWER_WATT,
|
POWER_WATT,
|
||||||
TEMP_CELSIUS,
|
TEMP_CELSIUS,
|
||||||
UNIT_PERCENTAGE,
|
UNIT_PERCENTAGE,
|
||||||
UNIT_UV_INDEX,
|
UV_INDEX,
|
||||||
)
|
)
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.entity import Entity
|
from homeassistant.helpers.entity import Entity
|
||||||
|
@ -58,7 +58,7 @@ DATA_TYPES = OrderedDict(
|
||||||
("Sound", ""),
|
("Sound", ""),
|
||||||
("Sensor Status", ""),
|
("Sensor Status", ""),
|
||||||
("Counter value", ""),
|
("Counter value", ""),
|
||||||
("UV", UNIT_UV_INDEX),
|
("UV", UV_INDEX),
|
||||||
("Humidity status", ""),
|
("Humidity status", ""),
|
||||||
("Forecast", ""),
|
("Forecast", ""),
|
||||||
("Forecast numeric", ""),
|
("Forecast numeric", ""),
|
||||||
|
|
|
@ -3,11 +3,11 @@ from datetime import timedelta
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
|
DEGREE,
|
||||||
ENERGY_KILO_WATT_HOUR,
|
ENERGY_KILO_WATT_HOUR,
|
||||||
POWER_WATT,
|
POWER_WATT,
|
||||||
UNIT_DEGREE,
|
|
||||||
UNIT_PERCENTAGE,
|
UNIT_PERCENTAGE,
|
||||||
UNIT_VOLT,
|
VOLT,
|
||||||
VOLUME_CUBIC_METERS,
|
VOLUME_CUBIC_METERS,
|
||||||
)
|
)
|
||||||
from homeassistant.helpers.entity import Entity
|
from homeassistant.helpers.entity import Entity
|
||||||
|
@ -27,7 +27,7 @@ SENSOR_TYPES = {
|
||||||
"active_power",
|
"active_power",
|
||||||
],
|
],
|
||||||
"current": ["Current", "mdi:gauge", "local", "A", "current"],
|
"current": ["Current", "mdi:gauge", "local", "A", "current"],
|
||||||
"voltage": ["Voltage", "mdi:gauge", "local", UNIT_VOLT, "voltage"],
|
"voltage": ["Voltage", "mdi:gauge", "local", VOLT, "voltage"],
|
||||||
"active_cosfi": [
|
"active_cosfi": [
|
||||||
"Power Factor",
|
"Power Factor",
|
||||||
"mdi:gauge",
|
"mdi:gauge",
|
||||||
|
@ -74,7 +74,7 @@ SENSOR_TYPES = {
|
||||||
"Water Sensor Temperature",
|
"Water Sensor Temperature",
|
||||||
"mdi:temperature-celsius",
|
"mdi:temperature-celsius",
|
||||||
"water",
|
"water",
|
||||||
UNIT_DEGREE,
|
DEGREE,
|
||||||
"temperature",
|
"temperature",
|
||||||
],
|
],
|
||||||
"water_sensor_humidity": [
|
"water_sensor_humidity": [
|
||||||
|
|
|
@ -17,7 +17,7 @@ from homeassistant.const import (
|
||||||
TEMP_CELSIUS,
|
TEMP_CELSIUS,
|
||||||
TEMP_FAHRENHEIT,
|
TEMP_FAHRENHEIT,
|
||||||
UNIT_PERCENTAGE,
|
UNIT_PERCENTAGE,
|
||||||
UNIT_VOLT,
|
VOLT,
|
||||||
)
|
)
|
||||||
|
|
||||||
from . import SmartThingsEntity
|
from . import SmartThingsEntity
|
||||||
|
@ -234,7 +234,7 @@ CAPABILITY_TO_SENSORS = {
|
||||||
Map(Attribute.ultraviolet_index, "Ultraviolet Index", None, None)
|
Map(Attribute.ultraviolet_index, "Ultraviolet Index", None, None)
|
||||||
],
|
],
|
||||||
Capability.voltage_measurement: [
|
Capability.voltage_measurement: [
|
||||||
Map(Attribute.voltage, "Voltage Measurement", UNIT_VOLT, None)
|
Map(Attribute.voltage, "Voltage Measurement", VOLT, None)
|
||||||
],
|
],
|
||||||
Capability.washer_mode: [Map(Attribute.washer_mode, "Washer Mode", None, None)],
|
Capability.washer_mode: [Map(Attribute.washer_mode, "Washer Mode", None, None)],
|
||||||
Capability.washer_operating_state: [
|
Capability.washer_operating_state: [
|
||||||
|
|
|
@ -17,7 +17,7 @@ from homeassistant.const import (
|
||||||
POWER_WATT,
|
POWER_WATT,
|
||||||
TEMP_CELSIUS,
|
TEMP_CELSIUS,
|
||||||
TEMP_FAHRENHEIT,
|
TEMP_FAHRENHEIT,
|
||||||
UNIT_VOLT,
|
VOLT,
|
||||||
)
|
)
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.entity import Entity
|
from homeassistant.helpers.entity import Entity
|
||||||
|
@ -42,20 +42,8 @@ INVERTER_MODES = (
|
||||||
# Supported sensor types:
|
# Supported sensor types:
|
||||||
# Key: ['json_key', 'name', unit, icon, attribute name]
|
# Key: ['json_key', 'name', unit, icon, attribute name]
|
||||||
SENSOR_TYPES = {
|
SENSOR_TYPES = {
|
||||||
"current_AC_voltage": [
|
"current_AC_voltage": ["gridvoltage", "Grid Voltage", VOLT, "mdi:current-ac", None],
|
||||||
"gridvoltage",
|
"current_DC_voltage": ["dcvoltage", "DC Voltage", VOLT, "mdi:current-dc", None],
|
||||||
"Grid Voltage",
|
|
||||||
UNIT_VOLT,
|
|
||||||
"mdi:current-ac",
|
|
||||||
None,
|
|
||||||
],
|
|
||||||
"current_DC_voltage": [
|
|
||||||
"dcvoltage",
|
|
||||||
"DC Voltage",
|
|
||||||
UNIT_VOLT,
|
|
||||||
"mdi:current-dc",
|
|
||||||
None,
|
|
||||||
],
|
|
||||||
"current_frequency": [
|
"current_frequency": [
|
||||||
"gridfrequency",
|
"gridfrequency",
|
||||||
"Grid Frequency",
|
"Grid Frequency",
|
||||||
|
@ -136,7 +124,7 @@ SENSOR_TYPES = {
|
||||||
"optimizer_voltage": [
|
"optimizer_voltage": [
|
||||||
"optimizervoltage",
|
"optimizervoltage",
|
||||||
"Average Optimizer Voltage",
|
"Average Optimizer Voltage",
|
||||||
UNIT_VOLT,
|
VOLT,
|
||||||
"mdi:solar-panel",
|
"mdi:solar-panel",
|
||||||
None,
|
None,
|
||||||
],
|
],
|
||||||
|
|
|
@ -1,12 +1,7 @@
|
||||||
"""Constants for the Solar-Log integration."""
|
"""Constants for the Solar-Log integration."""
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
|
|
||||||
from homeassistant.const import (
|
from homeassistant.const import ENERGY_KILO_WATT_HOUR, POWER_WATT, UNIT_PERCENTAGE, VOLT
|
||||||
ENERGY_KILO_WATT_HOUR,
|
|
||||||
POWER_WATT,
|
|
||||||
UNIT_PERCENTAGE,
|
|
||||||
UNIT_VOLT,
|
|
||||||
)
|
|
||||||
|
|
||||||
DOMAIN = "solarlog"
|
DOMAIN = "solarlog"
|
||||||
|
|
||||||
|
@ -22,8 +17,8 @@ SENSOR_TYPES = {
|
||||||
"time": ["TIME", "last update", None, "mdi:calendar-clock"],
|
"time": ["TIME", "last update", None, "mdi:calendar-clock"],
|
||||||
"power_ac": ["powerAC", "power AC", POWER_WATT, "mdi:solar-power"],
|
"power_ac": ["powerAC", "power AC", POWER_WATT, "mdi:solar-power"],
|
||||||
"power_dc": ["powerDC", "power DC", POWER_WATT, "mdi:solar-power"],
|
"power_dc": ["powerDC", "power DC", POWER_WATT, "mdi:solar-power"],
|
||||||
"voltage_ac": ["voltageAC", "voltage AC", UNIT_VOLT, "mdi:flash"],
|
"voltage_ac": ["voltageAC", "voltage AC", VOLT, "mdi:flash"],
|
||||||
"voltage_dc": ["voltageDC", "voltage DC", UNIT_VOLT, "mdi:flash"],
|
"voltage_dc": ["voltageDC", "voltage DC", VOLT, "mdi:flash"],
|
||||||
"yield_day": ["yieldDAY", "yield day", ENERGY_KILO_WATT_HOUR, "mdi:solar-power"],
|
"yield_day": ["yieldDAY", "yield day", ENERGY_KILO_WATT_HOUR, "mdi:solar-power"],
|
||||||
"yield_yesterday": [
|
"yield_yesterday": [
|
||||||
"yieldYESTERDAY",
|
"yieldYESTERDAY",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
"""Reads vehicle status from StarLine API."""
|
"""Reads vehicle status from StarLine API."""
|
||||||
from homeassistant.components.sensor import DEVICE_CLASS_TEMPERATURE
|
from homeassistant.components.sensor import DEVICE_CLASS_TEMPERATURE
|
||||||
from homeassistant.const import TEMP_CELSIUS, UNIT_PERCENTAGE, UNIT_VOLT
|
from homeassistant.const import TEMP_CELSIUS, UNIT_PERCENTAGE, VOLT
|
||||||
from homeassistant.helpers.entity import Entity
|
from homeassistant.helpers.entity import Entity
|
||||||
from homeassistant.helpers.icon import icon_for_battery_level, icon_for_signal_level
|
from homeassistant.helpers.icon import icon_for_battery_level, icon_for_signal_level
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ from .const import DOMAIN
|
||||||
from .entity import StarlineEntity
|
from .entity import StarlineEntity
|
||||||
|
|
||||||
SENSOR_TYPES = {
|
SENSOR_TYPES = {
|
||||||
"battery": ["Battery", None, UNIT_VOLT, None],
|
"battery": ["Battery", None, VOLT, None],
|
||||||
"balance": ["Balance", None, None, "mdi:cash-multiple"],
|
"balance": ["Balance", None, None, "mdi:cash-multiple"],
|
||||||
"ctemp": ["Interior Temperature", DEVICE_CLASS_TEMPERATURE, TEMP_CELSIUS, None],
|
"ctemp": ["Interior Temperature", DEVICE_CLASS_TEMPERATURE, TEMP_CELSIUS, None],
|
||||||
"etemp": ["Engine Temperature", DEVICE_CLASS_TEMPERATURE, TEMP_CELSIUS, None],
|
"etemp": ["Engine Temperature", DEVICE_CLASS_TEMPERATURE, TEMP_CELSIUS, None],
|
||||||
|
|
|
@ -7,7 +7,7 @@ import voluptuous as vol
|
||||||
import xmltodict
|
import xmltodict
|
||||||
|
|
||||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||||
from homeassistant.const import CONF_HOST, CONF_NAME, CONF_PORT, POWER_WATT, UNIT_VOLT
|
from homeassistant.const import CONF_HOST, CONF_NAME, CONF_PORT, POWER_WATT, VOLT
|
||||||
from homeassistant.helpers import config_validation as cv
|
from homeassistant.helpers import config_validation as cv
|
||||||
from homeassistant.helpers.entity import Entity
|
from homeassistant.helpers.entity import Entity
|
||||||
from homeassistant.util import Throttle
|
from homeassistant.util import Throttle
|
||||||
|
@ -43,7 +43,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
dev = []
|
dev = []
|
||||||
for mtu in gateway.data:
|
for mtu in gateway.data:
|
||||||
dev.append(Ted5000Sensor(gateway, name, mtu, POWER_WATT))
|
dev.append(Ted5000Sensor(gateway, name, mtu, POWER_WATT))
|
||||||
dev.append(Ted5000Sensor(gateway, name, mtu, UNIT_VOLT))
|
dev.append(Ted5000Sensor(gateway, name, mtu, VOLT))
|
||||||
|
|
||||||
add_entities(dev)
|
add_entities(dev)
|
||||||
return True
|
return True
|
||||||
|
@ -54,7 +54,7 @@ class Ted5000Sensor(Entity):
|
||||||
|
|
||||||
def __init__(self, gateway, name, mtu, unit):
|
def __init__(self, gateway, name, mtu, unit):
|
||||||
"""Initialize the sensor."""
|
"""Initialize the sensor."""
|
||||||
units = {POWER_WATT: "power", UNIT_VOLT: "voltage"}
|
units = {POWER_WATT: "power", VOLT: "voltage"}
|
||||||
self._gateway = gateway
|
self._gateway = gateway
|
||||||
self._name = "{} mtu{} {}".format(name, mtu, units[unit])
|
self._name = "{} mtu{} {}".format(name, mtu, units[unit])
|
||||||
self._mtu = mtu
|
self._mtu = mtu
|
||||||
|
@ -108,4 +108,4 @@ class Ted5000Gateway:
|
||||||
power = int(doc["LiveData"]["Power"]["MTU%d" % mtu]["PowerNow"])
|
power = int(doc["LiveData"]["Power"]["MTU%d" % mtu]["PowerNow"])
|
||||||
voltage = int(doc["LiveData"]["Voltage"]["MTU%d" % mtu]["VoltageNow"])
|
voltage = int(doc["LiveData"]["Voltage"]["MTU%d" % mtu]["VoltageNow"])
|
||||||
|
|
||||||
self.data[mtu] = {POWER_WATT: power, UNIT_VOLT: voltage / 10}
|
self.data[mtu] = {POWER_WATT: power, VOLT: voltage / 10}
|
||||||
|
|
|
@ -11,7 +11,7 @@ from homeassistant.const import (
|
||||||
TEMP_CELSIUS,
|
TEMP_CELSIUS,
|
||||||
TIME_HOURS,
|
TIME_HOURS,
|
||||||
UNIT_PERCENTAGE,
|
UNIT_PERCENTAGE,
|
||||||
UNIT_UV_INDEX,
|
UV_INDEX,
|
||||||
)
|
)
|
||||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ SENSOR_TYPES = {
|
||||||
SENSOR_TYPE_WINDDIRECTION: ["Wind direction", "", "", None],
|
SENSOR_TYPE_WINDDIRECTION: ["Wind direction", "", "", None],
|
||||||
SENSOR_TYPE_WINDAVERAGE: ["Wind average", SPEED_METERS_PER_SECOND, "", None],
|
SENSOR_TYPE_WINDAVERAGE: ["Wind average", SPEED_METERS_PER_SECOND, "", None],
|
||||||
SENSOR_TYPE_WINDGUST: ["Wind gust", SPEED_METERS_PER_SECOND, "", None],
|
SENSOR_TYPE_WINDGUST: ["Wind gust", SPEED_METERS_PER_SECOND, "", None],
|
||||||
SENSOR_TYPE_UV: ["UV", UNIT_UV_INDEX, "", None],
|
SENSOR_TYPE_UV: ["UV", UV_INDEX, "", None],
|
||||||
SENSOR_TYPE_WATT: ["Power", POWER_WATT, "", None],
|
SENSOR_TYPE_WATT: ["Power", POWER_WATT, "", None],
|
||||||
SENSOR_TYPE_LUMINANCE: ["Luminance", "lx", None, DEVICE_CLASS_ILLUMINANCE],
|
SENSOR_TYPE_LUMINANCE: ["Luminance", "lx", None, DEVICE_CLASS_ILLUMINANCE],
|
||||||
SENSOR_TYPE_DEW_POINT: ["Dew Point", TEMP_CELSIUS, None, DEVICE_CLASS_TEMPERATURE],
|
SENSOR_TYPE_DEW_POINT: ["Dew Point", TEMP_CELSIUS, None, DEVICE_CLASS_TEMPERATURE],
|
||||||
|
|
|
@ -6,7 +6,7 @@ import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.http import HomeAssistantView
|
from homeassistant.components.http import HomeAssistantView
|
||||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||||
from homeassistant.const import CONF_EMAIL, CONF_NAME, UNIT_DEGREE
|
from homeassistant.const import CONF_EMAIL, CONF_NAME, DEGREE
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.entity import Entity
|
from homeassistant.helpers.entity import Entity
|
||||||
|
@ -91,7 +91,7 @@ class TorqueReceiveDataView(HomeAssistantView):
|
||||||
|
|
||||||
temp_unit = data[key]
|
temp_unit = data[key]
|
||||||
if "\\xC2\\xB0" in temp_unit:
|
if "\\xC2\\xB0" in temp_unit:
|
||||||
temp_unit = temp_unit.replace("\\xC2\\xB0", UNIT_DEGREE)
|
temp_unit = temp_unit.replace("\\xC2\\xB0", DEGREE)
|
||||||
|
|
||||||
units[pid] = temp_unit
|
units[pid] = temp_unit
|
||||||
elif is_value:
|
elif is_value:
|
||||||
|
|
|
@ -14,11 +14,11 @@ from homeassistant.const import (
|
||||||
CONF_API_KEY,
|
CONF_API_KEY,
|
||||||
CONF_MONITORED_CONDITIONS,
|
CONF_MONITORED_CONDITIONS,
|
||||||
CONF_NAME,
|
CONF_NAME,
|
||||||
|
DEGREE,
|
||||||
DEVICE_CLASS_HUMIDITY,
|
DEVICE_CLASS_HUMIDITY,
|
||||||
DEVICE_CLASS_TEMPERATURE,
|
DEVICE_CLASS_TEMPERATURE,
|
||||||
SPEED_METERS_PER_SECOND,
|
SPEED_METERS_PER_SECOND,
|
||||||
TEMP_CELSIUS,
|
TEMP_CELSIUS,
|
||||||
UNIT_DEGREE,
|
|
||||||
UNIT_PERCENTAGE,
|
UNIT_PERCENTAGE,
|
||||||
)
|
)
|
||||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||||
|
@ -62,7 +62,7 @@ SENSOR_TYPES = {
|
||||||
],
|
],
|
||||||
"wind_direction": [
|
"wind_direction": [
|
||||||
"Wind direction",
|
"Wind direction",
|
||||||
UNIT_DEGREE,
|
DEGREE,
|
||||||
"winddirection",
|
"winddirection",
|
||||||
"mdi:flag-triangle",
|
"mdi:flag-triangle",
|
||||||
None,
|
None,
|
||||||
|
|
|
@ -3,7 +3,7 @@ import logging
|
||||||
|
|
||||||
import pywink
|
import pywink
|
||||||
|
|
||||||
from homeassistant.const import TEMP_CELSIUS, UNIT_DEGREE
|
from homeassistant.const import DEGREE, TEMP_CELSIUS
|
||||||
|
|
||||||
from . import DOMAIN, WinkDevice
|
from . import DOMAIN, WinkDevice
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ class WinkSensorDevice(WinkDevice):
|
||||||
"""Initialize the Wink device."""
|
"""Initialize the Wink device."""
|
||||||
super().__init__(wink, hass)
|
super().__init__(wink, hass)
|
||||||
self.capability = self.wink.capability()
|
self.capability = self.wink.capability()
|
||||||
if self.wink.unit() == UNIT_DEGREE:
|
if self.wink.unit() == DEGREE:
|
||||||
self._unit_of_measurement = TEMP_CELSIUS
|
self._unit_of_measurement = TEMP_CELSIUS
|
||||||
else:
|
else:
|
||||||
self._unit_of_measurement = self.wink.unit()
|
self._unit_of_measurement = self.wink.unit()
|
||||||
|
|
|
@ -12,7 +12,7 @@ from homeassistant.const import (
|
||||||
CONF_PASSWORD,
|
CONF_PASSWORD,
|
||||||
CONF_USERNAME,
|
CONF_USERNAME,
|
||||||
UNIT_PERCENTAGE,
|
UNIT_PERCENTAGE,
|
||||||
UNIT_VOLT,
|
VOLT,
|
||||||
)
|
)
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.dispatcher import dispatcher_send
|
from homeassistant.helpers.dispatcher import dispatcher_send
|
||||||
|
@ -281,7 +281,7 @@ class WirelessTagBaseSensor(Entity):
|
||||||
"""Return the state attributes."""
|
"""Return the state attributes."""
|
||||||
return {
|
return {
|
||||||
ATTR_BATTERY_LEVEL: int(self._tag.battery_remaining * 100),
|
ATTR_BATTERY_LEVEL: int(self._tag.battery_remaining * 100),
|
||||||
ATTR_VOLTAGE: f"{self._tag.battery_volts:.2f}{UNIT_VOLT}",
|
ATTR_VOLTAGE: f"{self._tag.battery_volts:.2f}{VOLT}",
|
||||||
ATTR_TAG_SIGNAL_STRENGTH: f"{self._tag.signal_strength}dBm",
|
ATTR_TAG_SIGNAL_STRENGTH: f"{self._tag.signal_strength}dBm",
|
||||||
ATTR_TAG_OUT_OF_RANGE: not self._tag.is_in_range,
|
ATTR_TAG_OUT_OF_RANGE: not self._tag.is_in_range,
|
||||||
ATTR_TAG_POWER_CONSUMPTION: f"{self._tag.power_consumption:.2f}{UNIT_PERCENTAGE}",
|
ATTR_TAG_POWER_CONSUMPTION: f"{self._tag.power_consumption:.2f}{UNIT_PERCENTAGE}",
|
||||||
|
|
|
@ -17,6 +17,7 @@ from homeassistant.const import (
|
||||||
CONF_LATITUDE,
|
CONF_LATITUDE,
|
||||||
CONF_LONGITUDE,
|
CONF_LONGITUDE,
|
||||||
CONF_MONITORED_CONDITIONS,
|
CONF_MONITORED_CONDITIONS,
|
||||||
|
DEGREE,
|
||||||
IRRADIATION_WATTS_PER_SQUARE_METER,
|
IRRADIATION_WATTS_PER_SQUARE_METER,
|
||||||
LENGTH_FEET,
|
LENGTH_FEET,
|
||||||
LENGTH_INCHES,
|
LENGTH_INCHES,
|
||||||
|
@ -26,7 +27,6 @@ from homeassistant.const import (
|
||||||
SPEED_MILES_PER_HOUR,
|
SPEED_MILES_PER_HOUR,
|
||||||
TEMP_CELSIUS,
|
TEMP_CELSIUS,
|
||||||
TEMP_FAHRENHEIT,
|
TEMP_FAHRENHEIT,
|
||||||
UNIT_DEGREE,
|
|
||||||
UNIT_PERCENTAGE,
|
UNIT_PERCENTAGE,
|
||||||
)
|
)
|
||||||
from homeassistant.exceptions import PlatformNotReady
|
from homeassistant.exceptions import PlatformNotReady
|
||||||
|
@ -457,7 +457,7 @@ SENSOR_TYPES = {
|
||||||
),
|
),
|
||||||
"weather": WUCurrentConditionsSensorConfig("Weather Summary", "weather", None),
|
"weather": WUCurrentConditionsSensorConfig("Weather Summary", "weather", None),
|
||||||
"wind_degrees": WUCurrentConditionsSensorConfig(
|
"wind_degrees": WUCurrentConditionsSensorConfig(
|
||||||
"Wind Degrees", "wind_degrees", "mdi:weather-windy", UNIT_DEGREE
|
"Wind Degrees", "wind_degrees", "mdi:weather-windy", DEGREE
|
||||||
),
|
),
|
||||||
"wind_dir": WUCurrentConditionsSensorConfig(
|
"wind_dir": WUCurrentConditionsSensorConfig(
|
||||||
"Wind Direction", "wind_dir", "mdi:weather-windy"
|
"Wind Direction", "wind_dir", "mdi:weather-windy"
|
||||||
|
|
|
@ -17,6 +17,7 @@ from homeassistant.const import (
|
||||||
CONF_LONGITUDE,
|
CONF_LONGITUDE,
|
||||||
CONF_MONITORED_CONDITIONS,
|
CONF_MONITORED_CONDITIONS,
|
||||||
CONF_NAME,
|
CONF_NAME,
|
||||||
|
DEGREE,
|
||||||
DEVICE_CLASS_HUMIDITY,
|
DEVICE_CLASS_HUMIDITY,
|
||||||
DEVICE_CLASS_PRESSURE,
|
DEVICE_CLASS_PRESSURE,
|
||||||
DEVICE_CLASS_TEMPERATURE,
|
DEVICE_CLASS_TEMPERATURE,
|
||||||
|
@ -24,7 +25,6 @@ from homeassistant.const import (
|
||||||
PRESSURE_HPA,
|
PRESSURE_HPA,
|
||||||
SPEED_METERS_PER_SECOND,
|
SPEED_METERS_PER_SECOND,
|
||||||
TEMP_CELSIUS,
|
TEMP_CELSIUS,
|
||||||
UNIT_DEGREE,
|
|
||||||
UNIT_PERCENTAGE,
|
UNIT_PERCENTAGE,
|
||||||
)
|
)
|
||||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||||
|
@ -48,7 +48,7 @@ SENSOR_TYPES = {
|
||||||
"windSpeed": ["Wind speed", SPEED_METERS_PER_SECOND, None],
|
"windSpeed": ["Wind speed", SPEED_METERS_PER_SECOND, None],
|
||||||
"windGust": ["Wind gust", SPEED_METERS_PER_SECOND, None],
|
"windGust": ["Wind gust", SPEED_METERS_PER_SECOND, None],
|
||||||
"pressure": ["Pressure", PRESSURE_HPA, DEVICE_CLASS_PRESSURE],
|
"pressure": ["Pressure", PRESSURE_HPA, DEVICE_CLASS_PRESSURE],
|
||||||
"windDirection": ["Wind direction", UNIT_DEGREE, None],
|
"windDirection": ["Wind direction", DEGREE, None],
|
||||||
"humidity": ["Humidity", UNIT_PERCENTAGE, DEVICE_CLASS_HUMIDITY],
|
"humidity": ["Humidity", UNIT_PERCENTAGE, DEVICE_CLASS_HUMIDITY],
|
||||||
"fog": ["Fog", UNIT_PERCENTAGE, None],
|
"fog": ["Fog", UNIT_PERCENTAGE, None],
|
||||||
"cloudiness": ["Cloudiness", UNIT_PERCENTAGE, None],
|
"cloudiness": ["Cloudiness", UNIT_PERCENTAGE, None],
|
||||||
|
|
|
@ -17,10 +17,10 @@ from homeassistant.const import (
|
||||||
CONF_LONGITUDE,
|
CONF_LONGITUDE,
|
||||||
CONF_MONITORED_CONDITIONS,
|
CONF_MONITORED_CONDITIONS,
|
||||||
CONF_NAME,
|
CONF_NAME,
|
||||||
|
DEGREE,
|
||||||
LENGTH_METERS,
|
LENGTH_METERS,
|
||||||
SPEED_KILOMETERS_PER_HOUR,
|
SPEED_KILOMETERS_PER_HOUR,
|
||||||
TEMP_CELSIUS,
|
TEMP_CELSIUS,
|
||||||
UNIT_DEGREE,
|
|
||||||
UNIT_PERCENTAGE,
|
UNIT_PERCENTAGE,
|
||||||
__version__,
|
__version__,
|
||||||
)
|
)
|
||||||
|
@ -50,14 +50,14 @@ SENSOR_TYPES = {
|
||||||
f"WG {SPEED_KILOMETERS_PER_HOUR}",
|
f"WG {SPEED_KILOMETERS_PER_HOUR}",
|
||||||
float,
|
float,
|
||||||
),
|
),
|
||||||
"wind_bearing": ("Wind Bearing", UNIT_DEGREE, f"WR {UNIT_DEGREE}", int),
|
"wind_bearing": ("Wind Bearing", DEGREE, f"WR {DEGREE}", int),
|
||||||
"wind_max_speed": (
|
"wind_max_speed": (
|
||||||
"Top Wind Speed",
|
"Top Wind Speed",
|
||||||
SPEED_KILOMETERS_PER_HOUR,
|
SPEED_KILOMETERS_PER_HOUR,
|
||||||
f"WSG {SPEED_KILOMETERS_PER_HOUR}",
|
f"WSG {SPEED_KILOMETERS_PER_HOUR}",
|
||||||
float,
|
float,
|
||||||
),
|
),
|
||||||
"wind_max_bearing": ("Top Wind Bearing", UNIT_DEGREE, f"WSR {UNIT_DEGREE}", int),
|
"wind_max_bearing": ("Top Wind Bearing", DEGREE, f"WSR {DEGREE}", int),
|
||||||
"sun_last_hour": ("Sun Last Hour", UNIT_PERCENTAGE, f"SO {UNIT_PERCENTAGE}", int),
|
"sun_last_hour": ("Sun Last Hour", UNIT_PERCENTAGE, f"SO {UNIT_PERCENTAGE}", int),
|
||||||
"temperature": ("Temperature", TEMP_CELSIUS, f"T {TEMP_CELSIUS}", float),
|
"temperature": ("Temperature", TEMP_CELSIUS, f"T {TEMP_CELSIUS}", float),
|
||||||
"precipitation": ("Precipitation", "l/m²", "N l/m²", float),
|
"precipitation": ("Precipitation", "l/m²", "N l/m²", float),
|
||||||
|
|
|
@ -346,19 +346,19 @@ ATTR_TEMPERATURE = "temperature"
|
||||||
POWER_WATT = "W"
|
POWER_WATT = "W"
|
||||||
|
|
||||||
# Voltage units
|
# Voltage units
|
||||||
UNIT_VOLT = "V"
|
VOLT = "V"
|
||||||
|
|
||||||
# Energy units
|
# Energy units
|
||||||
ENERGY_WATT_HOUR = f"{POWER_WATT}h"
|
ENERGY_WATT_HOUR = f"{POWER_WATT}h"
|
||||||
ENERGY_KILO_WATT_HOUR = f"k{ENERGY_WATT_HOUR}"
|
ENERGY_KILO_WATT_HOUR = f"k{ENERGY_WATT_HOUR}"
|
||||||
|
|
||||||
# Degree units
|
# Degree units
|
||||||
UNIT_DEGREE = "°"
|
DEGREE = "°"
|
||||||
|
|
||||||
# Temperature units
|
# Temperature units
|
||||||
TEMP_CELSIUS = f"{UNIT_DEGREE}C"
|
TEMP_CELSIUS = f"{DEGREE}C"
|
||||||
TEMP_FAHRENHEIT = f"{UNIT_DEGREE}F"
|
TEMP_FAHRENHEIT = f"{DEGREE}F"
|
||||||
TEMP_KELVIN = f"{UNIT_DEGREE}K"
|
TEMP_KELVIN = f"{DEGREE}K"
|
||||||
|
|
||||||
# Time units
|
# Time units
|
||||||
TIME_MICROSECONDS = "μs"
|
TIME_MICROSECONDS = "μs"
|
||||||
|
@ -414,10 +414,10 @@ MASS_OUNCES: str = "oz"
|
||||||
MASS_POUNDS: str = "lb"
|
MASS_POUNDS: str = "lb"
|
||||||
|
|
||||||
# Conductivity units
|
# Conductivity units
|
||||||
UNIT_CONDUCTIVITY: str = f"µS/{LENGTH_CENTIMETERS}"
|
CONDUCTIVITY: str = f"µS/{LENGTH_CENTIMETERS}"
|
||||||
|
|
||||||
# UV Index units
|
# UV Index units
|
||||||
UNIT_UV_INDEX: str = "UV index"
|
UV_INDEX: str = "UV index"
|
||||||
|
|
||||||
# Percentage units
|
# Percentage units
|
||||||
UNIT_PERCENTAGE = "%"
|
UNIT_PERCENTAGE = "%"
|
||||||
|
|
|
@ -9,11 +9,11 @@ from homeassistant.components import recorder
|
||||||
import homeassistant.components.plant as plant
|
import homeassistant.components.plant as plant
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
ATTR_UNIT_OF_MEASUREMENT,
|
ATTR_UNIT_OF_MEASUREMENT,
|
||||||
|
CONDUCTIVITY,
|
||||||
STATE_OK,
|
STATE_OK,
|
||||||
STATE_PROBLEM,
|
STATE_PROBLEM,
|
||||||
STATE_UNAVAILABLE,
|
STATE_UNAVAILABLE,
|
||||||
STATE_UNKNOWN,
|
STATE_UNKNOWN,
|
||||||
UNIT_CONDUCTIVITY,
|
|
||||||
)
|
)
|
||||||
from homeassistant.setup import setup_component
|
from homeassistant.setup import setup_component
|
||||||
|
|
||||||
|
@ -95,7 +95,7 @@ class TestPlant(unittest.TestCase):
|
||||||
def test_initial_states(self):
|
def test_initial_states(self):
|
||||||
"""Test plant initialises attributes if sensor already exists."""
|
"""Test plant initialises attributes if sensor already exists."""
|
||||||
self.hass.states.set(
|
self.hass.states.set(
|
||||||
MOISTURE_ENTITY, 5, {ATTR_UNIT_OF_MEASUREMENT: UNIT_CONDUCTIVITY}
|
MOISTURE_ENTITY, 5, {ATTR_UNIT_OF_MEASUREMENT: CONDUCTIVITY}
|
||||||
)
|
)
|
||||||
plant_name = "some_plant"
|
plant_name = "some_plant"
|
||||||
assert setup_component(
|
assert setup_component(
|
||||||
|
@ -115,7 +115,7 @@ class TestPlant(unittest.TestCase):
|
||||||
self.hass, plant.DOMAIN, {plant.DOMAIN: {plant_name: GOOD_CONFIG}}
|
self.hass, plant.DOMAIN, {plant.DOMAIN: {plant_name: GOOD_CONFIG}}
|
||||||
)
|
)
|
||||||
self.hass.states.set(
|
self.hass.states.set(
|
||||||
MOISTURE_ENTITY, 5, {ATTR_UNIT_OF_MEASUREMENT: UNIT_CONDUCTIVITY}
|
MOISTURE_ENTITY, 5, {ATTR_UNIT_OF_MEASUREMENT: CONDUCTIVITY}
|
||||||
)
|
)
|
||||||
self.hass.block_till_done()
|
self.hass.block_till_done()
|
||||||
state = self.hass.states.get(f"plant.{plant_name}")
|
state = self.hass.states.get(f"plant.{plant_name}")
|
||||||
|
@ -132,9 +132,7 @@ class TestPlant(unittest.TestCase):
|
||||||
self.hass, plant.DOMAIN, {plant.DOMAIN: {plant_name: GOOD_CONFIG}}
|
self.hass, plant.DOMAIN, {plant.DOMAIN: {plant_name: GOOD_CONFIG}}
|
||||||
)
|
)
|
||||||
self.hass.states.set(
|
self.hass.states.set(
|
||||||
MOISTURE_ENTITY,
|
MOISTURE_ENTITY, STATE_UNAVAILABLE, {ATTR_UNIT_OF_MEASUREMENT: CONDUCTIVITY}
|
||||||
STATE_UNAVAILABLE,
|
|
||||||
{ATTR_UNIT_OF_MEASUREMENT: UNIT_CONDUCTIVITY},
|
|
||||||
)
|
)
|
||||||
self.hass.block_till_done()
|
self.hass.block_till_done()
|
||||||
state = self.hass.states.get(f"plant.{plant_name}")
|
state = self.hass.states.get(f"plant.{plant_name}")
|
||||||
|
@ -151,16 +149,14 @@ class TestPlant(unittest.TestCase):
|
||||||
self.hass, plant.DOMAIN, {plant.DOMAIN: {plant_name: GOOD_CONFIG}}
|
self.hass, plant.DOMAIN, {plant.DOMAIN: {plant_name: GOOD_CONFIG}}
|
||||||
)
|
)
|
||||||
self.hass.states.set(
|
self.hass.states.set(
|
||||||
MOISTURE_ENTITY, 42, {ATTR_UNIT_OF_MEASUREMENT: UNIT_CONDUCTIVITY}
|
MOISTURE_ENTITY, 42, {ATTR_UNIT_OF_MEASUREMENT: CONDUCTIVITY}
|
||||||
)
|
)
|
||||||
self.hass.block_till_done()
|
self.hass.block_till_done()
|
||||||
state = self.hass.states.get(f"plant.{plant_name}")
|
state = self.hass.states.get(f"plant.{plant_name}")
|
||||||
assert state.state == STATE_OK
|
assert state.state == STATE_OK
|
||||||
assert state.attributes[plant.READING_MOISTURE] == 42
|
assert state.attributes[plant.READING_MOISTURE] == 42
|
||||||
self.hass.states.set(
|
self.hass.states.set(
|
||||||
MOISTURE_ENTITY,
|
MOISTURE_ENTITY, STATE_UNAVAILABLE, {ATTR_UNIT_OF_MEASUREMENT: CONDUCTIVITY}
|
||||||
STATE_UNAVAILABLE,
|
|
||||||
{ATTR_UNIT_OF_MEASUREMENT: UNIT_CONDUCTIVITY},
|
|
||||||
)
|
)
|
||||||
self.hass.block_till_done()
|
self.hass.block_till_done()
|
||||||
state = self.hass.states.get(f"plant.{plant_name}")
|
state = self.hass.states.get(f"plant.{plant_name}")
|
||||||
|
|
|
@ -7,9 +7,9 @@ from homeassistant.components.demo.sensor import DemoSensor
|
||||||
import homeassistant.components.prometheus as prometheus
|
import homeassistant.components.prometheus as prometheus
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
|
CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
|
||||||
|
DEGREE,
|
||||||
DEVICE_CLASS_POWER,
|
DEVICE_CLASS_POWER,
|
||||||
ENERGY_KILO_WATT_HOUR,
|
ENERGY_KILO_WATT_HOUR,
|
||||||
UNIT_DEGREE,
|
|
||||||
)
|
)
|
||||||
from homeassistant.setup import async_setup_component
|
from homeassistant.setup import async_setup_component
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ async def prometheus_client(loop, hass, hass_client):
|
||||||
sensor3.entity_id = "sensor.electricity_price"
|
sensor3.entity_id = "sensor.electricity_price"
|
||||||
await sensor3.async_update_ha_state()
|
await sensor3.async_update_ha_state()
|
||||||
|
|
||||||
sensor4 = DemoSensor(None, "Wind Direction", 25, None, UNIT_DEGREE, None)
|
sensor4 = DemoSensor(None, "Wind Direction", 25, None, DEGREE, None)
|
||||||
sensor4.hass = hass
|
sensor4.hass = hass
|
||||||
sensor4.entity_id = "sensor.wind_direction"
|
sensor4.entity_id = "sensor.wind_direction"
|
||||||
await sensor4.async_update_ha_state()
|
await sensor4.async_update_ha_state()
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from homeassistant.components.sensor import DOMAIN
|
from homeassistant.components.sensor import DOMAIN
|
||||||
from homeassistant.const import UNIT_VOLT
|
from homeassistant.const import VOLT
|
||||||
from homeassistant.setup import async_setup_component
|
from homeassistant.setup import async_setup_component
|
||||||
|
|
||||||
from tests.common import assert_setup_component
|
from tests.common import assert_setup_component
|
||||||
|
@ -12,7 +12,7 @@ BASE_CFG = {
|
||||||
"platform": "sma",
|
"platform": "sma",
|
||||||
"host": "1.1.1.1",
|
"host": "1.1.1.1",
|
||||||
"password": "",
|
"password": "",
|
||||||
"custom": {"my_sensor": {"key": "1234567890123", "unit": UNIT_VOLT}},
|
"custom": {"my_sensor": {"key": "1234567890123", "unit": VOLT}},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ from datetime import datetime
|
||||||
from unittest.mock import patch
|
from unittest.mock import patch
|
||||||
|
|
||||||
from homeassistant.bootstrap import async_setup_component
|
from homeassistant.bootstrap import async_setup_component
|
||||||
from homeassistant.const import SPEED_METERS_PER_SECOND, UNIT_DEGREE, UNIT_PERCENTAGE
|
from homeassistant.const import DEGREE, SPEED_METERS_PER_SECOND, UNIT_PERCENTAGE
|
||||||
import homeassistant.util.dt as dt_util
|
import homeassistant.util.dt as dt_util
|
||||||
|
|
||||||
from tests.common import assert_setup_component, load_fixture
|
from tests.common import assert_setup_component, load_fixture
|
||||||
|
@ -59,7 +59,7 @@ async def test_custom_setup(hass, aioclient_mock):
|
||||||
assert state.state == "1009.3"
|
assert state.state == "1009.3"
|
||||||
|
|
||||||
state = hass.states.get("sensor.yr_wind_direction")
|
state = hass.states.get("sensor.yr_wind_direction")
|
||||||
assert state.attributes.get("unit_of_measurement") == UNIT_DEGREE
|
assert state.attributes.get("unit_of_measurement") == DEGREE
|
||||||
assert state.state == "103.6"
|
assert state.state == "103.6"
|
||||||
|
|
||||||
state = hass.states.get("sensor.yr_humidity")
|
state = hass.states.get("sensor.yr_humidity")
|
||||||
|
@ -105,7 +105,7 @@ async def test_forecast_setup(hass, aioclient_mock):
|
||||||
assert state.state == "1008.3"
|
assert state.state == "1008.3"
|
||||||
|
|
||||||
state = hass.states.get("sensor.yr_wind_direction")
|
state = hass.states.get("sensor.yr_wind_direction")
|
||||||
assert state.attributes.get("unit_of_measurement") == UNIT_DEGREE
|
assert state.attributes.get("unit_of_measurement") == DEGREE
|
||||||
assert state.state == "148.9"
|
assert state.state == "148.9"
|
||||||
|
|
||||||
state = hass.states.get("sensor.yr_humidity")
|
state = hass.states.get("sensor.yr_humidity")
|
||||||
|
|
Loading…
Reference in New Issue