Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 4 additions & 15 deletions homeassistant/components/anthropic/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
entity_registry as er,
issue_registry as ir,
)
from homeassistant.helpers.typing import ConfigType
from homeassistant.helpers.typing import UNDEFINED, ConfigType, UndefinedType

from .const import CONF_CHAT_MODEL, DEFAULT_CONVERSATION_NAME, DOMAIN, LOGGER
from .coordinator import AnthropicConfigEntry, AnthropicCoordinator
Expand Down Expand Up @@ -137,7 +137,7 @@ async def async_migrate_integration(hass: HomeAssistant) -> None:
# Device and entity registries will set the disabled_by flag to None
# when moving a device or entity disabled by CONFIG_ENTRY to an enabled
# config entry, but we want to set it to USER instead,
device_disabled_by = device.disabled_by
device_disabled_by: dr.DeviceEntryDisabler | UndefinedType = UNDEFINED
if (
device.disabled_by is dr.DeviceEntryDisabler.CONFIG_ENTRY
and not all_disabled
Expand All @@ -147,20 +147,9 @@ async def async_migrate_integration(hass: HomeAssistant) -> None:
device.id,
disabled_by=device_disabled_by,
new_identifiers={(DOMAIN, subentry.subentry_id)},
add_config_subentry_id=subentry.subentry_id,
add_config_entry_id=parent_entry.entry_id,
new_config_entry_id=parent_entry.entry_id,
new_config_subentry_id=subentry.subentry_id,
)
if parent_entry.entry_id != entry.entry_id:
device_registry.async_update_device(
device.id,
remove_config_entry_id=entry.entry_id,
)
else:
device_registry.async_update_device(
device.id,
remove_config_entry_id=entry.entry_id,
remove_config_subentry_id=None,
)

if not use_existing:
await hass.config_entries.async_remove(entry.entry_id)
Expand Down
5 changes: 2 additions & 3 deletions homeassistant/components/github/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,8 @@ async def async_migrate_entry(hass: HomeAssistant, entry: GithubConfigEntry) ->
if device := dev_reg.async_get_device({(DOMAIN, repository)}):
dev_reg.async_update_device(
device.id,
remove_config_entry_id=entry.entry_id,
add_config_subentry_id=subentry.subentry_id,
add_config_entry_id=entry.entry_id,
new_config_entry_id=entry.entry_id,
new_config_subentry_id=subentry.subentry_id,
)
hass.config_entries.async_update_entry(entry, minor_version=2)
return True
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
device_registry as dr,
entity_registry as er,
)
from homeassistant.helpers.typing import ConfigType
from homeassistant.helpers.typing import UNDEFINED, ConfigType, UndefinedType

from .const import (
DEFAULT_AI_TASK_NAME,
Expand Down Expand Up @@ -182,7 +182,7 @@ async def async_migrate_integration(hass: HomeAssistant) -> None:
# Device and entity registries will set the disabled_by flag to None
# when moving a device or entity disabled by CONFIG_ENTRY to an enabled
# config entry, but we want to set it to USER instead,
device_disabled_by = device.disabled_by
device_disabled_by: dr.DeviceEntryDisabler | UndefinedType = UNDEFINED
if (
device.disabled_by is dr.DeviceEntryDisabler.CONFIG_ENTRY
and not all_disabled
Expand All @@ -192,20 +192,9 @@ async def async_migrate_integration(hass: HomeAssistant) -> None:
device.id,
disabled_by=device_disabled_by,
new_identifiers={(DOMAIN, subentry.subentry_id)},
add_config_subentry_id=subentry.subentry_id,
add_config_entry_id=parent_entry.entry_id,
new_config_entry_id=parent_entry.entry_id,
new_config_subentry_id=subentry.subentry_id,
)
if parent_entry.entry_id != entry.entry_id:
device_registry.async_update_device(
device.id,
remove_config_entry_id=entry.entry_id,
)
else:
device_registry.async_update_device(
device.id,
remove_config_entry_id=entry.entry_id,
remove_config_subentry_id=None,
)

if not use_existing:
await hass.config_entries.async_remove(entry.entry_id)
Expand Down
13 changes: 12 additions & 1 deletion homeassistant/components/knx/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -1025,7 +1025,18 @@
"title": "Information"
},
"project": {
"description": "Inspect imported group addresses",
"description": "Inspect imported project",
"devices": {
"channels": "Channels",
"group_objects": "Group objects",
"lines": "Lines",
"locations": "Locations",
"not_found": "No devices found in project data.",
"title": "Devices"
},
"group_addresses": {
"title": "[%key:component::knx::config_panel::common::group_addresses%]"
},
"title": "Project"
},
"selectors": {
Expand Down
3 changes: 1 addition & 2 deletions homeassistant/components/lifx/migration.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ def async_migrate_entities_devices(
migrated_devices.append(dev_entry.id)
device_registry.async_update_device(
dev_entry.id,
add_config_entry_id=new_entry.entry_id,
remove_config_entry_id=legacy_entry_id,
new_config_entry_id=new_entry.entry_id,
)

entity_registry = er.async_get(hass)
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/mitsubishi_comfort/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
"integration_type": "hub",
"iot_class": "local_polling",
"quality_scale": "bronze",
"requirements": ["mitsubishi-comfort==0.3.2"]
"requirements": ["mitsubishi-comfort==0.5.0"]
}
19 changes: 4 additions & 15 deletions homeassistant/components/ollama/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
device_registry as dr,
entity_registry as er,
)
from homeassistant.helpers.typing import ConfigType
from homeassistant.helpers.typing import UNDEFINED, ConfigType, UndefinedType
from homeassistant.util.ssl import get_default_context

