Update tests c-h to use registry async_get (#47652)
parent
ba2978c693
commit
87e7cebd36
|
@ -28,6 +28,7 @@ from homeassistant.components.media_player.const import (
|
||||||
from homeassistant.config import async_process_ha_core_config
|
from homeassistant.config import async_process_ha_core_config
|
||||||
from homeassistant.const import EVENT_HOMEASSISTANT_STOP
|
from homeassistant.const import EVENT_HOMEASSISTANT_STOP
|
||||||
from homeassistant.exceptions import PlatformNotReady
|
from homeassistant.exceptions import PlatformNotReady
|
||||||
|
from homeassistant.helpers import entity_registry as er
|
||||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||||
from homeassistant.helpers.typing import HomeAssistantType
|
from homeassistant.helpers.typing import HomeAssistantType
|
||||||
from homeassistant.setup import async_setup_component
|
from homeassistant.setup import async_setup_component
|
||||||
|
@ -489,7 +490,7 @@ async def test_discover_dynamic_group(hass, dial_mock, pycast_mock, caplog):
|
||||||
zconf_1 = get_fake_zconf(host="host_1", port=23456)
|
zconf_1 = get_fake_zconf(host="host_1", port=23456)
|
||||||
zconf_2 = get_fake_zconf(host="host_2", port=34567)
|
zconf_2 = get_fake_zconf(host="host_2", port=34567)
|
||||||
|
|
||||||
reg = await hass.helpers.entity_registry.async_get_registry()
|
reg = er.async_get(hass)
|
||||||
|
|
||||||
# Fake dynamic group info
|
# Fake dynamic group info
|
||||||
tmp1 = MagicMock()
|
tmp1 = MagicMock()
|
||||||
|
@ -613,7 +614,7 @@ async def test_entity_availability(hass: HomeAssistantType):
|
||||||
async def test_entity_cast_status(hass: HomeAssistantType):
|
async def test_entity_cast_status(hass: HomeAssistantType):
|
||||||
"""Test handling of cast status."""
|
"""Test handling of cast status."""
|
||||||
entity_id = "media_player.speaker"
|
entity_id = "media_player.speaker"
|
||||||
reg = await hass.helpers.entity_registry.async_get_registry()
|
reg = er.async_get(hass)
|
||||||
|
|
||||||
info = get_fake_chromecast_info()
|
info = get_fake_chromecast_info()
|
||||||
full_info = attr.evolve(
|
full_info = attr.evolve(
|
||||||
|
@ -682,7 +683,7 @@ async def test_entity_cast_status(hass: HomeAssistantType):
|
||||||
async def test_entity_play_media(hass: HomeAssistantType):
|
async def test_entity_play_media(hass: HomeAssistantType):
|
||||||
"""Test playing media."""
|
"""Test playing media."""
|
||||||
entity_id = "media_player.speaker"
|
entity_id = "media_player.speaker"
|
||||||
reg = await hass.helpers.entity_registry.async_get_registry()
|
reg = er.async_get(hass)
|
||||||
|
|
||||||
info = get_fake_chromecast_info()
|
info = get_fake_chromecast_info()
|
||||||
full_info = attr.evolve(
|
full_info = attr.evolve(
|
||||||
|
@ -711,7 +712,7 @@ async def test_entity_play_media(hass: HomeAssistantType):
|
||||||
async def test_entity_play_media_cast(hass: HomeAssistantType, quick_play_mock):
|
async def test_entity_play_media_cast(hass: HomeAssistantType, quick_play_mock):
|
||||||
"""Test playing media with cast special features."""
|
"""Test playing media with cast special features."""
|
||||||
entity_id = "media_player.speaker"
|
entity_id = "media_player.speaker"
|
||||||
reg = await hass.helpers.entity_registry.async_get_registry()
|
reg = er.async_get(hass)
|
||||||
|
|
||||||
info = get_fake_chromecast_info()
|
info = get_fake_chromecast_info()
|
||||||
full_info = attr.evolve(
|
full_info = attr.evolve(
|
||||||
|
@ -744,7 +745,7 @@ async def test_entity_play_media_cast(hass: HomeAssistantType, quick_play_mock):
|
||||||
async def test_entity_play_media_cast_invalid(hass, caplog, quick_play_mock):
|
async def test_entity_play_media_cast_invalid(hass, caplog, quick_play_mock):
|
||||||
"""Test playing media."""
|
"""Test playing media."""
|
||||||
entity_id = "media_player.speaker"
|
entity_id = "media_player.speaker"
|
||||||
reg = await hass.helpers.entity_registry.async_get_registry()
|
reg = er.async_get(hass)
|
||||||
|
|
||||||
info = get_fake_chromecast_info()
|
info = get_fake_chromecast_info()
|
||||||
full_info = attr.evolve(
|
full_info = attr.evolve(
|
||||||
|
@ -817,7 +818,7 @@ async def test_entity_play_media_sign_URL(hass: HomeAssistantType):
|
||||||
async def test_entity_media_content_type(hass: HomeAssistantType):
|
async def test_entity_media_content_type(hass: HomeAssistantType):
|
||||||
"""Test various content types."""
|
"""Test various content types."""
|
||||||
entity_id = "media_player.speaker"
|
entity_id = "media_player.speaker"
|
||||||
reg = await hass.helpers.entity_registry.async_get_registry()
|
reg = er.async_get(hass)
|
||||||
|
|
||||||
info = get_fake_chromecast_info()
|
info = get_fake_chromecast_info()
|
||||||
full_info = attr.evolve(
|
full_info = attr.evolve(
|
||||||
|
@ -871,7 +872,7 @@ async def test_entity_media_content_type(hass: HomeAssistantType):
|
||||||
async def test_entity_control(hass: HomeAssistantType):
|
async def test_entity_control(hass: HomeAssistantType):
|
||||||
"""Test various device and media controls."""
|
"""Test various device and media controls."""
|
||||||
entity_id = "media_player.speaker"
|
entity_id = "media_player.speaker"
|
||||||
reg = await hass.helpers.entity_registry.async_get_registry()
|
reg = er.async_get(hass)
|
||||||
|
|
||||||
info = get_fake_chromecast_info()
|
info = get_fake_chromecast_info()
|
||||||
full_info = attr.evolve(
|
full_info = attr.evolve(
|
||||||
|
@ -980,7 +981,7 @@ async def test_entity_control(hass: HomeAssistantType):
|
||||||
async def test_entity_media_states(hass: HomeAssistantType):
|
async def test_entity_media_states(hass: HomeAssistantType):
|
||||||
"""Test various entity media states."""
|
"""Test various entity media states."""
|
||||||
entity_id = "media_player.speaker"
|
entity_id = "media_player.speaker"
|
||||||
reg = await hass.helpers.entity_registry.async_get_registry()
|
reg = er.async_get(hass)
|
||||||
|
|
||||||
info = get_fake_chromecast_info()
|
info = get_fake_chromecast_info()
|
||||||
full_info = attr.evolve(
|
full_info = attr.evolve(
|
||||||
|
@ -1039,7 +1040,7 @@ async def test_entity_media_states(hass: HomeAssistantType):
|
||||||
async def test_group_media_states(hass, mz_mock):
|
async def test_group_media_states(hass, mz_mock):
|
||||||
"""Test media states are read from group if entity has no state."""
|
"""Test media states are read from group if entity has no state."""
|
||||||
entity_id = "media_player.speaker"
|
entity_id = "media_player.speaker"
|
||||||
reg = await hass.helpers.entity_registry.async_get_registry()
|
reg = er.async_get(hass)
|
||||||
|
|
||||||
info = get_fake_chromecast_info()
|
info = get_fake_chromecast_info()
|
||||||
full_info = attr.evolve(
|
full_info = attr.evolve(
|
||||||
|
@ -1092,7 +1093,7 @@ async def test_group_media_states(hass, mz_mock):
|
||||||
async def test_group_media_control(hass, mz_mock):
|
async def test_group_media_control(hass, mz_mock):
|
||||||
"""Test media controls are handled by group if entity has no state."""
|
"""Test media controls are handled by group if entity has no state."""
|
||||||
entity_id = "media_player.speaker"
|
entity_id = "media_player.speaker"
|
||||||
reg = await hass.helpers.entity_registry.async_get_registry()
|
reg = er.async_get(hass)
|
||||||
|
|
||||||
info = get_fake_chromecast_info()
|
info = get_fake_chromecast_info()
|
||||||
full_info = attr.evolve(
|
full_info = attr.evolve(
|
||||||
|
|
|
@ -4,6 +4,7 @@ from unittest.mock import patch
|
||||||
|
|
||||||
from homeassistant.bootstrap import async_setup_component
|
from homeassistant.bootstrap import async_setup_component
|
||||||
from homeassistant.components import automation, config
|
from homeassistant.components import automation, config
|
||||||
|
from homeassistant.helpers import entity_registry as er
|
||||||
|
|
||||||
from tests.components.blueprint.conftest import stub_blueprint_populate # noqa: F401
|
from tests.components.blueprint.conftest import stub_blueprint_populate # noqa: F401
|
||||||
|
|
||||||
|
@ -110,7 +111,7 @@ async def test_bad_formatted_automations(hass, hass_client):
|
||||||
|
|
||||||
async def test_delete_automation(hass, hass_client):
|
async def test_delete_automation(hass, hass_client):
|
||||||
"""Test deleting an automation."""
|
"""Test deleting an automation."""
|
||||||
ent_reg = await hass.helpers.entity_registry.async_get_registry()
|
ent_reg = er.async_get(hass)
|
||||||
|
|
||||||
assert await async_setup_component(
|
assert await async_setup_component(
|
||||||
hass,
|
hass,
|
||||||
|
|
|
@ -4,6 +4,7 @@ from unittest.mock import patch
|
||||||
|
|
||||||
from homeassistant.bootstrap import async_setup_component
|
from homeassistant.bootstrap import async_setup_component
|
||||||
from homeassistant.components import config
|
from homeassistant.components import config
|
||||||
|
from homeassistant.helpers import entity_registry as er
|
||||||
from homeassistant.util.yaml import dump
|
from homeassistant.util.yaml import dump
|
||||||
|
|
||||||
|
|
||||||
|
@ -114,7 +115,7 @@ async def test_bad_formatted_scene(hass, hass_client):
|
||||||
|
|
||||||
async def test_delete_scene(hass, hass_client):
|
async def test_delete_scene(hass, hass_client):
|
||||||
"""Test deleting a scene."""
|
"""Test deleting a scene."""
|
||||||
ent_reg = await hass.helpers.entity_registry.async_get_registry()
|
ent_reg = er.async_get(hass)
|
||||||
|
|
||||||
assert await async_setup_component(
|
assert await async_setup_component(
|
||||||
hass,
|
hass,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
"""Test init of Coronavirus integration."""
|
"""Test init of Coronavirus integration."""
|
||||||
from homeassistant.components.coronavirus.const import DOMAIN, OPTION_WORLDWIDE
|
from homeassistant.components.coronavirus.const import DOMAIN, OPTION_WORLDWIDE
|
||||||
from homeassistant.helpers import entity_registry
|
from homeassistant.helpers import entity_registry as er
|
||||||
from homeassistant.setup import async_setup_component
|
from homeassistant.setup import async_setup_component
|
||||||
|
|
||||||
from tests.common import MockConfigEntry, mock_registry
|
from tests.common import MockConfigEntry, mock_registry
|
||||||
|
@ -17,13 +17,13 @@ async def test_migration(hass):
|
||||||
mock_registry(
|
mock_registry(
|
||||||
hass,
|
hass,
|
||||||
{
|
{
|
||||||
"sensor.netherlands_confirmed": entity_registry.RegistryEntry(
|
"sensor.netherlands_confirmed": er.RegistryEntry(
|
||||||
entity_id="sensor.netherlands_confirmed",
|
entity_id="sensor.netherlands_confirmed",
|
||||||
unique_id="34-confirmed",
|
unique_id="34-confirmed",
|
||||||
platform="coronavirus",
|
platform="coronavirus",
|
||||||
config_entry_id=nl_entry.entry_id,
|
config_entry_id=nl_entry.entry_id,
|
||||||
),
|
),
|
||||||
"sensor.worldwide_confirmed": entity_registry.RegistryEntry(
|
"sensor.worldwide_confirmed": er.RegistryEntry(
|
||||||
entity_id="sensor.worldwide_confirmed",
|
entity_id="sensor.worldwide_confirmed",
|
||||||
unique_id="__worldwide-confirmed",
|
unique_id="__worldwide-confirmed",
|
||||||
platform="coronavirus",
|
platform="coronavirus",
|
||||||
|
@ -34,7 +34,7 @@ async def test_migration(hass):
|
||||||
assert await async_setup_component(hass, DOMAIN, {})
|
assert await async_setup_component(hass, DOMAIN, {})
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
ent_reg = await entity_registry.async_get_registry(hass)
|
ent_reg = er.async_get(hass)
|
||||||
|
|
||||||
sensor_nl = ent_reg.async_get("sensor.netherlands_confirmed")
|
sensor_nl = ent_reg.async_get("sensor.netherlands_confirmed")
|
||||||
assert sensor_nl.unique_id == "Netherlands-confirmed"
|
assert sensor_nl.unique_id == "Netherlands-confirmed"
|
||||||
|
|
|
@ -21,7 +21,7 @@ from homeassistant.components.counter import (
|
||||||
)
|
)
|
||||||
from homeassistant.const import ATTR_FRIENDLY_NAME, ATTR_ICON, ATTR_NAME
|
from homeassistant.const import ATTR_FRIENDLY_NAME, ATTR_ICON, ATTR_NAME
|
||||||
from homeassistant.core import Context, CoreState, State
|
from homeassistant.core import Context, CoreState, State
|
||||||
from homeassistant.helpers import entity_registry
|
from homeassistant.helpers import entity_registry as er
|
||||||
from homeassistant.setup import async_setup_component
|
from homeassistant.setup import async_setup_component
|
||||||
|
|
||||||
from tests.common import mock_restore_cache
|
from tests.common import mock_restore_cache
|
||||||
|
@ -569,7 +569,7 @@ async def test_ws_delete(hass, hass_ws_client, storage_setup):
|
||||||
|
|
||||||
input_id = "from_storage"
|
input_id = "from_storage"
|
||||||
input_entity_id = f"{DOMAIN}.{input_id}"
|
input_entity_id = f"{DOMAIN}.{input_id}"
|
||||||
ent_reg = await entity_registry.async_get_registry(hass)
|
ent_reg = er.async_get(hass)
|
||||||
|
|
||||||
state = hass.states.get(input_entity_id)
|
state = hass.states.get(input_entity_id)
|
||||||
assert state is not None
|
assert state is not None
|
||||||
|
@ -606,7 +606,7 @@ async def test_update_min_max(hass, hass_ws_client, storage_setup):
|
||||||
|
|
||||||
input_id = "from_storage"
|
input_id = "from_storage"
|
||||||
input_entity_id = f"{DOMAIN}.{input_id}"
|
input_entity_id = f"{DOMAIN}.{input_id}"
|
||||||
ent_reg = await entity_registry.async_get_registry(hass)
|
ent_reg = er.async_get(hass)
|
||||||
|
|
||||||
state = hass.states.get(input_entity_id)
|
state = hass.states.get(input_entity_id)
|
||||||
assert state is not None
|
assert state is not None
|
||||||
|
@ -683,7 +683,7 @@ async def test_create(hass, hass_ws_client, storage_setup):
|
||||||
|
|
||||||
counter_id = "new_counter"
|
counter_id = "new_counter"
|
||||||
input_entity_id = f"{DOMAIN}.{counter_id}"
|
input_entity_id = f"{DOMAIN}.{counter_id}"
|
||||||
ent_reg = await entity_registry.async_get_registry(hass)
|
ent_reg = er.async_get(hass)
|
||||||
|
|
||||||
state = hass.states.get(input_entity_id)
|
state = hass.states.get(input_entity_id)
|
||||||
assert state is None
|
assert state is None
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
"""deCONZ binary sensor platform tests."""
|
"""deCONZ binary sensor platform tests."""
|
||||||
|
|
||||||
from copy import deepcopy
|
from copy import deepcopy
|
||||||
|
|
||||||
from homeassistant.components.binary_sensor import (
|
from homeassistant.components.binary_sensor import (
|
||||||
|
@ -15,6 +14,7 @@ from homeassistant.components.deconz.const import (
|
||||||
from homeassistant.components.deconz.gateway import get_gateway_from_config_entry
|
from homeassistant.components.deconz.gateway import get_gateway_from_config_entry
|
||||||
from homeassistant.components.deconz.services import SERVICE_DEVICE_REFRESH
|
from homeassistant.components.deconz.services import SERVICE_DEVICE_REFRESH
|
||||||
from homeassistant.const import STATE_OFF, STATE_ON, STATE_UNAVAILABLE
|
from homeassistant.const import STATE_OFF, STATE_ON, STATE_UNAVAILABLE
|
||||||
|
from homeassistant.helpers import entity_registry as er
|
||||||
from homeassistant.helpers.entity_registry import async_entries_for_config_entry
|
from homeassistant.helpers.entity_registry import async_entries_for_config_entry
|
||||||
|
|
||||||
from .test_gateway import (
|
from .test_gateway import (
|
||||||
|
@ -191,7 +191,7 @@ async def test_add_new_binary_sensor_ignored(hass, aioclient_mock):
|
||||||
assert len(hass.states.async_all()) == 0
|
assert len(hass.states.async_all()) == 0
|
||||||
assert not hass.states.get("binary_sensor.presence_sensor")
|
assert not hass.states.get("binary_sensor.presence_sensor")
|
||||||
|
|
||||||
entity_registry = await hass.helpers.entity_registry.async_get_registry()
|
entity_registry = er.async_get(hass)
|
||||||
assert (
|
assert (
|
||||||
len(async_entries_for_config_entry(entity_registry, config_entry.entry_id)) == 0
|
len(async_entries_for_config_entry(entity_registry, config_entry.entry_id)) == 0
|
||||||
)
|
)
|
||||||
|
|
|
@ -16,7 +16,7 @@ from homeassistant.components.deconz.const import (
|
||||||
)
|
)
|
||||||
from homeassistant.components.light import DOMAIN as LIGHT_DOMAIN
|
from homeassistant.components.light import DOMAIN as LIGHT_DOMAIN
|
||||||
from homeassistant.const import CONF_API_KEY, CONF_HOST, CONF_PORT
|
from homeassistant.const import CONF_API_KEY, CONF_HOST, CONF_PORT
|
||||||
from homeassistant.helpers import entity_registry
|
from homeassistant.helpers import entity_registry as er
|
||||||
|
|
||||||
from .test_gateway import DECONZ_WEB_REQUEST, setup_deconz_integration
|
from .test_gateway import DECONZ_WEB_REQUEST, setup_deconz_integration
|
||||||
|
|
||||||
|
@ -133,7 +133,7 @@ async def test_update_group_unique_id(hass):
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
registry = await entity_registry.async_get_registry(hass)
|
registry = er.async_get(hass)
|
||||||
# Create entity entry to migrate to new unique ID
|
# Create entity entry to migrate to new unique ID
|
||||||
registry.async_get_or_create(
|
registry.async_get_or_create(
|
||||||
LIGHT_DOMAIN,
|
LIGHT_DOMAIN,
|
||||||
|
@ -172,7 +172,7 @@ async def test_update_group_unique_id_no_legacy_group_id(hass):
|
||||||
data={},
|
data={},
|
||||||
)
|
)
|
||||||
|
|
||||||
registry = await entity_registry.async_get_registry(hass)
|
registry = er.async_get(hass)
|
||||||
# Create entity entry to migrate to new unique ID
|
# Create entity entry to migrate to new unique ID
|
||||||
registry.async_get_or_create(
|
registry.async_get_or_create(
|
||||||
LIGHT_DOMAIN,
|
LIGHT_DOMAIN,
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
"""deCONZ service tests."""
|
"""deCONZ service tests."""
|
||||||
|
|
||||||
from copy import deepcopy
|
from copy import deepcopy
|
||||||
from unittest.mock import Mock, patch
|
from unittest.mock import Mock, patch
|
||||||
|
|
||||||
|
@ -23,6 +22,7 @@ from homeassistant.components.deconz.services import (
|
||||||
async_unload_services,
|
async_unload_services,
|
||||||
)
|
)
|
||||||
from homeassistant.components.sensor import DOMAIN as SENSOR_DOMAIN
|
from homeassistant.components.sensor import DOMAIN as SENSOR_DOMAIN
|
||||||
|
from homeassistant.helpers import device_registry as dr, entity_registry as er
|
||||||
from homeassistant.helpers.entity_registry import async_entries_for_config_entry
|
from homeassistant.helpers.entity_registry import async_entries_for_config_entry
|
||||||
|
|
||||||
from .test_gateway import (
|
from .test_gateway import (
|
||||||
|
@ -245,7 +245,7 @@ async def test_remove_orphaned_entries_service(hass, aioclient_mock):
|
||||||
|
|
||||||
data = {CONF_BRIDGE_ID: BRIDGEID}
|
data = {CONF_BRIDGE_ID: BRIDGEID}
|
||||||
|
|
||||||
device_registry = await hass.helpers.device_registry.async_get_registry()
|
device_registry = dr.async_get(hass)
|
||||||
device = device_registry.async_get_or_create(
|
device = device_registry.async_get_or_create(
|
||||||
config_entry_id=config_entry.entry_id, identifiers={("mac", "123")}
|
config_entry_id=config_entry.entry_id, identifiers={("mac", "123")}
|
||||||
)
|
)
|
||||||
|
@ -261,7 +261,7 @@ async def test_remove_orphaned_entries_service(hass, aioclient_mock):
|
||||||
== 5 # Host, gateway, light, switch and orphan
|
== 5 # Host, gateway, light, switch and orphan
|
||||||
)
|
)
|
||||||
|
|
||||||
entity_registry = await hass.helpers.entity_registry.async_get_registry()
|
entity_registry = er.async_get(hass)
|
||||||
entity_registry.async_get_or_create(
|
entity_registry.async_get_or_create(
|
||||||
SENSOR_DOMAIN,
|
SENSOR_DOMAIN,
|
||||||
DECONZ_DOMAIN,
|
DECONZ_DOMAIN,
|
||||||
|
|
|
@ -53,6 +53,7 @@ from homeassistant.const import (
|
||||||
STATE_PLAYING,
|
STATE_PLAYING,
|
||||||
STATE_UNAVAILABLE,
|
STATE_UNAVAILABLE,
|
||||||
)
|
)
|
||||||
|
from homeassistant.helpers import entity_registry as er
|
||||||
from homeassistant.helpers.typing import HomeAssistantType
|
from homeassistant.helpers.typing import HomeAssistantType
|
||||||
from homeassistant.util import dt as dt_util
|
from homeassistant.util import dt as dt_util
|
||||||
|
|
||||||
|
@ -167,7 +168,7 @@ async def test_unique_id(
|
||||||
"""Test unique id."""
|
"""Test unique id."""
|
||||||
await setup_integration(hass, aioclient_mock)
|
await setup_integration(hass, aioclient_mock)
|
||||||
|
|
||||||
entity_registry = await hass.helpers.entity_registry.async_get_registry()
|
entity_registry = er.async_get(hass)
|
||||||
|
|
||||||
main = entity_registry.async_get(MAIN_ENTITY_ID)
|
main = entity_registry.async_get(MAIN_ENTITY_ID)
|
||||||
assert main.device_class == DEVICE_CLASS_RECEIVER
|
assert main.device_class == DEVICE_CLASS_RECEIVER
|
||||||
|
|
|
@ -7,6 +7,7 @@ from homeassistant.components.remote import (
|
||||||
SERVICE_SEND_COMMAND,
|
SERVICE_SEND_COMMAND,
|
||||||
)
|
)
|
||||||
from homeassistant.const import ATTR_ENTITY_ID, SERVICE_TURN_OFF, SERVICE_TURN_ON
|
from homeassistant.const import ATTR_ENTITY_ID, SERVICE_TURN_OFF, SERVICE_TURN_ON
|
||||||
|
from homeassistant.helpers import entity_registry as er
|
||||||
from homeassistant.helpers.typing import HomeAssistantType
|
from homeassistant.helpers.typing import HomeAssistantType
|
||||||
|
|
||||||
from tests.components.directv import setup_integration
|
from tests.components.directv import setup_integration
|
||||||
|
@ -36,7 +37,7 @@ async def test_unique_id(
|
||||||
"""Test unique id."""
|
"""Test unique id."""
|
||||||
await setup_integration(hass, aioclient_mock)
|
await setup_integration(hass, aioclient_mock)
|
||||||
|
|
||||||
entity_registry = await hass.helpers.entity_registry.async_get_registry()
|
entity_registry = er.async_get(hass)
|
||||||
|
|
||||||
main = entity_registry.async_get(MAIN_ENTITY_ID)
|
main = entity_registry.async_get(MAIN_ENTITY_ID)
|
||||||
assert main.unique_id == "028877455858"
|
assert main.unique_id == "028877455858"
|
||||||
|
|
|
@ -19,6 +19,7 @@ from homeassistant.const import (
|
||||||
VOLUME_CUBIC_METERS,
|
VOLUME_CUBIC_METERS,
|
||||||
VOLUME_FLOW_RATE_CUBIC_METERS_PER_HOUR,
|
VOLUME_FLOW_RATE_CUBIC_METERS_PER_HOUR,
|
||||||
)
|
)
|
||||||
|
from homeassistant.helpers import entity_registry as er
|
||||||
from homeassistant.setup import async_setup_component
|
from homeassistant.setup import async_setup_component
|
||||||
|
|
||||||
from tests.common import MockConfigEntry, patch
|
from tests.common import MockConfigEntry, patch
|
||||||
|
@ -107,7 +108,7 @@ async def test_default_setup(hass, dsmr_connection_fixture):
|
||||||
await hass.config_entries.async_setup(mock_entry.entry_id)
|
await hass.config_entries.async_setup(mock_entry.entry_id)
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
registry = await hass.helpers.entity_registry.async_get_registry()
|
registry = er.async_get(hass)
|
||||||
|
|
||||||
entry = registry.async_get("sensor.power_consumption")
|
entry = registry.async_get("sensor.power_consumption")
|
||||||
assert entry
|
assert entry
|
||||||
|
@ -167,7 +168,7 @@ async def test_setup_only_energy(hass, dsmr_connection_fixture):
|
||||||
await hass.config_entries.async_setup(mock_entry.entry_id)
|
await hass.config_entries.async_setup(mock_entry.entry_id)
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
registry = await hass.helpers.entity_registry.async_get_registry()
|
registry = er.async_get(hass)
|
||||||
|
|
||||||
entry = registry.async_get("sensor.power_consumption")
|
entry = registry.async_get("sensor.power_consumption")
|
||||||
assert entry
|
assert entry
|
||||||
|
|
|
@ -3,7 +3,7 @@ from unittest.mock import AsyncMock, Mock, call, patch
|
||||||
|
|
||||||
from homeassistant.components import dynalite
|
from homeassistant.components import dynalite
|
||||||
from homeassistant.const import ATTR_SERVICE
|
from homeassistant.const import ATTR_SERVICE
|
||||||
from homeassistant.helpers import entity_registry
|
from homeassistant.helpers import entity_registry as er
|
||||||
|
|
||||||
from tests.common import MockConfigEntry
|
from tests.common import MockConfigEntry
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ def create_mock_device(platform, spec):
|
||||||
|
|
||||||
async def get_entry_id_from_hass(hass):
|
async def get_entry_id_from_hass(hass):
|
||||||
"""Get the config entry id from hass."""
|
"""Get the config entry id from hass."""
|
||||||
ent_reg = await entity_registry.async_get_registry(hass)
|
ent_reg = er.async_get(hass)
|
||||||
assert ent_reg
|
assert ent_reg
|
||||||
conf_entries = hass.config_entries.async_entries(dynalite.DOMAIN)
|
conf_entries = hass.config_entries.async_entries(dynalite.DOMAIN)
|
||||||
assert len(conf_entries) == 1
|
assert len(conf_entries) == 1
|
||||||
|
|
|
@ -60,7 +60,7 @@ from homeassistant.const import (
|
||||||
ATTR_TEMPERATURE,
|
ATTR_TEMPERATURE,
|
||||||
)
|
)
|
||||||
from homeassistant.core import HomeAssistant, callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
from homeassistant.helpers import entity_registry
|
from homeassistant.helpers import entity_registry as er
|
||||||
|
|
||||||
from .common import (
|
from .common import (
|
||||||
ENTITY_NAME,
|
ENTITY_NAME,
|
||||||
|
@ -99,8 +99,8 @@ def async_get_device(spec: Type[DysonDevice]) -> DysonDevice:
|
||||||
)
|
)
|
||||||
async def test_state_common(hass: HomeAssistant, device: DysonDevice) -> None:
|
async def test_state_common(hass: HomeAssistant, device: DysonDevice) -> None:
|
||||||
"""Test common state and attributes of two types of climate entities."""
|
"""Test common state and attributes of two types of climate entities."""
|
||||||
er = await entity_registry.async_get_registry(hass)
|
entity_registry = er.async_get(hass)
|
||||||
assert er.async_get(ENTITY_ID).unique_id == SERIAL
|
assert entity_registry.async_get(ENTITY_ID).unique_id == SERIAL
|
||||||
|
|
||||||
state = hass.states.get(ENTITY_ID)
|
state = hass.states.get(ENTITY_ID)
|
||||||
assert state.name == NAME
|
assert state.name == NAME
|
||||||
|
|
|
@ -52,7 +52,7 @@ from homeassistant.const import (
|
||||||
STATE_ON,
|
STATE_ON,
|
||||||
)
|
)
|
||||||
from homeassistant.core import HomeAssistant, callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
from homeassistant.helpers import entity_registry
|
from homeassistant.helpers import entity_registry as er
|
||||||
|
|
||||||
from .common import (
|
from .common import (
|
||||||
ENTITY_NAME,
|
ENTITY_NAME,
|
||||||
|
@ -79,8 +79,8 @@ async def test_state_purecoollink(
|
||||||
hass: HomeAssistant, device: DysonPureCoolLink
|
hass: HomeAssistant, device: DysonPureCoolLink
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test the state of a PureCoolLink fan."""
|
"""Test the state of a PureCoolLink fan."""
|
||||||
er = await entity_registry.async_get_registry(hass)
|
entity_registry = er.async_get(hass)
|
||||||
assert er.async_get(ENTITY_ID).unique_id == SERIAL
|
assert entity_registry.async_get(ENTITY_ID).unique_id == SERIAL
|
||||||
|
|
||||||
state = hass.states.get(ENTITY_ID)
|
state = hass.states.get(ENTITY_ID)
|
||||||
assert state.state == STATE_ON
|
assert state.state == STATE_ON
|
||||||
|
@ -128,8 +128,8 @@ async def test_state_purecoollink(
|
||||||
@pytest.mark.parametrize("device", [DysonPureCool], indirect=True)
|
@pytest.mark.parametrize("device", [DysonPureCool], indirect=True)
|
||||||
async def test_state_purecool(hass: HomeAssistant, device: DysonPureCool) -> None:
|
async def test_state_purecool(hass: HomeAssistant, device: DysonPureCool) -> None:
|
||||||
"""Test the state of a PureCool fan."""
|
"""Test the state of a PureCool fan."""
|
||||||
er = await entity_registry.async_get_registry(hass)
|
entity_registry = er.async_get(hass)
|
||||||
assert er.async_get(ENTITY_ID).unique_id == SERIAL
|
assert entity_registry.async_get(ENTITY_ID).unique_id == SERIAL
|
||||||
|
|
||||||
state = hass.states.get(ENTITY_ID)
|
state = hass.states.get(ENTITY_ID)
|
||||||
assert state.state == STATE_ON
|
assert state.state == STATE_ON
|
||||||
|
|
|
@ -16,7 +16,7 @@ from homeassistant.const import (
|
||||||
TEMP_FAHRENHEIT,
|
TEMP_FAHRENHEIT,
|
||||||
)
|
)
|
||||||
from homeassistant.core import HomeAssistant, callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
from homeassistant.helpers import entity_registry
|
from homeassistant.helpers import entity_registry as er
|
||||||
from homeassistant.util.unit_system import IMPERIAL_SYSTEM, METRIC_SYSTEM, UnitSystem
|
from homeassistant.util.unit_system import IMPERIAL_SYSTEM, METRIC_SYSTEM, UnitSystem
|
||||||
|
|
||||||
from .common import (
|
from .common import (
|
||||||
|
@ -120,12 +120,12 @@ async def test_sensors(
|
||||||
# Make sure no other sensors are set up
|
# Make sure no other sensors are set up
|
||||||
assert len(hass.states.async_all()) == len(sensors)
|
assert len(hass.states.async_all()) == len(sensors)
|
||||||
|
|
||||||
er = await entity_registry.async_get_registry(hass)
|
entity_registry = er.async_get(hass)
|
||||||
for sensor in sensors:
|
for sensor in sensors:
|
||||||
entity_id = _async_get_entity_id(sensor)
|
entity_id = _async_get_entity_id(sensor)
|
||||||
|
|
||||||
# Test unique id
|
# Test unique id
|
||||||
assert er.async_get(entity_id).unique_id == f"{SERIAL}-{sensor}"
|
assert entity_registry.async_get(entity_id).unique_id == f"{SERIAL}-{sensor}"
|
||||||
|
|
||||||
# Test state
|
# Test state
|
||||||
state = hass.states.get(entity_id)
|
state = hass.states.get(entity_id)
|
||||||
|
|
|
@ -24,7 +24,7 @@ from homeassistant.const import (
|
||||||
STATE_ON,
|
STATE_ON,
|
||||||
)
|
)
|
||||||
from homeassistant.core import HomeAssistant, callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
from homeassistant.helpers import entity_registry
|
from homeassistant.helpers import entity_registry as er
|
||||||
|
|
||||||
from .common import (
|
from .common import (
|
||||||
ENTITY_NAME,
|
ENTITY_NAME,
|
||||||
|
@ -45,8 +45,8 @@ def async_get_device(state=Dyson360EyeMode.FULL_CLEAN_RUNNING) -> Dyson360Eye:
|
||||||
|
|
||||||
async def test_state(hass: HomeAssistant, device: Dyson360Eye) -> None:
|
async def test_state(hass: HomeAssistant, device: Dyson360Eye) -> None:
|
||||||
"""Test the state of the vacuum."""
|
"""Test the state of the vacuum."""
|
||||||
er = await entity_registry.async_get_registry(hass)
|
entity_registry = er.async_get(hass)
|
||||||
assert er.async_get(ENTITY_ID).unique_id == SERIAL
|
assert entity_registry.async_get(ENTITY_ID).unique_id == SERIAL
|
||||||
|
|
||||||
state = hass.states.get(ENTITY_ID)
|
state = hass.states.get(ENTITY_ID)
|
||||||
assert state.name == NAME
|
assert state.name == NAME
|
||||||
|
|
|
@ -16,6 +16,7 @@ from homeassistant.const import (
|
||||||
STATE_UNAVAILABLE,
|
STATE_UNAVAILABLE,
|
||||||
)
|
)
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
|
from homeassistant.helpers import entity_registry as er
|
||||||
|
|
||||||
from tests.common import mock_coro
|
from tests.common import mock_coro
|
||||||
from tests.components.elgato import init_integration
|
from tests.components.elgato import init_integration
|
||||||
|
@ -28,7 +29,7 @@ async def test_light_state(
|
||||||
"""Test the creation and values of the Elgato Key Lights."""
|
"""Test the creation and values of the Elgato Key Lights."""
|
||||||
await init_integration(hass, aioclient_mock)
|
await init_integration(hass, aioclient_mock)
|
||||||
|
|
||||||
entity_registry = await hass.helpers.entity_registry.async_get_registry()
|
entity_registry = er.async_get(hass)
|
||||||
|
|
||||||
# First segment of the strip
|
# First segment of the strip
|
||||||
state = hass.states.get("light.frenck")
|
state = hass.states.get("light.frenck")
|
||||||
|
|
|
@ -29,7 +29,7 @@ from homeassistant.const import (
|
||||||
EVENT_HOMEASSISTANT_START,
|
EVENT_HOMEASSISTANT_START,
|
||||||
LENGTH_KILOMETERS,
|
LENGTH_KILOMETERS,
|
||||||
)
|
)
|
||||||
from homeassistant.helpers.entity_registry import async_get_registry
|
from homeassistant.helpers import entity_registry as er
|
||||||
from homeassistant.setup import async_setup_component
|
from homeassistant.setup import async_setup_component
|
||||||
import homeassistant.util.dt as dt_util
|
import homeassistant.util.dt as dt_util
|
||||||
from homeassistant.util.unit_system import IMPERIAL_SYSTEM
|
from homeassistant.util.unit_system import IMPERIAL_SYSTEM
|
||||||
|
@ -99,7 +99,7 @@ async def test_setup(hass, legacy_patchable_time):
|
||||||
all_states = hass.states.async_all()
|
all_states = hass.states.async_all()
|
||||||
# 3 geolocation and 1 sensor entities
|
# 3 geolocation and 1 sensor entities
|
||||||
assert len(all_states) == 4
|
assert len(all_states) == 4
|
||||||
entity_registry = await async_get_registry(hass)
|
entity_registry = er.async_get(hass)
|
||||||
assert len(entity_registry.entities) == 4
|
assert len(entity_registry.entities) == 4
|
||||||
|
|
||||||
state = hass.states.get("geo_location.drought_name_1")
|
state = hass.states.get("geo_location.drought_name_1")
|
||||||
|
|
|
@ -35,6 +35,7 @@ from homeassistant.const import (
|
||||||
)
|
)
|
||||||
import homeassistant.core as ha
|
import homeassistant.core as ha
|
||||||
from homeassistant.core import DOMAIN as HASS_DOMAIN, CoreState, State, callback
|
from homeassistant.core import DOMAIN as HASS_DOMAIN, CoreState, State, callback
|
||||||
|
from homeassistant.helpers import entity_registry as er
|
||||||
from homeassistant.setup import async_setup_component
|
from homeassistant.setup import async_setup_component
|
||||||
from homeassistant.util.unit_system import METRIC_SYSTEM
|
from homeassistant.util.unit_system import METRIC_SYSTEM
|
||||||
|
|
||||||
|
@ -179,7 +180,7 @@ async def test_unique_id(hass, setup_comp_1):
|
||||||
)
|
)
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
entity_registry = await hass.helpers.entity_registry.async_get_registry()
|
entity_registry = er.async_get(hass)
|
||||||
|
|
||||||
entry = entity_registry.async_get(ENTITY)
|
entry = entity_registry.async_get(ENTITY)
|
||||||
assert entry
|
assert entry
|
||||||
|
|
|
@ -16,6 +16,7 @@ from homeassistant.const import (
|
||||||
STATE_HOME,
|
STATE_HOME,
|
||||||
STATE_NOT_HOME,
|
STATE_NOT_HOME,
|
||||||
)
|
)
|
||||||
|
from homeassistant.helpers import device_registry as dr, entity_registry as er
|
||||||
from homeassistant.setup import async_setup_component
|
from homeassistant.setup import async_setup_component
|
||||||
from homeassistant.util import slugify
|
from homeassistant.util import slugify
|
||||||
|
|
||||||
|
@ -223,10 +224,10 @@ async def test_gps_enter_and_exit_home(hass, geofency_client, webhook_id):
|
||||||
]
|
]
|
||||||
assert NOT_HOME_LONGITUDE == current_longitude
|
assert NOT_HOME_LONGITUDE == current_longitude
|
||||||
|
|
||||||
dev_reg = await hass.helpers.device_registry.async_get_registry()
|
dev_reg = dr.async_get(hass)
|
||||||
assert len(dev_reg.devices) == 1
|
assert len(dev_reg.devices) == 1
|
||||||
|
|
||||||
ent_reg = await hass.helpers.entity_registry.async_get_registry()
|
ent_reg = er.async_get(hass)
|
||||||
assert len(ent_reg.entities) == 1
|
assert len(ent_reg.entities) == 1
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ from homeassistant.const import (
|
||||||
EVENT_HOMEASSISTANT_START,
|
EVENT_HOMEASSISTANT_START,
|
||||||
LENGTH_KILOMETERS,
|
LENGTH_KILOMETERS,
|
||||||
)
|
)
|
||||||
from homeassistant.helpers.entity_registry import async_get_registry
|
from homeassistant.helpers import entity_registry as er
|
||||||
from homeassistant.setup import async_setup_component
|
from homeassistant.setup import async_setup_component
|
||||||
import homeassistant.util.dt as dt_util
|
import homeassistant.util.dt as dt_util
|
||||||
from homeassistant.util.unit_system import IMPERIAL_SYSTEM
|
from homeassistant.util.unit_system import IMPERIAL_SYSTEM
|
||||||
|
@ -75,7 +75,7 @@ async def test_setup(hass):
|
||||||
all_states = hass.states.async_all()
|
all_states = hass.states.async_all()
|
||||||
# 3 geolocation and 1 sensor entities
|
# 3 geolocation and 1 sensor entities
|
||||||
assert len(all_states) == 4
|
assert len(all_states) == 4
|
||||||
entity_registry = await async_get_registry(hass)
|
entity_registry = er.async_get(hass)
|
||||||
assert len(entity_registry.entities) == 4
|
assert len(entity_registry.entities) == 4
|
||||||
|
|
||||||
state = hass.states.get("geo_location.title_1")
|
state = hass.states.get("geo_location.title_1")
|
||||||
|
|
|
@ -23,6 +23,7 @@ from homeassistant.const import (
|
||||||
CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
|
CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
|
||||||
STATE_UNAVAILABLE,
|
STATE_UNAVAILABLE,
|
||||||
)
|
)
|
||||||
|
from homeassistant.helpers import entity_registry as er
|
||||||
from homeassistant.util.dt import utcnow
|
from homeassistant.util.dt import utcnow
|
||||||
|
|
||||||
from tests.common import async_fire_time_changed, load_fixture
|
from tests.common import async_fire_time_changed, load_fixture
|
||||||
|
@ -32,7 +33,7 @@ from tests.components.gios import init_integration
|
||||||
async def test_air_quality(hass):
|
async def test_air_quality(hass):
|
||||||
"""Test states of the air_quality."""
|
"""Test states of the air_quality."""
|
||||||
await init_integration(hass)
|
await init_integration(hass)
|
||||||
registry = await hass.helpers.entity_registry.async_get_registry()
|
registry = er.async_get(hass)
|
||||||
|
|
||||||
state = hass.states.get("air_quality.home")
|
state = hass.states.get("air_quality.home")
|
||||||
assert state
|
assert state
|
||||||
|
@ -60,7 +61,7 @@ async def test_air_quality(hass):
|
||||||
async def test_air_quality_with_incomplete_data(hass):
|
async def test_air_quality_with_incomplete_data(hass):
|
||||||
"""Test states of the air_quality with incomplete data from measuring station."""
|
"""Test states of the air_quality with incomplete data from measuring station."""
|
||||||
await init_integration(hass, incomplete_data=True)
|
await init_integration(hass, incomplete_data=True)
|
||||||
registry = await hass.helpers.entity_registry.async_get_registry()
|
registry = er.async_get(hass)
|
||||||
|
|
||||||
state = hass.states.get("air_quality.home")
|
state = hass.states.get("air_quality.home")
|
||||||
assert state
|
assert state
|
||||||
|
|
|
@ -14,6 +14,7 @@ from homeassistant.const import (
|
||||||
STATE_HOME,
|
STATE_HOME,
|
||||||
STATE_NOT_HOME,
|
STATE_NOT_HOME,
|
||||||
)
|
)
|
||||||
|
from homeassistant.helpers import device_registry as dr, entity_registry as er
|
||||||
from homeassistant.helpers.dispatcher import DATA_DISPATCHER
|
from homeassistant.helpers.dispatcher import DATA_DISPATCHER
|
||||||
from homeassistant.setup import async_setup_component
|
from homeassistant.setup import async_setup_component
|
||||||
|
|
||||||
|
@ -135,10 +136,10 @@ async def test_enter_and_exit(hass, gpslogger_client, webhook_id):
|
||||||
state_name = hass.states.get(f"{DEVICE_TRACKER_DOMAIN}.{data['device']}").state
|
state_name = hass.states.get(f"{DEVICE_TRACKER_DOMAIN}.{data['device']}").state
|
||||||
assert STATE_NOT_HOME == state_name
|
assert STATE_NOT_HOME == state_name
|
||||||
|
|
||||||
dev_reg = await hass.helpers.device_registry.async_get_registry()
|
dev_reg = dr.async_get(hass)
|
||||||
assert len(dev_reg.devices) == 1
|
assert len(dev_reg.devices) == 1
|
||||||
|
|
||||||
ent_reg = await hass.helpers.entity_registry.async_get_registry()
|
ent_reg = er.async_get(hass)
|
||||||
assert len(ent_reg.entities) == 1
|
assert len(ent_reg.entities) == 1
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
"""Test init of Logitch Harmony Hub integration."""
|
"""Test init of Logitch Harmony Hub integration."""
|
||||||
from homeassistant.components.harmony.const import DOMAIN
|
from homeassistant.components.harmony.const import DOMAIN
|
||||||
from homeassistant.const import CONF_HOST, CONF_NAME
|
from homeassistant.const import CONF_HOST, CONF_NAME
|
||||||
from homeassistant.helpers import entity_registry
|
from homeassistant.helpers import entity_registry as er
|
||||||
from homeassistant.setup import async_setup_component
|
from homeassistant.setup import async_setup_component
|
||||||
|
|
||||||
from .const import (
|
from .const import (
|
||||||
|
@ -28,28 +28,28 @@ async def test_unique_id_migration(mock_hc, hass, mock_write_config):
|
||||||
hass,
|
hass,
|
||||||
{
|
{
|
||||||
# old format
|
# old format
|
||||||
ENTITY_WATCH_TV: entity_registry.RegistryEntry(
|
ENTITY_WATCH_TV: er.RegistryEntry(
|
||||||
entity_id=ENTITY_WATCH_TV,
|
entity_id=ENTITY_WATCH_TV,
|
||||||
unique_id="123443-Watch TV",
|
unique_id="123443-Watch TV",
|
||||||
platform="harmony",
|
platform="harmony",
|
||||||
config_entry_id=entry.entry_id,
|
config_entry_id=entry.entry_id,
|
||||||
),
|
),
|
||||||
# old format, activity name with -
|
# old format, activity name with -
|
||||||
ENTITY_NILE_TV: entity_registry.RegistryEntry(
|
ENTITY_NILE_TV: er.RegistryEntry(
|
||||||
entity_id=ENTITY_NILE_TV,
|
entity_id=ENTITY_NILE_TV,
|
||||||
unique_id="123443-Nile-TV",
|
unique_id="123443-Nile-TV",
|
||||||
platform="harmony",
|
platform="harmony",
|
||||||
config_entry_id=entry.entry_id,
|
config_entry_id=entry.entry_id,
|
||||||
),
|
),
|
||||||
# new format
|
# new format
|
||||||
ENTITY_PLAY_MUSIC: entity_registry.RegistryEntry(
|
ENTITY_PLAY_MUSIC: er.RegistryEntry(
|
||||||
entity_id=ENTITY_PLAY_MUSIC,
|
entity_id=ENTITY_PLAY_MUSIC,
|
||||||
unique_id=f"activity_{PLAY_MUSIC_ACTIVITY_ID}",
|
unique_id=f"activity_{PLAY_MUSIC_ACTIVITY_ID}",
|
||||||
platform="harmony",
|
platform="harmony",
|
||||||
config_entry_id=entry.entry_id,
|
config_entry_id=entry.entry_id,
|
||||||
),
|
),
|
||||||
# old entity which no longer has a matching activity on the hub. skipped.
|
# old entity which no longer has a matching activity on the hub. skipped.
|
||||||
"switch.some_other_activity": entity_registry.RegistryEntry(
|
"switch.some_other_activity": er.RegistryEntry(
|
||||||
entity_id="switch.some_other_activity",
|
entity_id="switch.some_other_activity",
|
||||||
unique_id="123443-Some Other Activity",
|
unique_id="123443-Some Other Activity",
|
||||||
platform="harmony",
|
platform="harmony",
|
||||||
|
@ -60,7 +60,7 @@ async def test_unique_id_migration(mock_hc, hass, mock_write_config):
|
||||||
assert await async_setup_component(hass, DOMAIN, {})
|
assert await async_setup_component(hass, DOMAIN, {})
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
ent_reg = await entity_registry.async_get_registry(hass)
|
ent_reg = er.async_get(hass)
|
||||||
|
|
||||||
switch_tv = ent_reg.async_get(ENTITY_WATCH_TV)
|
switch_tv = ent_reg.async_get(ENTITY_WATCH_TV)
|
||||||
assert switch_tv.unique_id == f"activity_{WATCH_TV_ACTIVITY_ID}"
|
assert switch_tv.unique_id == f"activity_{WATCH_TV_ACTIVITY_ID}"
|
||||||
|
|
|
@ -53,6 +53,7 @@ from homeassistant.const import (
|
||||||
STATE_PLAYING,
|
STATE_PLAYING,
|
||||||
STATE_UNAVAILABLE,
|
STATE_UNAVAILABLE,
|
||||||
)
|
)
|
||||||
|
from homeassistant.helpers import device_registry as dr, entity_registry as er
|
||||||
from homeassistant.setup import async_setup_component
|
from homeassistant.setup import async_setup_component
|
||||||
|
|
||||||
|
|
||||||
|
@ -237,8 +238,8 @@ async def test_updates_from_players_changed_new_ids(
|
||||||
):
|
):
|
||||||
"""Test player updates from changes to available players."""
|
"""Test player updates from changes to available players."""
|
||||||
await setup_platform(hass, config_entry, config)
|
await setup_platform(hass, config_entry, config)
|
||||||
device_registry = await hass.helpers.device_registry.async_get_registry()
|
device_registry = dr.async_get(hass)
|
||||||
entity_registry = await hass.helpers.entity_registry.async_get_registry()
|
entity_registry = er.async_get(hass)
|
||||||
player = controller.players[1]
|
player = controller.players[1]
|
||||||
event = asyncio.Event()
|
event = asyncio.Event()
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ from homeassistant.const import (
|
||||||
STATE_UNKNOWN,
|
STATE_UNKNOWN,
|
||||||
)
|
)
|
||||||
from homeassistant.core import CoreState
|
from homeassistant.core import CoreState
|
||||||
from homeassistant.helpers import entity_registry
|
from homeassistant.helpers import entity_registry as er
|
||||||
|
|
||||||
from tests.common import async_mock_service
|
from tests.common import async_mock_service
|
||||||
|
|
||||||
|
@ -446,7 +446,7 @@ async def test_windowcovering_basic_restore(hass, hk_driver, events):
|
||||||
"""Test setting up an entity from state in the event registry."""
|
"""Test setting up an entity from state in the event registry."""
|
||||||
hass.state = CoreState.not_running
|
hass.state = CoreState.not_running
|
||||||
|
|
||||||
registry = await entity_registry.async_get_registry(hass)
|
registry = er.async_get(hass)
|
||||||
|
|
||||||
registry.async_get_or_create(
|
registry.async_get_or_create(
|
||||||
"cover",
|
"cover",
|
||||||
|
@ -484,7 +484,7 @@ async def test_windowcovering_restore(hass, hk_driver, events):
|
||||||
"""Test setting up an entity from state in the event registry."""
|
"""Test setting up an entity from state in the event registry."""
|
||||||
hass.state = CoreState.not_running
|
hass.state = CoreState.not_running
|
||||||
|
|
||||||
registry = await entity_registry.async_get_registry(hass)
|
registry = er.async_get(hass)
|
||||||
|
|
||||||
registry.async_get_or_create(
|
registry.async_get_or_create(
|
||||||
"cover",
|
"cover",
|
||||||
|
|
|
@ -28,7 +28,7 @@ from homeassistant.const import (
|
||||||
STATE_UNKNOWN,
|
STATE_UNKNOWN,
|
||||||
)
|
)
|
||||||
from homeassistant.core import CoreState
|
from homeassistant.core import CoreState
|
||||||
from homeassistant.helpers import entity_registry
|
from homeassistant.helpers import entity_registry as er
|
||||||
|
|
||||||
from tests.common import async_mock_service
|
from tests.common import async_mock_service
|
||||||
|
|
||||||
|
@ -526,7 +526,7 @@ async def test_fan_restore(hass, hk_driver, events):
|
||||||
"""Test setting up an entity from state in the event registry."""
|
"""Test setting up an entity from state in the event registry."""
|
||||||
hass.state = CoreState.not_running
|
hass.state = CoreState.not_running
|
||||||
|
|
||||||
registry = await entity_registry.async_get_registry(hass)
|
registry = er.async_get(hass)
|
||||||
|
|
||||||
registry.async_get_or_create(
|
registry.async_get_or_create(
|
||||||
"fan",
|
"fan",
|
||||||
|
|
|
@ -24,7 +24,7 @@ from homeassistant.const import (
|
||||||
STATE_UNKNOWN,
|
STATE_UNKNOWN,
|
||||||
)
|
)
|
||||||
from homeassistant.core import CoreState
|
from homeassistant.core import CoreState
|
||||||
from homeassistant.helpers import entity_registry
|
from homeassistant.helpers import entity_registry as er
|
||||||
|
|
||||||
from tests.common import async_mock_service
|
from tests.common import async_mock_service
|
||||||
|
|
||||||
|
@ -354,7 +354,7 @@ async def test_light_restore(hass, hk_driver, events):
|
||||||
"""Test setting up an entity from state in the event registry."""
|
"""Test setting up an entity from state in the event registry."""
|
||||||
hass.state = CoreState.not_running
|
hass.state = CoreState.not_running
|
||||||
|
|
||||||
registry = await entity_registry.async_get_registry(hass)
|
registry = er.async_get(hass)
|
||||||
|
|
||||||
registry.async_get_or_create("light", "hue", "1234", suggested_object_id="simple")
|
registry.async_get_or_create("light", "hue", "1234", suggested_object_id="simple")
|
||||||
registry.async_get_or_create(
|
registry.async_get_or_create(
|
||||||
|
|
|
@ -37,7 +37,7 @@ from homeassistant.const import (
|
||||||
STATE_STANDBY,
|
STATE_STANDBY,
|
||||||
)
|
)
|
||||||
from homeassistant.core import CoreState
|
from homeassistant.core import CoreState
|
||||||
from homeassistant.helpers import entity_registry
|
from homeassistant.helpers import entity_registry as er
|
||||||
|
|
||||||
from tests.common import async_mock_service
|
from tests.common import async_mock_service
|
||||||
|
|
||||||
|
@ -421,7 +421,7 @@ async def test_tv_restore(hass, hk_driver, events):
|
||||||
"""Test setting up an entity from state in the event registry."""
|
"""Test setting up an entity from state in the event registry."""
|
||||||
hass.state = CoreState.not_running
|
hass.state = CoreState.not_running
|
||||||
|
|
||||||
registry = await entity_registry.async_get_registry(hass)
|
registry = er.async_get(hass)
|
||||||
|
|
||||||
registry.async_get_or_create(
|
registry.async_get_or_create(
|
||||||
"media_player",
|
"media_player",
|
||||||
|
|
|
@ -30,7 +30,7 @@ from homeassistant.const import (
|
||||||
TEMP_FAHRENHEIT,
|
TEMP_FAHRENHEIT,
|
||||||
)
|
)
|
||||||
from homeassistant.core import CoreState
|
from homeassistant.core import CoreState
|
||||||
from homeassistant.helpers import entity_registry
|
from homeassistant.helpers import entity_registry as er
|
||||||
|
|
||||||
|
|
||||||
async def test_temperature(hass, hk_driver):
|
async def test_temperature(hass, hk_driver):
|
||||||
|
@ -326,7 +326,7 @@ async def test_sensor_restore(hass, hk_driver, events):
|
||||||
"""Test setting up an entity from state in the event registry."""
|
"""Test setting up an entity from state in the event registry."""
|
||||||
hass.state = CoreState.not_running
|
hass.state = CoreState.not_running
|
||||||
|
|
||||||
registry = await entity_registry.async_get_registry(hass)
|
registry = er.async_get(hass)
|
||||||
|
|
||||||
registry.async_get_or_create(
|
registry.async_get_or_create(
|
||||||
"sensor",
|
"sensor",
|
||||||
|
|
|
@ -61,7 +61,7 @@ from homeassistant.const import (
|
||||||
TEMP_FAHRENHEIT,
|
TEMP_FAHRENHEIT,
|
||||||
)
|
)
|
||||||
from homeassistant.core import CoreState
|
from homeassistant.core import CoreState
|
||||||
from homeassistant.helpers import entity_registry
|
from homeassistant.helpers import entity_registry as er
|
||||||
|
|
||||||
from tests.common import async_mock_service
|
from tests.common import async_mock_service
|
||||||
|
|
||||||
|
@ -889,7 +889,7 @@ async def test_thermostat_restore(hass, hk_driver, events):
|
||||||
"""Test setting up an entity from state in the event registry."""
|
"""Test setting up an entity from state in the event registry."""
|
||||||
hass.state = CoreState.not_running
|
hass.state = CoreState.not_running
|
||||||
|
|
||||||
registry = await entity_registry.async_get_registry(hass)
|
registry = er.async_get(hass)
|
||||||
|
|
||||||
registry.async_get_or_create(
|
registry.async_get_or_create(
|
||||||
"climate", "generic", "1234", suggested_object_id="simple"
|
"climate", "generic", "1234", suggested_object_id="simple"
|
||||||
|
@ -1705,7 +1705,7 @@ async def test_water_heater_restore(hass, hk_driver, events):
|
||||||
"""Test setting up an entity from state in the event registry."""
|
"""Test setting up an entity from state in the event registry."""
|
||||||
hass.state = CoreState.not_running
|
hass.state = CoreState.not_running
|
||||||
|
|
||||||
registry = await entity_registry.async_get_registry(hass)
|
registry = er.async_get(hass)
|
||||||
|
|
||||||
registry.async_get_or_create(
|
registry.async_get_or_create(
|
||||||
"water_heater", "generic", "1234", suggested_object_id="simple"
|
"water_heater", "generic", "1234", suggested_object_id="simple"
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
"""Test against characteristics captured from a eufycam."""
|
"""Test against characteristics captured from a eufycam."""
|
||||||
|
from homeassistant.helpers import device_registry as dr, entity_registry as er
|
||||||
|
|
||||||
from tests.components.homekit_controller.common import (
|
from tests.components.homekit_controller.common import (
|
||||||
Helper,
|
Helper,
|
||||||
|
@ -12,7 +13,7 @@ async def test_eufycam_setup(hass):
|
||||||
accessories = await setup_accessories_from_file(hass, "anker_eufycam.json")
|
accessories = await setup_accessories_from_file(hass, "anker_eufycam.json")
|
||||||
config_entry, pairing = await setup_test_accessories(hass, accessories)
|
config_entry, pairing = await setup_test_accessories(hass, accessories)
|
||||||
|
|
||||||
entity_registry = await hass.helpers.entity_registry.async_get_registry()
|
entity_registry = er.async_get(hass)
|
||||||
|
|
||||||
# Check that the camera is correctly found and set up
|
# Check that the camera is correctly found and set up
|
||||||
camera_id = "camera.eufycam2_0000"
|
camera_id = "camera.eufycam2_0000"
|
||||||
|
@ -32,7 +33,7 @@ async def test_eufycam_setup(hass):
|
||||||
assert camera_state.state == "idle"
|
assert camera_state.state == "idle"
|
||||||
assert camera_state.attributes["supported_features"] == 0
|
assert camera_state.attributes["supported_features"] == 0
|
||||||
|
|
||||||
device_registry = await hass.helpers.device_registry.async_get_registry()
|
device_registry = dr.async_get(hass)
|
||||||
|
|
||||||
device = device_registry.async_get(camera.device_id)
|
device = device_registry.async_get(camera.device_id)
|
||||||
assert device.manufacturer == "Anker"
|
assert device.manufacturer == "Anker"
|
||||||
|
|
|
@ -5,6 +5,7 @@ https://github.com/home-assistant/core/issues/20957
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from homeassistant.components.light import SUPPORT_BRIGHTNESS, SUPPORT_COLOR
|
from homeassistant.components.light import SUPPORT_BRIGHTNESS, SUPPORT_COLOR
|
||||||
|
from homeassistant.helpers import device_registry as dr, entity_registry as er
|
||||||
|
|
||||||
from tests.components.homekit_controller.common import (
|
from tests.components.homekit_controller.common import (
|
||||||
Helper,
|
Helper,
|
||||||
|
@ -18,7 +19,7 @@ async def test_aqara_gateway_setup(hass):
|
||||||
accessories = await setup_accessories_from_file(hass, "aqara_gateway.json")
|
accessories = await setup_accessories_from_file(hass, "aqara_gateway.json")
|
||||||
config_entry, pairing = await setup_test_accessories(hass, accessories)
|
config_entry, pairing = await setup_test_accessories(hass, accessories)
|
||||||
|
|
||||||
entity_registry = await hass.helpers.entity_registry.async_get_registry()
|
entity_registry = er.async_get(hass)
|
||||||
|
|
||||||
# Check that the light is correctly found and set up
|
# Check that the light is correctly found and set up
|
||||||
alarm_id = "alarm_control_panel.aqara_hub_1563"
|
alarm_id = "alarm_control_panel.aqara_hub_1563"
|
||||||
|
@ -48,7 +49,7 @@ async def test_aqara_gateway_setup(hass):
|
||||||
SUPPORT_BRIGHTNESS | SUPPORT_COLOR
|
SUPPORT_BRIGHTNESS | SUPPORT_COLOR
|
||||||
)
|
)
|
||||||
|
|
||||||
device_registry = await hass.helpers.device_registry.async_get_registry()
|
device_registry = dr.async_get(hass)
|
||||||
|
|
||||||
# All the entities are services of the same accessory
|
# All the entities are services of the same accessory
|
||||||
# So it looks at the protocol like a single physical device
|
# So it looks at the protocol like a single physical device
|
||||||
|
|
|
@ -7,6 +7,8 @@ service-label-index despite not being linked to a service-label.
|
||||||
https://github.com/home-assistant/core/pull/39090
|
https://github.com/home-assistant/core/pull/39090
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
from homeassistant.helpers import entity_registry as er
|
||||||
|
|
||||||
from tests.common import assert_lists_same, async_get_device_automations
|
from tests.common import assert_lists_same, async_get_device_automations
|
||||||
from tests.components.homekit_controller.common import (
|
from tests.components.homekit_controller.common import (
|
||||||
setup_accessories_from_file,
|
setup_accessories_from_file,
|
||||||
|
@ -19,7 +21,7 @@ async def test_aqara_switch_setup(hass):
|
||||||
accessories = await setup_accessories_from_file(hass, "aqara_switch.json")
|
accessories = await setup_accessories_from_file(hass, "aqara_switch.json")
|
||||||
config_entry, pairing = await setup_test_accessories(hass, accessories)
|
config_entry, pairing = await setup_test_accessories(hass, accessories)
|
||||||
|
|
||||||
entity_registry = await hass.helpers.entity_registry.async_get_registry()
|
entity_registry = er.async_get(hass)
|
||||||
|
|
||||||
battery_id = "sensor.programmable_switch_battery"
|
battery_id = "sensor.programmable_switch_battery"
|
||||||
battery = entity_registry.async_get(battery_id)
|
battery = entity_registry.async_get(battery_id)
|
||||||
|
|
|
@ -15,6 +15,7 @@ from homeassistant.components.climate.const import (
|
||||||
SUPPORT_TARGET_TEMPERATURE_RANGE,
|
SUPPORT_TARGET_TEMPERATURE_RANGE,
|
||||||
)
|
)
|
||||||
from homeassistant.config_entries import ENTRY_STATE_SETUP_RETRY
|
from homeassistant.config_entries import ENTRY_STATE_SETUP_RETRY
|
||||||
|
from homeassistant.helpers import device_registry as dr, entity_registry as er
|
||||||
|
|
||||||
from tests.components.homekit_controller.common import (
|
from tests.components.homekit_controller.common import (
|
||||||
Helper,
|
Helper,
|
||||||
|
@ -30,7 +31,7 @@ async def test_ecobee3_setup(hass):
|
||||||
accessories = await setup_accessories_from_file(hass, "ecobee3.json")
|
accessories = await setup_accessories_from_file(hass, "ecobee3.json")
|
||||||
config_entry, pairing = await setup_test_accessories(hass, accessories)
|
config_entry, pairing = await setup_test_accessories(hass, accessories)
|
||||||
|
|
||||||
entity_registry = await hass.helpers.entity_registry.async_get_registry()
|
entity_registry = er.async_get(hass)
|
||||||
|
|
||||||
climate = entity_registry.async_get("climate.homew")
|
climate = entity_registry.async_get("climate.homew")
|
||||||
assert climate.unique_id == "homekit-123456789012-16"
|
assert climate.unique_id == "homekit-123456789012-16"
|
||||||
|
@ -73,7 +74,7 @@ async def test_ecobee3_setup(hass):
|
||||||
occ3 = entity_registry.async_get("binary_sensor.basement")
|
occ3 = entity_registry.async_get("binary_sensor.basement")
|
||||||
assert occ3.unique_id == "homekit-AB3C-56"
|
assert occ3.unique_id == "homekit-AB3C-56"
|
||||||
|
|
||||||
device_registry = await hass.helpers.device_registry.async_get_registry()
|
device_registry = dr.async_get(hass)
|
||||||
|
|
||||||
climate_device = device_registry.async_get(climate.device_id)
|
climate_device = device_registry.async_get(climate.device_id)
|
||||||
assert climate_device.manufacturer == "ecobee Inc."
|
assert climate_device.manufacturer == "ecobee Inc."
|
||||||
|
@ -112,7 +113,7 @@ async def test_ecobee3_setup_from_cache(hass, hass_storage):
|
||||||
|
|
||||||
await setup_test_accessories(hass, accessories)
|
await setup_test_accessories(hass, accessories)
|
||||||
|
|
||||||
entity_registry = await hass.helpers.entity_registry.async_get_registry()
|
entity_registry = er.async_get(hass)
|
||||||
|
|
||||||
climate = entity_registry.async_get("climate.homew")
|
climate = entity_registry.async_get("climate.homew")
|
||||||
assert climate.unique_id == "homekit-123456789012-16"
|
assert climate.unique_id == "homekit-123456789012-16"
|
||||||
|
@ -131,7 +132,7 @@ async def test_ecobee3_setup_connection_failure(hass):
|
||||||
"""Test that Ecbobee can be correctly setup from its cached entity map."""
|
"""Test that Ecbobee can be correctly setup from its cached entity map."""
|
||||||
accessories = await setup_accessories_from_file(hass, "ecobee3.json")
|
accessories = await setup_accessories_from_file(hass, "ecobee3.json")
|
||||||
|
|
||||||
entity_registry = await hass.helpers.entity_registry.async_get_registry()
|
entity_registry = er.async_get(hass)
|
||||||
|
|
||||||
# Test that the connection fails during initial setup.
|
# Test that the connection fails during initial setup.
|
||||||
# No entities should be created.
|
# No entities should be created.
|
||||||
|
@ -170,7 +171,7 @@ async def test_ecobee3_setup_connection_failure(hass):
|
||||||
|
|
||||||
async def test_ecobee3_add_sensors_at_runtime(hass):
|
async def test_ecobee3_add_sensors_at_runtime(hass):
|
||||||
"""Test that new sensors are automatically added."""
|
"""Test that new sensors are automatically added."""
|
||||||
entity_registry = await hass.helpers.entity_registry.async_get_registry()
|
entity_registry = er.async_get(hass)
|
||||||
|
|
||||||
# Set up a base Ecobee 3 with no additional sensors.
|
# Set up a base Ecobee 3 with no additional sensors.
|
||||||
# There shouldn't be any entities but climate visible.
|
# There shouldn't be any entities but climate visible.
|
||||||
|
|
|
@ -4,6 +4,8 @@ Regression tests for Ecobee occupancy.
|
||||||
https://github.com/home-assistant/core/issues/31827
|
https://github.com/home-assistant/core/issues/31827
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
from homeassistant.helpers import device_registry as dr, entity_registry as er
|
||||||
|
|
||||||
from tests.components.homekit_controller.common import (
|
from tests.components.homekit_controller.common import (
|
||||||
Helper,
|
Helper,
|
||||||
setup_accessories_from_file,
|
setup_accessories_from_file,
|
||||||
|
@ -16,7 +18,7 @@ async def test_ecobee_occupancy_setup(hass):
|
||||||
accessories = await setup_accessories_from_file(hass, "ecobee_occupancy.json")
|
accessories = await setup_accessories_from_file(hass, "ecobee_occupancy.json")
|
||||||
config_entry, pairing = await setup_test_accessories(hass, accessories)
|
config_entry, pairing = await setup_test_accessories(hass, accessories)
|
||||||
|
|
||||||
entity_registry = await hass.helpers.entity_registry.async_get_registry()
|
entity_registry = er.async_get(hass)
|
||||||
|
|
||||||
sensor = entity_registry.async_get("binary_sensor.master_fan")
|
sensor = entity_registry.async_get("binary_sensor.master_fan")
|
||||||
assert sensor.unique_id == "homekit-111111111111-56"
|
assert sensor.unique_id == "homekit-111111111111-56"
|
||||||
|
@ -27,7 +29,7 @@ async def test_ecobee_occupancy_setup(hass):
|
||||||
sensor_state = await sensor_helper.poll_and_get_state()
|
sensor_state = await sensor_helper.poll_and_get_state()
|
||||||
assert sensor_state.attributes["friendly_name"] == "Master Fan"
|
assert sensor_state.attributes["friendly_name"] == "Master Fan"
|
||||||
|
|
||||||
device_registry = await hass.helpers.device_registry.async_get_registry()
|
device_registry = dr.async_get(hass)
|
||||||
|
|
||||||
device = device_registry.async_get(sensor.device_id)
|
device = device_registry.async_get(sensor.device_id)
|
||||||
assert device.manufacturer == "ecobee Inc."
|
assert device.manufacturer == "ecobee Inc."
|
||||||
|
|
|
@ -5,6 +5,7 @@ from homeassistant.components.fan import (
|
||||||
SUPPORT_OSCILLATE,
|
SUPPORT_OSCILLATE,
|
||||||
SUPPORT_SET_SPEED,
|
SUPPORT_SET_SPEED,
|
||||||
)
|
)
|
||||||
|
from homeassistant.helpers import device_registry as dr, entity_registry as er
|
||||||
|
|
||||||
from tests.components.homekit_controller.common import (
|
from tests.components.homekit_controller.common import (
|
||||||
Helper,
|
Helper,
|
||||||
|
@ -20,7 +21,7 @@ async def test_homeassistant_bridge_fan_setup(hass):
|
||||||
)
|
)
|
||||||
config_entry, pairing = await setup_test_accessories(hass, accessories)
|
config_entry, pairing = await setup_test_accessories(hass, accessories)
|
||||||
|
|
||||||
entity_registry = await hass.helpers.entity_registry.async_get_registry()
|
entity_registry = er.async_get(hass)
|
||||||
|
|
||||||
# Check that the fan is correctly found and set up
|
# Check that the fan is correctly found and set up
|
||||||
fan_id = "fan.living_room_fan"
|
fan_id = "fan.living_room_fan"
|
||||||
|
@ -42,7 +43,7 @@ async def test_homeassistant_bridge_fan_setup(hass):
|
||||||
SUPPORT_DIRECTION | SUPPORT_SET_SPEED | SUPPORT_OSCILLATE
|
SUPPORT_DIRECTION | SUPPORT_SET_SPEED | SUPPORT_OSCILLATE
|
||||||
)
|
)
|
||||||
|
|
||||||
device_registry = await hass.helpers.device_registry.async_get_registry()
|
device_registry = dr.async_get(hass)
|
||||||
|
|
||||||
device = device_registry.async_get(fan.device_id)
|
device = device_registry.async_get(fan.device_id)
|
||||||
assert device.manufacturer == "Home Assistant"
|
assert device.manufacturer == "Home Assistant"
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
"""Tests for handling accessories on a Hue bridge via HomeKit."""
|
"""Tests for handling accessories on a Hue bridge via HomeKit."""
|
||||||
|
|
||||||
|
from homeassistant.helpers import device_registry as dr, entity_registry as er
|
||||||
|
|
||||||
from tests.common import assert_lists_same, async_get_device_automations
|
from tests.common import assert_lists_same, async_get_device_automations
|
||||||
from tests.components.homekit_controller.common import (
|
from tests.components.homekit_controller.common import (
|
||||||
Helper,
|
Helper,
|
||||||
|
@ -13,7 +15,7 @@ async def test_hue_bridge_setup(hass):
|
||||||
accessories = await setup_accessories_from_file(hass, "hue_bridge.json")
|
accessories = await setup_accessories_from_file(hass, "hue_bridge.json")
|
||||||
config_entry, pairing = await setup_test_accessories(hass, accessories)
|
config_entry, pairing = await setup_test_accessories(hass, accessories)
|
||||||
|
|
||||||
entity_registry = await hass.helpers.entity_registry.async_get_registry()
|
entity_registry = er.async_get(hass)
|
||||||
|
|
||||||
# Check that the battery is correctly found and set up
|
# Check that the battery is correctly found and set up
|
||||||
battery_id = "sensor.hue_dimmer_switch_battery"
|
battery_id = "sensor.hue_dimmer_switch_battery"
|
||||||
|
@ -28,7 +30,7 @@ async def test_hue_bridge_setup(hass):
|
||||||
assert battery_state.attributes["icon"] == "mdi:battery"
|
assert battery_state.attributes["icon"] == "mdi:battery"
|
||||||
assert battery_state.state == "100"
|
assert battery_state.state == "100"
|
||||||
|
|
||||||
device_registry = await hass.helpers.device_registry.async_get_registry()
|
device_registry = dr.async_get(hass)
|
||||||
|
|
||||||
device = device_registry.async_get(battery.device_id)
|
device = device_registry.async_get(battery.device_id)
|
||||||
assert device.manufacturer == "Philips"
|
assert device.manufacturer == "Philips"
|
||||||
|
|
|
@ -8,6 +8,7 @@ from aiohomekit.testing import FakePairing
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from homeassistant.components.light import SUPPORT_BRIGHTNESS, SUPPORT_COLOR
|
from homeassistant.components.light import SUPPORT_BRIGHTNESS, SUPPORT_COLOR
|
||||||
|
from homeassistant.helpers import device_registry as dr, entity_registry as er
|
||||||
import homeassistant.util.dt as dt_util
|
import homeassistant.util.dt as dt_util
|
||||||
|
|
||||||
from tests.common import async_fire_time_changed
|
from tests.common import async_fire_time_changed
|
||||||
|
@ -25,7 +26,7 @@ async def test_koogeek_ls1_setup(hass):
|
||||||
accessories = await setup_accessories_from_file(hass, "koogeek_ls1.json")
|
accessories = await setup_accessories_from_file(hass, "koogeek_ls1.json")
|
||||||
config_entry, pairing = await setup_test_accessories(hass, accessories)
|
config_entry, pairing = await setup_test_accessories(hass, accessories)
|
||||||
|
|
||||||
entity_registry = await hass.helpers.entity_registry.async_get_registry()
|
entity_registry = er.async_get(hass)
|
||||||
|
|
||||||
# Assert that the entity is correctly added to the entity registry
|
# Assert that the entity is correctly added to the entity registry
|
||||||
entry = entity_registry.async_get("light.koogeek_ls1_20833f")
|
entry = entity_registry.async_get("light.koogeek_ls1_20833f")
|
||||||
|
@ -44,7 +45,7 @@ async def test_koogeek_ls1_setup(hass):
|
||||||
SUPPORT_BRIGHTNESS | SUPPORT_COLOR
|
SUPPORT_BRIGHTNESS | SUPPORT_COLOR
|
||||||
)
|
)
|
||||||
|
|
||||||
device_registry = await hass.helpers.device_registry.async_get_registry()
|
device_registry = dr.async_get(hass)
|
||||||
|
|
||||||
device = device_registry.async_get(entry.device_id)
|
device = device_registry.async_get(entry.device_id)
|
||||||
assert device.manufacturer == "Koogeek"
|
assert device.manufacturer == "Koogeek"
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
"""Make sure that existing Koogeek P1EU support isn't broken."""
|
"""Make sure that existing Koogeek P1EU support isn't broken."""
|
||||||
|
|
||||||
|
from homeassistant.helpers import device_registry as dr, entity_registry as er
|
||||||
|
|
||||||
from tests.components.homekit_controller.common import (
|
from tests.components.homekit_controller.common import (
|
||||||
Helper,
|
Helper,
|
||||||
setup_accessories_from_file,
|
setup_accessories_from_file,
|
||||||
|
@ -12,8 +14,8 @@ async def test_koogeek_p1eu_setup(hass):
|
||||||
accessories = await setup_accessories_from_file(hass, "koogeek_p1eu.json")
|
accessories = await setup_accessories_from_file(hass, "koogeek_p1eu.json")
|
||||||
config_entry, pairing = await setup_test_accessories(hass, accessories)
|
config_entry, pairing = await setup_test_accessories(hass, accessories)
|
||||||
|
|
||||||
entity_registry = await hass.helpers.entity_registry.async_get_registry()
|
entity_registry = er.async_get(hass)
|
||||||
device_registry = await hass.helpers.device_registry.async_get_registry()
|
device_registry = dr.async_get(hass)
|
||||||
|
|
||||||
# Check that the switch entity is handled correctly
|
# Check that the switch entity is handled correctly
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@ from homeassistant.components.climate.const import (
|
||||||
SUPPORT_TARGET_TEMPERATURE,
|
SUPPORT_TARGET_TEMPERATURE,
|
||||||
SUPPORT_TARGET_TEMPERATURE_RANGE,
|
SUPPORT_TARGET_TEMPERATURE_RANGE,
|
||||||
)
|
)
|
||||||
|
from homeassistant.helpers import device_registry as dr, entity_registry as er
|
||||||
|
|
||||||
from tests.components.homekit_controller.common import (
|
from tests.components.homekit_controller.common import (
|
||||||
Helper,
|
Helper,
|
||||||
|
@ -21,7 +22,7 @@ async def test_lennox_e30_setup(hass):
|
||||||
accessories = await setup_accessories_from_file(hass, "lennox_e30.json")
|
accessories = await setup_accessories_from_file(hass, "lennox_e30.json")
|
||||||
config_entry, pairing = await setup_test_accessories(hass, accessories)
|
config_entry, pairing = await setup_test_accessories(hass, accessories)
|
||||||
|
|
||||||
entity_registry = await hass.helpers.entity_registry.async_get_registry()
|
entity_registry = er.async_get(hass)
|
||||||
|
|
||||||
climate = entity_registry.async_get("climate.lennox")
|
climate = entity_registry.async_get("climate.lennox")
|
||||||
assert climate.unique_id == "homekit-XXXXXXXX-100"
|
assert climate.unique_id == "homekit-XXXXXXXX-100"
|
||||||
|
@ -35,7 +36,7 @@ async def test_lennox_e30_setup(hass):
|
||||||
SUPPORT_TARGET_TEMPERATURE | SUPPORT_TARGET_TEMPERATURE_RANGE
|
SUPPORT_TARGET_TEMPERATURE | SUPPORT_TARGET_TEMPERATURE_RANGE
|
||||||
)
|
)
|
||||||
|
|
||||||
device_registry = await hass.helpers.device_registry.async_get_registry()
|
device_registry = dr.async_get(hass)
|
||||||
|
|
||||||
device = device_registry.async_get(climate.device_id)
|
device = device_registry.async_get(climate.device_id)
|
||||||
assert device.manufacturer == "Lennox"
|
assert device.manufacturer == "Lennox"
|
||||||
|
|
|
@ -5,6 +5,7 @@ from homeassistant.components.media_player.const import (
|
||||||
SUPPORT_PLAY,
|
SUPPORT_PLAY,
|
||||||
SUPPORT_SELECT_SOURCE,
|
SUPPORT_SELECT_SOURCE,
|
||||||
)
|
)
|
||||||
|
from homeassistant.helpers import device_registry as dr, entity_registry as er
|
||||||
|
|
||||||
from tests.common import async_get_device_automations
|
from tests.common import async_get_device_automations
|
||||||
from tests.components.homekit_controller.common import (
|
from tests.components.homekit_controller.common import (
|
||||||
|
@ -19,7 +20,7 @@ async def test_lg_tv(hass):
|
||||||
accessories = await setup_accessories_from_file(hass, "lg_tv.json")
|
accessories = await setup_accessories_from_file(hass, "lg_tv.json")
|
||||||
config_entry, pairing = await setup_test_accessories(hass, accessories)
|
config_entry, pairing = await setup_test_accessories(hass, accessories)
|
||||||
|
|
||||||
entity_registry = await hass.helpers.entity_registry.async_get_registry()
|
entity_registry = er.async_get(hass)
|
||||||
|
|
||||||
# Assert that the entity is correctly added to the entity registry
|
# Assert that the entity is correctly added to the entity registry
|
||||||
entry = entity_registry.async_get("media_player.lg_webos_tv_af80")
|
entry = entity_registry.async_get("media_player.lg_webos_tv_af80")
|
||||||
|
@ -54,7 +55,7 @@ async def test_lg_tv(hass):
|
||||||
# CURRENT_MEDIA_STATE. Therefore "ok" is the best we can say.
|
# CURRENT_MEDIA_STATE. Therefore "ok" is the best we can say.
|
||||||
assert state.state == "ok"
|
assert state.state == "ok"
|
||||||
|
|
||||||
device_registry = await hass.helpers.device_registry.async_get_registry()
|
device_registry = dr.async_get(hass)
|
||||||
|
|
||||||
device = device_registry.async_get(entry.device_id)
|
device = device_registry.async_get(entry.device_id)
|
||||||
assert device.manufacturer == "LG Electronics"
|
assert device.manufacturer == "LG Electronics"
|
||||||
|
|
|
@ -4,6 +4,8 @@ Make sure that existing RainMachine support isn't broken.
|
||||||
https://github.com/home-assistant/core/issues/31745
|
https://github.com/home-assistant/core/issues/31745
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
from homeassistant.helpers import device_registry as dr, entity_registry as er
|
||||||
|
|
||||||
from tests.components.homekit_controller.common import (
|
from tests.components.homekit_controller.common import (
|
||||||
Helper,
|
Helper,
|
||||||
setup_accessories_from_file,
|
setup_accessories_from_file,
|
||||||
|
@ -16,7 +18,7 @@ async def test_rainmachine_pro_8_setup(hass):
|
||||||
accessories = await setup_accessories_from_file(hass, "rainmachine-pro-8.json")
|
accessories = await setup_accessories_from_file(hass, "rainmachine-pro-8.json")
|
||||||
config_entry, pairing = await setup_test_accessories(hass, accessories)
|
config_entry, pairing = await setup_test_accessories(hass, accessories)
|
||||||
|
|
||||||
entity_registry = await hass.helpers.entity_registry.async_get_registry()
|
entity_registry = er.async_get(hass)
|
||||||
|
|
||||||
# Assert that the entity is correctly added to the entity registry
|
# Assert that the entity is correctly added to the entity registry
|
||||||
entry = entity_registry.async_get("switch.rainmachine_00ce4a")
|
entry = entity_registry.async_get("switch.rainmachine_00ce4a")
|
||||||
|
@ -30,7 +32,7 @@ async def test_rainmachine_pro_8_setup(hass):
|
||||||
# Assert that the friendly name is detected correctly
|
# Assert that the friendly name is detected correctly
|
||||||
assert state.attributes["friendly_name"] == "RainMachine-00ce4a"
|
assert state.attributes["friendly_name"] == "RainMachine-00ce4a"
|
||||||
|
|
||||||
device_registry = await hass.helpers.device_registry.async_get_registry()
|
device_registry = dr.async_get(hass)
|
||||||
|
|
||||||
device = device_registry.async_get(entry.device_id)
|
device = device_registry.async_get(entry.device_id)
|
||||||
assert device.manufacturer == "Green Electronics LLC"
|
assert device.manufacturer == "Green Electronics LLC"
|
||||||
|
|
|
@ -5,6 +5,7 @@ https://github.com/home-assistant/core/issues/26180
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from homeassistant.components.fan import SUPPORT_DIRECTION, SUPPORT_SET_SPEED
|
from homeassistant.components.fan import SUPPORT_DIRECTION, SUPPORT_SET_SPEED
|
||||||
|
from homeassistant.helpers import device_registry as dr, entity_registry as er
|
||||||
|
|
||||||
from tests.components.homekit_controller.common import (
|
from tests.components.homekit_controller.common import (
|
||||||
Helper,
|
Helper,
|
||||||
|
@ -18,7 +19,7 @@ async def test_simpleconnect_fan_setup(hass):
|
||||||
accessories = await setup_accessories_from_file(hass, "simpleconnect_fan.json")
|
accessories = await setup_accessories_from_file(hass, "simpleconnect_fan.json")
|
||||||
config_entry, pairing = await setup_test_accessories(hass, accessories)
|
config_entry, pairing = await setup_test_accessories(hass, accessories)
|
||||||
|
|
||||||
entity_registry = await hass.helpers.entity_registry.async_get_registry()
|
entity_registry = er.async_get(hass)
|
||||||
|
|
||||||
# Check that the fan is correctly found and set up
|
# Check that the fan is correctly found and set up
|
||||||
fan_id = "fan.simpleconnect_fan_06f674"
|
fan_id = "fan.simpleconnect_fan_06f674"
|
||||||
|
@ -40,7 +41,7 @@ async def test_simpleconnect_fan_setup(hass):
|
||||||
SUPPORT_DIRECTION | SUPPORT_SET_SPEED
|
SUPPORT_DIRECTION | SUPPORT_SET_SPEED
|
||||||
)
|
)
|
||||||
|
|
||||||
device_registry = await hass.helpers.device_registry.async_get_registry()
|
device_registry = dr.async_get(hass)
|
||||||
|
|
||||||
device = device_registry.async_get(fan.device_id)
|
device = device_registry.async_get(fan.device_id)
|
||||||
assert device.manufacturer == "Hunter Fan"
|
assert device.manufacturer == "Hunter Fan"
|
||||||
|
|
|
@ -9,6 +9,7 @@ from homeassistant.components.cover import (
|
||||||
SUPPORT_OPEN,
|
SUPPORT_OPEN,
|
||||||
SUPPORT_SET_POSITION,
|
SUPPORT_SET_POSITION,
|
||||||
)
|
)
|
||||||
|
from homeassistant.helpers import device_registry as dr, entity_registry as er
|
||||||
|
|
||||||
from tests.components.homekit_controller.common import (
|
from tests.components.homekit_controller.common import (
|
||||||
Helper,
|
Helper,
|
||||||
|
@ -22,7 +23,7 @@ async def test_simpleconnect_cover_setup(hass):
|
||||||
accessories = await setup_accessories_from_file(hass, "velux_gateway.json")
|
accessories = await setup_accessories_from_file(hass, "velux_gateway.json")
|
||||||
config_entry, pairing = await setup_test_accessories(hass, accessories)
|
config_entry, pairing = await setup_test_accessories(hass, accessories)
|
||||||
|
|
||||||
entity_registry = await hass.helpers.entity_registry.async_get_registry()
|
entity_registry = er.async_get(hass)
|
||||||
|
|
||||||
# Check that the cover is correctly found and set up
|
# Check that the cover is correctly found and set up
|
||||||
cover_id = "cover.velux_window"
|
cover_id = "cover.velux_window"
|
||||||
|
@ -64,7 +65,7 @@ async def test_simpleconnect_cover_setup(hass):
|
||||||
# The cover and sensor are different devices (accessories) attached to the same bridge
|
# The cover and sensor are different devices (accessories) attached to the same bridge
|
||||||
assert cover.device_id != sensor.device_id
|
assert cover.device_id != sensor.device_id
|
||||||
|
|
||||||
device_registry = await hass.helpers.device_registry.async_get_registry()
|
device_registry = dr.async_get(hass)
|
||||||
|
|
||||||
device = device_registry.async_get(cover.device_id)
|
device = device_registry.async_get(cover.device_id)
|
||||||
assert device.manufacturer == "VELUX"
|
assert device.manufacturer == "VELUX"
|
||||||
|
|
|
@ -5,6 +5,7 @@ import pytest
|
||||||
|
|
||||||
import homeassistant.components.automation as automation
|
import homeassistant.components.automation as automation
|
||||||
from homeassistant.components.homekit_controller.const import DOMAIN
|
from homeassistant.components.homekit_controller.const import DOMAIN
|
||||||
|
from homeassistant.helpers import device_registry as dr, entity_registry as er
|
||||||
from homeassistant.setup import async_setup_component
|
from homeassistant.setup import async_setup_component
|
||||||
|
|
||||||
from tests.common import (
|
from tests.common import (
|
||||||
|
@ -82,10 +83,10 @@ async def test_enumerate_remote(hass, utcnow):
|
||||||
"""Test that remote is correctly enumerated."""
|
"""Test that remote is correctly enumerated."""
|
||||||
await setup_test_component(hass, create_remote)
|
await setup_test_component(hass, create_remote)
|
||||||
|
|
||||||
entity_registry = await hass.helpers.entity_registry.async_get_registry()
|
entity_registry = er.async_get(hass)
|
||||||
entry = entity_registry.async_get("sensor.testdevice_battery")
|
entry = entity_registry.async_get("sensor.testdevice_battery")
|
||||||
|
|
||||||
device_registry = await hass.helpers.device_registry.async_get_registry()
|
device_registry = dr.async_get(hass)
|
||||||
device = device_registry.async_get(entry.device_id)
|
device = device_registry.async_get(entry.device_id)
|
||||||
|
|
||||||
expected = [
|
expected = [
|
||||||
|
@ -118,10 +119,10 @@ async def test_enumerate_button(hass, utcnow):
|
||||||
"""Test that a button is correctly enumerated."""
|
"""Test that a button is correctly enumerated."""
|
||||||
await setup_test_component(hass, create_button)
|
await setup_test_component(hass, create_button)
|
||||||
|
|
||||||
entity_registry = await hass.helpers.entity_registry.async_get_registry()
|
entity_registry = er.async_get(hass)
|
||||||
entry = entity_registry.async_get("sensor.testdevice_battery")
|
entry = entity_registry.async_get("sensor.testdevice_battery")
|
||||||
|
|
||||||
device_registry = await hass.helpers.device_registry.async_get_registry()
|
device_registry = dr.async_get(hass)
|
||||||
device = device_registry.async_get(entry.device_id)
|
device = device_registry.async_get(entry.device_id)
|
||||||
|
|
||||||
expected = [
|
expected = [
|
||||||
|
@ -153,10 +154,10 @@ async def test_enumerate_doorbell(hass, utcnow):
|
||||||
"""Test that a button is correctly enumerated."""
|
"""Test that a button is correctly enumerated."""
|
||||||
await setup_test_component(hass, create_doorbell)
|
await setup_test_component(hass, create_doorbell)
|
||||||
|
|
||||||
entity_registry = await hass.helpers.entity_registry.async_get_registry()
|
entity_registry = er.async_get(hass)
|
||||||
entry = entity_registry.async_get("sensor.testdevice_battery")
|
entry = entity_registry.async_get("sensor.testdevice_battery")
|
||||||
|
|
||||||
device_registry = await hass.helpers.device_registry.async_get_registry()
|
device_registry = dr.async_get(hass)
|
||||||
device = device_registry.async_get(entry.device_id)
|
device = device_registry.async_get(entry.device_id)
|
||||||
|
|
||||||
expected = [
|
expected = [
|
||||||
|
@ -188,10 +189,10 @@ async def test_handle_events(hass, utcnow, calls):
|
||||||
"""Test that events are handled."""
|
"""Test that events are handled."""
|
||||||
helper = await setup_test_component(hass, create_remote)
|
helper = await setup_test_component(hass, create_remote)
|
||||||
|
|
||||||
entity_registry = await hass.helpers.entity_registry.async_get_registry()
|
entity_registry = er.async_get(hass)
|
||||||
entry = entity_registry.async_get("sensor.testdevice_battery")
|
entry = entity_registry.async_get("sensor.testdevice_battery")
|
||||||
|
|
||||||
device_registry = await hass.helpers.device_registry.async_get_registry()
|
device_registry = dr.async_get(hass)
|
||||||
device = device_registry.async_get(entry.device_id)
|
device = device_registry.async_get(entry.device_id)
|
||||||
|
|
||||||
assert await async_setup_component(
|
assert await async_setup_component(
|
||||||
|
|
|
@ -41,8 +41,8 @@ async def test_hmip_remove_device(hass, default_mock_hap_factory):
|
||||||
assert ha_state.state == STATE_ON
|
assert ha_state.state == STATE_ON
|
||||||
assert hmip_device
|
assert hmip_device
|
||||||
|
|
||||||
device_registry = await dr.async_get_registry(hass)
|
device_registry = dr.async_get(hass)
|
||||||
entity_registry = await er.async_get_registry(hass)
|
entity_registry = er.async_get(hass)
|
||||||
|
|
||||||
pre_device_count = len(device_registry.devices)
|
pre_device_count = len(device_registry.devices)
|
||||||
pre_entity_count = len(entity_registry.entities)
|
pre_entity_count = len(entity_registry.entities)
|
||||||
|
@ -73,8 +73,8 @@ async def test_hmip_add_device(hass, default_mock_hap_factory, hmip_config_entry
|
||||||
assert ha_state.state == STATE_ON
|
assert ha_state.state == STATE_ON
|
||||||
assert hmip_device
|
assert hmip_device
|
||||||
|
|
||||||
device_registry = await dr.async_get_registry(hass)
|
device_registry = dr.async_get(hass)
|
||||||
entity_registry = await er.async_get_registry(hass)
|
entity_registry = er.async_get(hass)
|
||||||
|
|
||||||
pre_device_count = len(device_registry.devices)
|
pre_device_count = len(device_registry.devices)
|
||||||
pre_entity_count = len(entity_registry.entities)
|
pre_entity_count = len(entity_registry.entities)
|
||||||
|
@ -119,8 +119,8 @@ async def test_hmip_remove_group(hass, default_mock_hap_factory):
|
||||||
assert ha_state.state == STATE_ON
|
assert ha_state.state == STATE_ON
|
||||||
assert hmip_device
|
assert hmip_device
|
||||||
|
|
||||||
device_registry = await dr.async_get_registry(hass)
|
device_registry = dr.async_get(hass)
|
||||||
entity_registry = await er.async_get_registry(hass)
|
entity_registry = er.async_get(hass)
|
||||||
|
|
||||||
pre_device_count = len(device_registry.devices)
|
pre_device_count = len(device_registry.devices)
|
||||||
pre_entity_count = len(entity_registry.entities)
|
pre_entity_count = len(entity_registry.entities)
|
||||||
|
@ -257,12 +257,12 @@ async def test_hmip_multi_area_device(hass, default_mock_hap_factory):
|
||||||
assert ha_state
|
assert ha_state
|
||||||
|
|
||||||
# get the entity
|
# get the entity
|
||||||
entity_registry = await er.async_get_registry(hass)
|
entity_registry = er.async_get(hass)
|
||||||
entity = entity_registry.async_get(ha_state.entity_id)
|
entity = entity_registry.async_get(ha_state.entity_id)
|
||||||
assert entity
|
assert entity
|
||||||
|
|
||||||
# get the device
|
# get the device
|
||||||
device_registry = await dr.async_get_registry(hass)
|
device_registry = dr.async_get(hass)
|
||||||
device = device_registry.async_get(entity.device_id)
|
device = device_registry.async_get(entity.device_id)
|
||||||
assert device.name == "Wired Eingangsmodul – 32-fach"
|
assert device.name == "Wired Eingangsmodul – 32-fach"
|
||||||
|
|
||||||
|
|
|
@ -7,12 +7,7 @@ import aiohue
|
||||||
from homeassistant import config_entries
|
from homeassistant import config_entries
|
||||||
from homeassistant.components import hue
|
from homeassistant.components import hue
|
||||||
from homeassistant.components.hue import light as hue_light
|
from homeassistant.components.hue import light as hue_light
|
||||||
from homeassistant.helpers.device_registry import (
|
from homeassistant.helpers import device_registry as dr, entity_registry as er
|
||||||
async_get_registry as async_get_device_registry,
|
|
||||||
)
|
|
||||||
from homeassistant.helpers.entity_registry import (
|
|
||||||
async_get_registry as async_get_entity_registry,
|
|
||||||
)
|
|
||||||
from homeassistant.util import color
|
from homeassistant.util import color
|
||||||
|
|
||||||
HUE_LIGHT_NS = "homeassistant.components.light.hue."
|
HUE_LIGHT_NS = "homeassistant.components.light.hue."
|
||||||
|
@ -937,8 +932,8 @@ async def test_group_features(hass, mock_bridge):
|
||||||
group_3 = hass.states.get("light.dining_room")
|
group_3 = hass.states.get("light.dining_room")
|
||||||
assert group_3.attributes["supported_features"] == extended_color_feature
|
assert group_3.attributes["supported_features"] == extended_color_feature
|
||||||
|
|
||||||
entity_registry = await async_get_entity_registry(hass)
|
entity_registry = er.async_get(hass)
|
||||||
device_registry = await async_get_device_registry(hass)
|
device_registry = dr.async_get(hass)
|
||||||
|
|
||||||
entry = entity_registry.async_get("light.hue_lamp_1")
|
entry = entity_registry.async_get("light.hue_lamp_1")
|
||||||
device_entry = device_registry.async_get(entry.device_id)
|
device_entry = device_registry.async_get(entry.device_id)
|
||||||
|
|
|
@ -26,7 +26,7 @@ from homeassistant.const import (
|
||||||
SERVICE_TURN_OFF,
|
SERVICE_TURN_OFF,
|
||||||
SERVICE_TURN_ON,
|
SERVICE_TURN_ON,
|
||||||
)
|
)
|
||||||
from homeassistant.helpers.entity_registry import async_get_registry
|
from homeassistant.helpers import entity_registry as er
|
||||||
from homeassistant.helpers.typing import HomeAssistantType
|
from homeassistant.helpers.typing import HomeAssistantType
|
||||||
import homeassistant.util.color as color_util
|
import homeassistant.util.color as color_util
|
||||||
|
|
||||||
|
@ -109,7 +109,7 @@ async def test_setup_config_entry_not_ready_load_state_fail(
|
||||||
|
|
||||||
async def test_setup_config_entry_dynamic_instances(hass: HomeAssistantType) -> None:
|
async def test_setup_config_entry_dynamic_instances(hass: HomeAssistantType) -> None:
|
||||||
"""Test dynamic changes in the instance configuration."""
|
"""Test dynamic changes in the instance configuration."""
|
||||||
registry = await async_get_registry(hass)
|
registry = er.async_get(hass)
|
||||||
|
|
||||||
config_entry = add_test_config_entry(hass)
|
config_entry = add_test_config_entry(hass)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue