1
mirror of https://github.com/home-assistant/core synced 2024-08-02 23:40:32 +02:00

Add more sensor types for airthings devices (#56706)

* add additional sensor types for airthings devices

* remove "out of ten" unit

* change unit on rssi

* remove device class for light

* disable by default
This commit is contained in:
Fredrik Oterholt 2021-09-27 13:27:02 +02:00 committed by GitHub
parent 4ce7166afd
commit 4d433e18ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -11,15 +11,20 @@ from homeassistant.components.sensor import (
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import (
CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
CONCENTRATION_PARTS_PER_BILLION,
CONCENTRATION_PARTS_PER_MILLION,
DEVICE_CLASS_BATTERY,
DEVICE_CLASS_CO2,
DEVICE_CLASS_HUMIDITY,
DEVICE_CLASS_PM1,
DEVICE_CLASS_PM25,
DEVICE_CLASS_PRESSURE,
DEVICE_CLASS_SIGNAL_STRENGTH,
DEVICE_CLASS_TEMPERATURE,
PERCENTAGE,
PRESSURE_MBAR,
SIGNAL_STRENGTH_DECIBELS,
TEMP_CELSIUS,
)
from homeassistant.core import HomeAssistant
@ -72,6 +77,38 @@ SENSORS: dict[str, SensorEntityDescription] = {
native_unit_of_measurement=CONCENTRATION_PARTS_PER_BILLION,
name="VOC",
),
"light": SensorEntityDescription(
key="light",
native_unit_of_measurement=PERCENTAGE,
name="Light",
),
"virusRisk": SensorEntityDescription(
key="virusRisk",
name="Virus Risk",
),
"mold": SensorEntityDescription(
key="mold",
name="Mold",
),
"rssi": SensorEntityDescription(
key="rssi",
native_unit_of_measurement=SIGNAL_STRENGTH_DECIBELS,
device_class=DEVICE_CLASS_SIGNAL_STRENGTH,
name="RSSI",
entity_registry_enabled_default=False,
),
"pm1": SensorEntityDescription(
key="pm1",
native_unit_of_measurement=CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
device_class=DEVICE_CLASS_PM1,
name="PM1",
),
"pm25": SensorEntityDescription(
key="pm25",
native_unit_of_measurement=CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
device_class=DEVICE_CLASS_PM25,
name="PM25",
),
}