from .const import (
Expand Down Expand Up @@ -192,7 +192,7 @@ async def async_migrate_integration(hass: HomeAssistant) -> None:
# Device and entity registries will set the disabled_by flag to None
# when moving a device or entity disabled by CONFIG_ENTRY to an enabled
# config entry, but we want to set it to USER instead,
device_disabled_by = device.disabled_by
device_disabled_by: dr.DeviceEntryDisabler | UndefinedType = UNDEFINED
if (
device.disabled_by is dr.DeviceEntryDisabler.CONFIG_ENTRY
and not all_disabled
Expand All @@ -202,20 +202,9 @@ async def async_migrate_integration(hass: HomeAssistant) -> None:
device.id,
disabled_by=device_disabled_by,
new_identifiers={(DOMAIN, subentry.subentry_id)},
add_config_subentry_id=subentry.subentry_id,
add_config_entry_id=parent_entry.entry_id,
new_config_entry_id=parent_entry.entry_id,
new_config_subentry_id=subentry.subentry_id,
)
if parent_entry.entry_id != entry.entry_id:
device_registry.async_update_device(
device.id,
remove_config_entry_id=entry.entry_id,
)
else:
device_registry.async_update_device(
device.id,
remove_config_entry_id=entry.entry_id,
remove_config_subentry_id=None,
)

if not use_existing:
await hass.config_entries.async_remove(entry.entry_id)
Expand Down
19 changes: 4 additions & 15 deletions homeassistant/components/openai_conversation/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
selector,
)
from homeassistant.helpers.httpx_client import get_async_client
from homeassistant.helpers.typing import ConfigType
from homeassistant.helpers.typing import UNDEFINED, ConfigType, UndefinedType

from .const import (
CONF_CHAT_MODEL,
Expand Down Expand Up @@ -386,7 +386,7 @@ async def async_migrate_integration(hass: HomeAssistant) -> None:
# Device and entity registries will set the disabled_by flag to None
# when moving a device or entity disabled by CONFIG_ENTRY to an enabled
# config entry, but we want to set it to USER instead,
device_disabled_by = device.disabled_by
device_disabled_by: dr.DeviceEntryDisabler | UndefinedType = UNDEFINED
if (
device.disabled_by is dr.DeviceEntryDisabler.CONFIG_ENTRY
and not all_disabled
Expand All @@ -396,20 +396,9 @@ async def async_migrate_integration(hass: HomeAssistant) -> None:
device.id,
disabled_by=device_disabled_by,
new_identifiers={(DOMAIN, subentry.subentry_id)},
add_config_subentry_id=subentry.subentry_id,
add_config_entry_id=parent_entry.entry_id,
new_config_entry_id=parent_entry.entry_id,
new_config_subentry_id=subentry.subentry_id,
)
if parent_entry.entry_id != entry.entry_id:
device_registry.async_update_device(
device.id,
remove_config_entry_id=entry.entry_id,
)
else:
device_registry.async_update_device(
device.id,
remove_config_entry_id=entry.entry_id,
remove_config_subentry_id=None,
)

if not use_existing:
await hass.config_entries.async_remove(entry.entry_id)
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/overkiz/cover.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,8 +354,8 @@ class OverkizCoverDescription(CoverEntityDescription):
# uiClass is Generic (not mapped to cover as this is a Generic device class)
OverkizCoverDescription(
key=UIWidget.RTS_GENERIC,
open_command=OverkizCommand.OPEN,
close_command=OverkizCommand.CLOSE,
open_command=OverkizCommand.UP,
close_command=OverkizCommand.DOWN,
stop_command=OverkizCommand.STOP,
),
##
Expand Down
13 changes: 2 additions & 11 deletions homeassistant/components/scrape/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,20 +236,11 @@ async def async_migrate_entry(hass: HomeAssistant, entry: ScrapeConfigEntry) ->
)
device_reg.async_update_device(
device.id,
add_config_entry_id=entry.entry_id,
add_config_subentry_id=subentry_id,
new_config_entry_id=entry.entry_id,
new_config_subentry_id=subentry_id,
new_identifiers=new_identifiers,
)

