mirror of
https://github.com/home-assistant/core.git
synced 2025-11-14 13:30:43 +00:00
Add Arve integration (#113156)
* add Arve integration * Update homeassistant/components/arve/config_flow.py Co-authored-by: Josef Zweck <24647999+zweckj@users.noreply.github.com> * Various fixes, changed scan interval to one minute * coordinator implementation * Code cleanup * Moved device info to the entity.py, ArveDeviceEntityDescription to sensor.py * delete refresh before adding entities Co-authored-by: Josef Zweck <24647999+zweckj@users.noreply.github.com> * Update tests/components/arve/test_config_flow.py Co-authored-by: Josef Zweck <24647999+zweckj@users.noreply.github.com> * Update tests/components/arve/conftest.py Co-authored-by: Josef Zweck <24647999+zweckj@users.noreply.github.com> * Changed value_fn in sensors.py, added typing to description * Code cleanups, platfrom test implementation * New code cleanups, first two working tests * Created platform test, generated snapshots * Reworked integration to get all of the customer devices * new fixes * Added customer id, small cleanups * Logic of setting unique_id to the config flow * Added test of abortion on duplicate config_flow id * Added "available" and "device" properties fro ArveDeviceEntity * small _attr_unique_id fix * Added new test, improved mocking, various fixes * Various cleanups and fixes * microfix * Update homeassistant/components/arve/strings.json * ruff fix --------- Co-authored-by: Josef Zweck <24647999+zweckj@users.noreply.github.com> Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>
This commit is contained in:
43
tests/components/arve/test_sensor.py
Normal file
43
tests/components/arve/test_sensor.py
Normal file
@@ -0,0 +1,43 @@
|
||||
"""Test for Arve sensors."""
|
||||
|
||||
from unittest.mock import MagicMock
|
||||
|
||||
from syrupy import SnapshotAssertion
|
||||
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import entity_registry as er
|
||||
|
||||
from . import async_init_integration
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
SENSORS = (
|
||||
"air_quality_index",
|
||||
"carbon_dioxide",
|
||||
"humidity",
|
||||
"pm10",
|
||||
"pm2_5",
|
||||
"temperature",
|
||||
"total_volatile_organic_compounds",
|
||||
)
|
||||
|
||||
|
||||
async def test_sensors(
|
||||
hass: HomeAssistant,
|
||||
mock_arve: MagicMock,
|
||||
entity_registry: er.EntityRegistry,
|
||||
mock_config_entry: MockConfigEntry,
|
||||
snapshot: SnapshotAssertion,
|
||||
) -> None:
|
||||
"""Test the Arve sensors."""
|
||||
await async_init_integration(hass, mock_config_entry)
|
||||
|
||||
for sensor in SENSORS:
|
||||
state = hass.states.get(f"sensor.test_sensor_{sensor}")
|
||||
assert state
|
||||
assert state == snapshot(name=f"test_sensor_{sensor}")
|
||||
|
||||
entry = entity_registry.async_get(state.entity_id)
|
||||
assert entry
|
||||
assert entry.device_id
|
||||
assert entry == snapshot(name=f"entry_{sensor}")
|
||||
Reference in New Issue
Block a user