feat: Coordinator, Geraet und Licht-Entitaet
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
"""Helpers for Home Assistant tests."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import entity_registry as er
|
||||
|
||||
from custom_components.ninlight.const import DOMAIN
|
||||
from tests_unit.samples import MAC_RGB
|
||||
|
||||
|
||||
def entity_id_for(hass: HomeAssistant, platform: str, key: str, mac: str = MAC_RGB) -> str:
|
||||
"""Look entities up by unique_id instead of guessing slugs."""
|
||||
entity_id = er.async_get(hass).async_get_entity_id(platform, DOMAIN, f"{mac}_{key}")
|
||||
assert entity_id is not None, f"no {platform} entity with key {key}"
|
||||
return entity_id
|
||||
Reference in New Issue
Block a user