# Removing None from the list of subentries if existing
# as the device should only belong to the subentry
# and not the main config entry
device_reg.async_update_device(
device.id,
remove_config_entry_id=entry.entry_id,
remove_config_subentry_id=None,
)

# Update the resource config
new_config_entry_data = dict(entry.options)
new_config_entry_data[CONF_AUTH] = {}
Expand Down
5 changes: 2 additions & 3 deletions homeassistant/components/tado/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
OptionsFlow,
)
from homeassistant.core import callback
from homeassistant.exceptions import HomeAssistantError
from homeassistant.helpers.service_info.zeroconf import ZeroconfServiceInfo

from .const import (
Expand Down Expand Up @@ -223,9 +222,9 @@ async def async_step_init(
return self.async_show_form(step_id="init", data_schema=data_schema)


class CannotConnect(HomeAssistantError):
class CannotConnect(Exception):
"""Error to indicate we cannot connect."""


class TadoRateLimitExceeded(HomeAssistantError):
class TadoRateLimitExceeded(Exception):
"""Error to indicate Tado API rate limit exceeded."""
25 changes: 7 additions & 18 deletions homeassistant/components/waqi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
entity_registry as er,
)
from homeassistant.helpers.aiohttp_client import async_get_clientsession
from homeassistant.helpers.typing import ConfigType
from homeassistant.helpers.typing import UNDEFINED, ConfigType, UndefinedType

from .const import CONF_STATION_NUMBER, DOMAIN, SUBENTRY_TYPE_STATION
from .coordinator import WAQIConfigEntry, WAQIDataUpdateCoordinator
Expand Down Expand Up @@ -126,10 +126,10 @@ async def async_migrate_integration(hass: HomeAssistant) -> None:
)

if device is not None:
# Device and entity registries don't update the disabled_by flag when
# moving a device or entity from one config entry to another, so we
# need to do it manually.
device_disabled_by = device.disabled_by
# The device registry will set the disabled_by flag to None when
# moving a device disabled by CONFIG_ENTRY to an enabled config
# entry, but we want to set it to USER instead.
device_disabled_by: dr.DeviceEntryDisabler | UndefinedType = UNDEFINED
if (
device.disabled_by is dr.DeviceEntryDisabler.CONFIG_ENTRY
and not all_disabled
Expand All @@ -138,20 +138,9 @@ async def async_migrate_integration(hass: HomeAssistant) -> None:
device_registry.async_update_device(
device.id,
disabled_by=device_disabled_by,
add_config_subentry_id=subentry.subentry_id,
add_config_entry_id=parent_entry.entry_id,
new_config_entry_id=parent_entry.entry_id,
new_config_subentry_id=subentry.subentry_id,
)
if parent_entry.entry_id != entry.entry_id:
device_registry.async_update_device(
device.id,
remove_config_entry_id=entry.entry_id,
)
else:
device_registry.async_update_device(
device.id,
remove_config_entry_id=entry.entry_id,
remove_config_subentry_id=None,
)

if parent_entry.entry_id != entry.entry_id:
await hass.config_entries.async_remove(entry.entry_id)
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/zha/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"universal_silabs_flasher",
"serialx"
],
"requirements": ["zha==2.0.0", "zha-quirks==2.1.1"],
"requirements": ["zha==2.0.1", "zha-quirks==2.1.1"],
"usb": [
{
"description": "*2652*",
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/helpers/entity_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -1131,7 +1131,7 @@ def _validate_item(
)
if device_id and device_id is not UNDEFINED:
device_registry = dr.async_get(hass)
if not device_registry.async_get(device_id):
if device_id not in device_registry.devices:
raise ValueError(f"Device {device_id} does not exist")
if (
disabled_by
Expand Down
4 changes: 2 additions & 2 deletions requirements_all.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions tests/components/acaia/snapshots/test_init.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
# name: test_device
DeviceRegistryEntrySnapshot({
'area_id': 'kitchen',
'config_entries': <ANY>,
'config_entries_subentries': <ANY>,
'config_entry_id': <ANY>,
'config_subentry_id': <ANY>,
'configuration_url': None,
'connections': set({
tuple(
Expand All @@ -28,7 +28,6 @@
'model_id': None,
'name': 'LUNAR-DDEEFF',
'name_by_user': None,
'primary_config_entry': <ANY>,
'serial_number': None,
'sw_version': None,
'via_device_id': None,
Expand Down
Loading
Loading