diff --git a/homeassistant/helpers/entity_registry.py b/homeassistant/helpers/entity_registry.py index d495d196440..cd1be43690d 100644 --- a/homeassistant/helpers/entity_registry.py +++ b/homeassistant/helpers/entity_registry.py @@ -327,7 +327,6 @@ class EntityRegistry: disabled_by: RegistryEntryDisabler | None = None, hidden_by: RegistryEntryHider | None = None, # Data that we want entry to have - area_id: str | None | UndefinedType = UNDEFINED, capabilities: Mapping[str, Any] | None | UndefinedType = UNDEFINED, config_entry: ConfigEntry | None | UndefinedType = UNDEFINED, device_id: str | None | UndefinedType = UNDEFINED, @@ -353,7 +352,6 @@ class EntityRegistry: if entity_id: return self.async_update_entity( entity_id, - area_id=area_id, capabilities=capabilities, config_entry_id=config_entry_id, device_id=device_id, @@ -404,7 +402,6 @@ class EntityRegistry: return None if value is UNDEFINED else value entry = RegistryEntry( - area_id=none_if_undefined(area_id), capabilities=none_if_undefined(capabilities), config_entry_id=none_if_undefined(config_entry_id), device_id=none_if_undefined(device_id), diff --git a/tests/components/cloud/test_google_config.py b/tests/components/cloud/test_google_config.py index a86f1f3cf8a..20bca347590 100644 --- a/tests/components/cloud/test_google_config.py +++ b/tests/components/cloud/test_google_config.py @@ -197,9 +197,8 @@ async def test_google_device_registry_sync(hass, mock_cloud_login, cloud_prefs): hass, GACTIONS_SCHEMA({}), "mock-user-id", cloud_prefs, hass.data["cloud"] ) ent_reg = er.async_get(hass) - entity_entry = ent_reg.async_get_or_create( - "light", "hue", "1234", device_id="1234", area_id="ABCD" - ) + entity_entry = ent_reg.async_get_or_create("light", "hue", "1234", device_id="1234") + entity_entry = ent_reg.async_update_entity(entity_entry.entity_id, area_id="ABCD") with patch.object(config, "async_sync_entities_all"): await config.async_initialize() diff --git a/tests/components/google_assistant/test_smart_home.py b/tests/components/google_assistant/test_smart_home.py index 684a6db2640..eefa163bdd8 100644 --- a/tests/components/google_assistant/test_smart_home.py +++ b/tests/components/google_assistant/test_smart_home.py @@ -232,7 +232,9 @@ async def test_sync_in_area(area_on_device, hass, registries): "1235", suggested_object_id="demo_light", device_id=device.id, - area_id=area.id if not area_on_device else None, + ) + entity = registries.entity.async_update_entity( + entity.entity_id, area_id=area.id if not area_on_device else None ) light = DemoLight( diff --git a/tests/helpers/test_entity_registry.py b/tests/helpers/test_entity_registry.py index e4c371a0198..8ccba2c7ecc 100644 --- a/tests/helpers/test_entity_registry.py +++ b/tests/helpers/test_entity_registry.py @@ -73,7 +73,6 @@ def test_get_or_create_updates_data(registry): "light", "hue", "5678", - area_id="mock-area-id", capabilities={"max": 100}, config_entry=orig_config_entry, device_id="mock-dev-id", @@ -92,7 +91,6 @@ def test_get_or_create_updates_data(registry): "light.hue_5678", "5678", "hue", - area_id="mock-area-id", capabilities={"max": 100}, config_entry_id=orig_config_entry.entry_id, device_class=None, @@ -117,8 +115,7 @@ def test_get_or_create_updates_data(registry): "light", "hue", "5678", - area_id="new-mock-area-id", - capabilities={"new-max": 100}, + capabilities={"new-max": 150}, config_entry=new_config_entry, device_id="new-mock-dev-id", disabled_by=er.RegistryEntryDisabler.USER, @@ -136,8 +133,8 @@ def test_get_or_create_updates_data(registry): "light.hue_5678", "5678", "hue", - area_id="new-mock-area-id", - capabilities={"new-max": 100}, + area_id=None, + capabilities={"new-max": 150}, config_entry_id=new_config_entry.entry_id, device_class=None, device_id="new-mock-dev-id", @@ -159,7 +156,6 @@ def test_get_or_create_updates_data(registry): "light", "hue", "5678", - area_id=None, capabilities=None, config_entry=None, device_id=None, @@ -235,7 +231,6 @@ async def test_loading_saving_data(hass, registry): "light", "hue", "5678", - area_id="mock-area-id", capabilities={"max": 100}, config_entry=mock_config, device_id="mock-dev-id", @@ -251,6 +246,7 @@ async def test_loading_saving_data(hass, registry): ) registry.async_update_entity( orig_entry2.entity_id, + area_id="mock-area-id", device_class="user-class", name="User Name", icon="hass:user-icon", diff --git a/tests/helpers/test_template.py b/tests/helpers/test_template.py index fb57eff7685..3186c10b20e 100644 --- a/tests/helpers/test_template.py +++ b/tests/helpers/test_template.py @@ -2768,13 +2768,13 @@ async def test_area_entities(hass): assert info.rate_limit is None area_entry = area_registry.async_get_or_create("sensor.fake") - entity_registry.async_get_or_create( + entity_entry = entity_registry.async_get_or_create( "light", "hue", "5678", config_entry=config_entry, - area_id=area_entry.id, ) + entity_registry.async_update_entity(entity_entry.entity_id, area_id=area_entry.id) info = render_to_info(hass, f"{{{{ area_entities('{area_entry.id}') }}}}") assert_result_info(info, ["light.hue_5678"])