Use HA constants for Rfxtrx units (#40562)
* Add more units and device classes * Battery level is a value beteen 0 and 9 where 9 indicate full Actual 0 battery can't occur since since then we would get to signal * Adjust tests * Add wind direction and adjust rain rate * Adjust data types to be None rather than empty string * Set counter values to count unit * Forgotten unit
This commit is contained in:
1 parent
b6aa29012e
commit
0fbeb3bf7b
3 files changed
+53
-33
No files matched your search
@@ -18,11 +18,19 @@ from homeassistant.const import (
|
||||
CONF_DEVICES,
|
||||
CONF_HOST,
|
||||
CONF_PORT,
|
||||
DEGREE,
|
||||
ELECTRICAL_CURRENT_AMPERE,
|
||||
ENERGY_KILO_WATT_HOUR,
|
||||
EVENT_HOMEASSISTANT_STOP,
|
||||
LENGTH_MILLIMETERS,
|
||||
PERCENTAGE,
|
||||
POWER_WATT,
|
||||
PRESSURE_HPA,
|
||||
SPEED_METERS_PER_SECOND,
|
||||
TEMP_CELSIUS,
|
||||
TIME_HOURS,
|
||||
UV_INDEX,
|
||||
VOLT,
|
||||
)
|
||||
from homeassistant.core import callback
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
@@ -52,30 +60,28 @@ DATA_TYPES = OrderedDict(
|
||||
("Temperature", TEMP_CELSIUS),
|
||||
("Temperature2", TEMP_CELSIUS),
|
||||
("Humidity", PERCENTAGE),
|
||||
("Barometer", ""),
|
||||
("Wind direction", ""),
|
||||
("Rain rate", ""),
|
||||
("Barometer", PRESSURE_HPA),
|
||||
("Wind direction", DEGREE),
|
||||
("Rain rate", f"{LENGTH_MILLIMETERS}/{TIME_HOURS}"),
|
||||
("Energy usage", POWER_WATT),
|
||||
("Total usage", POWER_WATT),
|
||||
("Sound", ""),
|
||||
("Sensor Status", ""),
|
||||
("Counter value", ""),
|
||||
("Total usage", ENERGY_KILO_WATT_HOUR),
|
||||
("Sound", None),
|
||||
("Sensor Status", None),
|
||||
("Counter value", "count"),
|
||||
("UV", UV_INDEX),
|
||||
("Humidity status", ""),
|
||||
("Forecast", ""),
|
||||
("Forecast numeric", ""),
|
||||
("Rain total", ""),
|
||||
("Wind average speed", ""),
|
||||
("Wind gust", ""),
|
||||
("Chill", ""),
|
||||
("Total usage", ""),
|
||||
("Count", ""),
|
||||
("Current Ch. 1", ""),
|
||||
("Current Ch. 2", ""),
|
||||
("Current Ch. 3", ""),
|
||||
("Energy usage", ""),
|
||||
("Voltage", ""),
|
||||
("Current", ""),
|
||||
("Humidity status", None),
|
||||
("Forecast", None),
|
||||
("Forecast numeric", None),
|
||||
("Rain total", LENGTH_MILLIMETERS),
|
||||
("Wind average speed", SPEED_METERS_PER_SECOND),
|
||||
("Wind gust", SPEED_METERS_PER_SECOND),
|
||||
("Chill", TEMP_CELSIUS),
|
||||
("Count", "count"),
|
||||
("Current Ch. 1", ELECTRICAL_CURRENT_AMPERE),
|
||||
("Current Ch. 2", ELECTRICAL_CURRENT_AMPERE),
|
||||
("Current Ch. 3", ELECTRICAL_CURRENT_AMPERE),
|
||||
("Voltage", VOLT),
|
||||
("Current", ELECTRICAL_CURRENT_AMPERE),
|
||||
("Battery numeric", PERCENTAGE),
|
||||
("Rssi numeric", "dBm"),
|
||||
]
|
||||
|
||||
Reference in new issue
Block a user