Add new unit constants (#53258)

* Add new unit constant - MHz

* Add new unit constants - precipitation (in, in/h)
This commit is contained in:
Marc Mueller 2021-07-21 20:14:47 +02:00 committed by GitHub
parent ba00c786b0
commit fd2f15b7c7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 27 additions and 11 deletions

View file

@ -7,6 +7,7 @@ from homeassistant.components.sensor import SensorEntity
from homeassistant.const import (
DEGREE,
DEVICE_CLASS_TEMPERATURE,
PRECIPITATION_INCHES,
TEMP_CELSIUS,
TEMP_FAHRENHEIT,
)
@ -44,7 +45,11 @@ def discover_sensors(topic, payload):
if domain == "rain":
if len(parts) >= 3 and parts[2] == "today":
return ArwnSensor(
topic, "Rain Since Midnight", "since_midnight", "in", "mdi:water"
topic,
"Rain Since Midnight",
"since_midnight",
PRECIPITATION_INCHES,
"mdi:water",
)
return (
ArwnSensor(topic + "/total", "Total Rainfall", "total", unit, "mdi:water"),