Add volatile organic compounds to homekit_controller (#55093)
This commit is contained in:
parent
4ef376a971
commit
0065bbc56d
3 changed files with 71 additions and 4 deletions
|
@ -2,6 +2,7 @@
|
|||
from aiohomekit.model.characteristics import CharacteristicsTypes
|
||||
from aiohomekit.model.services import ServicesTypes
|
||||
|
||||
from homeassistant.const import CONCENTRATION_MICROGRAMS_PER_CUBIC_METER
|
||||
from homeassistant.helpers import entity_registry as er
|
||||
|
||||
from tests.components.homekit_controller.common import setup_test_component
|
||||
|
@ -53,3 +54,47 @@ async def test_air_quality_sensor_read_state(hass, utcnow):
|
|||
assert state.attributes["particulate_matter_2_5"] == 4444
|
||||
assert state.attributes["particulate_matter_10"] == 5555
|
||||
assert state.attributes["volatile_organic_compounds"] == 6666
|
||||
|
||||
|
||||
async def test_air_quality_sensor_read_state_even_if_air_quality_off(hass, utcnow):
|
||||
"""The air quality entity is disabled by default, the replacement sensors should always be available."""
|
||||
await setup_test_component(hass, create_air_quality_sensor_service)
|
||||
|
||||
entity_registry = er.async_get(hass)
|
||||
|
||||
sensors = [
|
||||
{"entity_id": "sensor.testdevice_air_quality"},
|
||||
{
|
||||
"entity_id": "sensor.testdevice_pm10_density",
|
||||
"units": CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
|
||||
},
|
||||
{
|
||||
"entity_id": "sensor.testdevice_pm2_5_density",
|
||||
"units": CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
|
||||
},
|
||||
{
|
||||
"entity_id": "sensor.testdevice_pm10_density",
|
||||
"units": CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
|
||||
},
|
||||
{
|
||||
"entity_id": "sensor.testdevice_ozone_density",
|
||||
"units": CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
|
||||
},
|
||||
{
|
||||
"entity_id": "sensor.testdevice_sulphur_dioxide_density",
|
||||
"units": CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
|
||||
},
|
||||
{
|
||||
"entity_id": "sensor.testdevice_nitrogen_dioxide_density",
|
||||
"units": CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
|
||||
},
|
||||
{
|
||||
"entity_id": "sensor.testdevice_volatile_organic_compound_density",
|
||||
"units": CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
|
||||
},
|
||||
]
|
||||
|
||||
for sensor in sensors:
|
||||
entry = entity_registry.async_get(sensor["entity_id"])
|
||||
assert entry is not None
|
||||
assert entry.unit_of_measurement == sensor.get("units")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue