Add HCHO / VOC air-quality sensors (T9 module)
Support the WSLink t9 air-quality module: - t9hcho (formaldehyde, ppb), - t9voclv (VOC level 1-5 -> ENUM state) - t9bat (0-5 battery -> percentage). The t9hcho/t9voclv/t9bat values are dropped when t9cn reports the module as disconnected, so no empty entities are created. - const: HCHO/VOC/T9_BATTERY keys, VOCLevel enum + VOC_LEVEL_MAP, BATTERY_NON_BINARY, CONNECTION_GATED_SENSORS, REMAP_WSLINK_ITEMS entries - utils: voc_level_to_text(), battery_5step_to_pct(), connection gating - sensors_wslink: HCHO / VOC / T9_BATTERY entity descriptions - translations (en, cs): hcho, voc (+ states), t9_battery - tests: tests/conftest.py + tests/test_t9_air_quality.pyecowitt_support
parent
c71d1b33b5
commit
7bba644bec
|
|
@ -83,6 +83,10 @@ CH8_BATTERY: Final = "ch8_battery"
|
||||||
HEAT_INDEX: Final = "heat_index"
|
HEAT_INDEX: Final = "heat_index"
|
||||||
CHILL_INDEX: Final = "chill_index"
|
CHILL_INDEX: Final = "chill_index"
|
||||||
WBGT_TEMP: Final = "wbgt_temp"
|
WBGT_TEMP: Final = "wbgt_temp"
|
||||||
|
HCHO: Final = "hcho"
|
||||||
|
VOC: Final = "voc"
|
||||||
|
T9_BATTERY: Final = "t9_battery" # T9 sensors are HCHO and VOC
|
||||||
|
T9_CONN: Final = "t9_conn"
|
||||||
|
|
||||||
|
|
||||||
# Health specific constants
|
# Health specific constants
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,8 @@ from homeassistant.helpers.translation import async_get_translations
|
||||||
|
|
||||||
from .const import (
|
from .const import (
|
||||||
AZIMUT,
|
AZIMUT,
|
||||||
|
CONNECTION_GATED_SENSORS,
|
||||||
|
DATABASE_PATH,
|
||||||
DEV_DBG,
|
DEV_DBG,
|
||||||
OUTSIDE_HUMIDITY,
|
OUTSIDE_HUMIDITY,
|
||||||
OUTSIDE_TEMP,
|
OUTSIDE_TEMP,
|
||||||
|
|
@ -92,12 +94,7 @@ async def translated_notification(
|
||||||
persistent_notification.async_create(hass, message, _translations[localize_title], notification_id)
|
persistent_notification.async_create(hass, message, _translations[localize_title], notification_id)
|
||||||
|
|
||||||
|
|
||||||
async def update_options(
|
async def update_options(hass: HomeAssistant, entry: ConfigEntry, update_key, update_value) -> bool:
|
||||||
hass: HomeAssistant,
|
|
||||||
entry: ConfigEntry,
|
|
||||||
update_key: str,
|
|
||||||
update_value: str | list[str] | bool,
|
|
||||||
) -> bool:
|
|
||||||
"""Update config.options entry."""
|
"""Update config.options entry."""
|
||||||
conf = {**entry.options}
|
conf = {**entry.options}
|
||||||
conf[update_key] = update_value
|
conf[update_key] = update_value
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue