Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 3 additions & 1 deletion homeassistant/components/august/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,9 @@ async def async_setup_august(


async def async_remove_config_entry_device(
hass: HomeAssistant, config_entry: AugustConfigEntry, device_entry: dr.DeviceEntry
hass: HomeAssistant,
config_entry: AugustConfigEntry,
device_entry: dr.AnyDeviceEntry,
) -> bool:
"""Remove august config entry from a device if its no longer present."""
return not any(
Expand Down
32 changes: 11 additions & 21 deletions homeassistant/components/blue_current/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import voluptuous as vol

from homeassistant.config_entries import ConfigEntry, ConfigEntryState
from homeassistant.config_entries import ConfigEntryState
from homeassistant.const import CONF_DEVICE_ID
from homeassistant.core import HomeAssistant, ServiceCall, callback
from homeassistant.exceptions import ServiceValidationError
Expand All @@ -27,37 +27,27 @@ async def start_charge_session(service_call: ServiceCall) -> None:
charging_card_id = service_call.data[CHARGING_CARD_ID]
device_id = service_call.data[CONF_DEVICE_ID]

# Get the device based on the given device ID.
device = dr.async_get(service_call.hass).devices.get(device_id)
device, config_entry = dr.async_get_device_and_config_entry_for_domain(
service_call.hass, device_id, domain=DOMAIN
)

if device is None:
raise ServiceValidationError(
translation_domain=DOMAIN, translation_key="invalid_device_id"
)

blue_current_config_entry: ConfigEntry | None = None

for config_entry_id in device.config_entries:
config_entry = service_call.hass.config_entries.async_get_entry(config_entry_id)
if not config_entry or config_entry.domain != DOMAIN:
# Not the blue_current config entry.
continue

if config_entry.state is not ConfigEntryState.LOADED:
raise ServiceValidationError(
translation_domain=DOMAIN, translation_key="config_entry_not_loaded"
)

blue_current_config_entry = config_entry
break

if not blue_current_config_entry:
if not config_entry:
# The device is not connected to a valid blue_current config entry.
raise ServiceValidationError(
translation_domain=DOMAIN, translation_key="no_config_entry"
)

connector = blue_current_config_entry.runtime_data
if config_entry.state is not ConfigEntryState.LOADED:
raise ServiceValidationError(
translation_domain=DOMAIN, translation_key="config_entry_not_loaded"
)

connector = config_entry.runtime_data

# Get the evse_id from the identifier of the device.
evse_id = next(
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/bond/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def _async_remove_old_device_identifiers(


async def async_remove_config_entry_device(
hass: HomeAssistant, config_entry: BondConfigEntry, device_entry: dr.DeviceEntry
hass: HomeAssistant, config_entry: BondConfigEntry, device_entry: dr.AnyDeviceEntry
) -> bool:
"""Remove bond config entry from a device."""
data = config_entry.runtime_data
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/cast/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ async def async_remove_entry(hass: HomeAssistant, entry: CastConfigEntry) -> Non


async def async_remove_config_entry_device(
hass: HomeAssistant, config_entry: CastConfigEntry, device_entry: dr.DeviceEntry
hass: HomeAssistant, config_entry: CastConfigEntry, device_entry: dr.AnyDeviceEntry
) -> bool:
"""Remove cast config entry from a device.

Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/coolmaster/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ async def async_unload_entry(hass: HomeAssistant, entry: CoolmasterConfigEntry)
async def async_remove_config_entry_device(
hass: HomeAssistant,
config_entry: CoolmasterConfigEntry,
device_entry: dr.DeviceEntry,
device_entry: dr.AnyDeviceEntry,
) -> bool:
"""Remove a config entry from a device."""
return not device_entry.identifiers.intersection(
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/devolo_home_control/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME, EVENT_HOMEASSISTANT_STOP
from homeassistant.core import Event, HomeAssistant
from homeassistant.exceptions import ConfigEntryAuthFailed, ConfigEntryNotReady
from homeassistant.helpers.device_registry import DeviceEntry
from homeassistant.helpers.device_registry import AnyDeviceEntry

from .const import DOMAIN, PLATFORMS

Expand Down Expand Up @@ -91,7 +91,7 @@ async def async_unload_entry(
async def async_remove_config_entry_device(
hass: HomeAssistant,
config_entry: DevoloHomeControlConfigEntry,
device_entry: DeviceEntry,
device_entry: AnyDeviceEntry,
) -> bool:
"""Remove a config entry from a device."""
return True
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/eheimdigital/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from homeassistant.const import Platform
from homeassistant.core import HomeAssistant
from homeassistant.helpers import device_registry as dr
from homeassistant.helpers.device_registry import DeviceEntry
from homeassistant.helpers.device_registry import AnyDeviceEntry

from .const import DOMAIN
from .coordinator import EheimDigitalConfigEntry, EheimDigitalUpdateCoordinator
Expand Down Expand Up @@ -61,7 +61,7 @@ async def async_unload_entry(
async def async_remove_config_entry_device(
hass: HomeAssistant,
config_entry: EheimDigitalConfigEntry,
device_entry: DeviceEntry,
device_entry: AnyDeviceEntry,
) -> bool:
"""Remove a config entry from a device."""
return not any(
Expand Down
4 changes: 3 additions & 1 deletion homeassistant/components/enphase_envoy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,9 @@ async def async_unload_entry(hass: HomeAssistant, entry: EnphaseConfigEntry) ->


async def async_remove_config_entry_device(
hass: HomeAssistant, config_entry: EnphaseConfigEntry, device_entry: dr.DeviceEntry
hass: HomeAssistant,
config_entry: EnphaseConfigEntry,
device_entry: dr.AnyDeviceEntry,
) -> bool:
"""Remove an enphase_envoy config entry from a device."""
dev_ids = {dev_id[1] for dev_id in device_entry.identifiers if dev_id[0] == DOMAIN}
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/fibaro/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import ConfigEntryAuthFailed, ConfigEntryNotReady
from homeassistant.helpers import device_registry as dr
from homeassistant.helpers.device_registry import DeviceEntry, DeviceInfo
from homeassistant.helpers.device_registry import AnyDeviceEntry, DeviceInfo
from homeassistant.util import slugify

from .const import CONF_IMPORT_PLUGINS, DOMAIN
Expand Down Expand Up @@ -353,7 +353,7 @@ async def async_unload_entry(hass: HomeAssistant, entry: FibaroConfigEntry) -> b


async def async_remove_config_entry_device(
hass: HomeAssistant, config_entry: FibaroConfigEntry, device_entry: DeviceEntry
hass: HomeAssistant, config_entry: FibaroConfigEntry, device_entry: AnyDeviceEntry
) -> bool:
"""Remove a device entry from fibaro integration.

Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/fjaraskupan/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ async def async_unload_entry(
async def async_remove_config_entry_device(
hass: HomeAssistant,
config_entry: FjaraskupanConfigEntry,
device_entry: dr.DeviceEntry,
device_entry: dr.AnyDeviceEntry,
) -> bool:
"""Remove a config entry from a device."""
for service_info in async_discovered_service_info(hass, False):
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/fritzbox/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from homeassistant.components.binary_sensor import DOMAIN as BINARY_SENSOR_DOMAIN
from homeassistant.const import EVENT_HOMEASSISTANT_STOP, UnitOfTemperature
from homeassistant.core import Event, HomeAssistant
from homeassistant.helpers.device_registry import DeviceEntry
from homeassistant.helpers.device_registry import AnyDeviceEntry
from homeassistant.helpers.entity_registry import RegistryEntry, async_migrate_entries

from .const import DOMAIN, LOGGER, PLATFORMS
Expand Down Expand Up @@ -66,7 +66,7 @@ async def async_unload_entry(hass: HomeAssistant, entry: FritzboxConfigEntry) ->


async def async_remove_config_entry_device(
hass: HomeAssistant, entry: FritzboxConfigEntry, device: DeviceEntry
hass: HomeAssistant, entry: FritzboxConfigEntry, device: AnyDeviceEntry
) -> bool:
"""Remove Fritzbox config entry from a device."""
coordinator = entry.runtime_data
Expand Down
4 changes: 3 additions & 1 deletion homeassistant/components/fronius/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ async def async_unload_entry(hass: HomeAssistant, entry: FroniusConfigEntry) ->


async def async_remove_config_entry_device(
hass: HomeAssistant, config_entry: FroniusConfigEntry, device_entry: dr.DeviceEntry
hass: HomeAssistant,
config_entry: FroniusConfigEntry,
device_entry: dr.AnyDeviceEntry,
) -> bool:
"""Remove a config entry from a device."""
return True
Expand Down
5 changes: 4 additions & 1 deletion homeassistant/components/heos/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,12 @@ async def async_unload_entry(hass: HomeAssistant, entry: HeosConfigEntry) -> boo


async def async_remove_config_entry_device(
hass: HomeAssistant, entry: HeosConfigEntry, device: dr.DeviceEntry
hass: HomeAssistant, entry: HeosConfigEntry, device: dr.AnyDeviceEntry
) -> bool:
"""Remove config entry from device if no longer present."""
if not isinstance(device, dr.DeviceEntry):
# This integration does not create child devices.
return False
return not any(
(domain, key)
for domain, key in device.identifiers
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/hive/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ async def async_remove_entry(hass: HomeAssistant, entry: HiveConfigEntry) -> Non


async def async_remove_config_entry_device(
hass: HomeAssistant, config_entry: HiveConfigEntry, device_entry: dr.DeviceEntry
hass: HomeAssistant, config_entry: HiveConfigEntry, device_entry: dr.AnyDeviceEntry
) -> bool:
"""Remove a config entry from a device."""
return True
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/homekit_controller/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ async def async_remove_entry(hass: HomeAssistant, entry: ConfigEntry) -> None:


async def async_remove_config_entry_device(
hass: HomeAssistant, config_entry: ConfigEntry, device_entry: dr.DeviceEntry
hass: HomeAssistant, config_entry: ConfigEntry, device_entry: dr.AnyDeviceEntry
) -> bool:
"""Remove homekit_controller config entry from a device."""
hkid = config_entry.data["AccessoryPairingID"]
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/ibeacon/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from homeassistant.helpers import device_registry as dr
from homeassistant.helpers.device_registry import DeviceEntry
from homeassistant.helpers.device_registry import AnyDeviceEntry

from .const import DOMAIN, PLATFORMS
from .coordinator import IBeaconCoordinator
Expand All @@ -27,7 +27,7 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:


async def async_remove_config_entry_device(
hass: HomeAssistant, config_entry: IBeaconConfigEntry, device_entry: DeviceEntry
hass: HomeAssistant, config_entry: IBeaconConfigEntry, device_entry: AnyDeviceEntry
) -> bool:
"""Remove iBeacon config entry from a device."""
coordinator = config_entry.runtime_data
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/isy994/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ async def async_unload_entry(hass: HomeAssistant, entry: IsyConfigEntry) -> bool
async def async_remove_config_entry_device(
hass: HomeAssistant,
config_entry: IsyConfigEntry,
device_entry: dr.DeviceEntry,
device_entry: dr.AnyDeviceEntry,
) -> bool:
"""Remove ISY config entry from a device."""
return not device_entry.identifiers.intersection(
Expand Down
4 changes: 3 additions & 1 deletion homeassistant/components/jellyfin/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ async def async_unload_entry(hass: HomeAssistant, entry: JellyfinConfigEntry) ->


async def async_remove_config_entry_device(
hass: HomeAssistant, config_entry: JellyfinConfigEntry, device_entry: dr.DeviceEntry
hass: HomeAssistant,
config_entry: JellyfinConfigEntry,
device_entry: dr.AnyDeviceEntry,
) -> bool:
"""Remove device from a config entry."""
coordinator = config_entry.runtime_data
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/kitchen_sink/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
)
from homeassistant.core import HomeAssistant
from homeassistant.helpers import config_validation as cv
from homeassistant.helpers.device_registry import DeviceEntry
from homeassistant.helpers.device_registry import AnyDeviceEntry
from homeassistant.helpers.issue_registry import (
IssueSeverity,
async_create_issue,
Expand Down Expand Up @@ -142,7 +142,7 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:


async def async_remove_config_entry_device(
hass: HomeAssistant, config_entry: ConfigEntry, device_entry: DeviceEntry
hass: HomeAssistant, config_entry: ConfigEntry, device_entry: AnyDeviceEntry
) -> bool:
"""Remove a config entry from a device."""

Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/knx/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import ConfigEntryNotReady
from homeassistant.helpers import entity_registry as er
from homeassistant.helpers.device_registry import DeviceEntry
from homeassistant.helpers.device_registry import AnyDeviceEntry
from homeassistant.helpers.reload import async_integration_yaml_config
from homeassistant.helpers.storage import STORAGE_DIR
from homeassistant.helpers.typing import ConfigType
Expand Down Expand Up @@ -278,7 +278,7 @@ def remove_files(storage_dir: Path, knxkeys_filename: str | None) -> None:


async def async_remove_config_entry_device(
hass: HomeAssistant, config_entry: ConfigEntry, device_entry: DeviceEntry
hass: HomeAssistant, config_entry: ConfigEntry, device_entry: AnyDeviceEntry
) -> bool:
"""Remove a config entry from a device."""
knx_module = hass.data[KNX_MODULE_KEY]
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/litterrobot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from homeassistant.core import HomeAssistant
from homeassistant.helpers import config_validation as cv
from homeassistant.helpers.aiohttp_client import async_get_clientsession
from homeassistant.helpers.device_registry import DeviceEntry
from homeassistant.helpers.device_registry import AnyDeviceEntry
from homeassistant.helpers.typing import ConfigType

from .const import DOMAIN
Expand Down Expand Up @@ -97,7 +97,7 @@ async def async_unload_entry(


async def async_remove_config_entry_device(
hass: HomeAssistant, entry: LitterRobotConfigEntry, device_entry: DeviceEntry
hass: HomeAssistant, entry: LitterRobotConfigEntry, device_entry: AnyDeviceEntry
) -> bool:
"""Remove a config entry from a device."""
return not any(
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/lookin/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ async def async_unload_entry(hass: HomeAssistant, entry: LookinConfigEntry) -> b


async def async_remove_config_entry_device(
hass: HomeAssistant, entry: LookinConfigEntry, device_entry: dr.DeviceEntry
hass: HomeAssistant, entry: LookinConfigEntry, device_entry: dr.AnyDeviceEntry
) -> bool:
"""Remove lookin config entry from a device."""
data = entry.runtime_data
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/lutron_caseta/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ def _id_to_identifier(lutron_id: str) -> tuple[str, str]:


async def async_remove_config_entry_device(
hass: HomeAssistant, entry: LutronCasetaConfigEntry, device_entry: dr.DeviceEntry
hass: HomeAssistant, entry: LutronCasetaConfigEntry, device_entry: dr.AnyDeviceEntry
) -> bool:
"""Remove lutron_caseta config entry from a device."""
data = entry.runtime_data
Expand Down
1 change: 1 addition & 0 deletions homeassistant/components/lyngdorf/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@

PLATFORMS: list[Platform] = [
Platform.MEDIA_PLAYER,
Platform.SENSOR,
]
CONF_SERIAL_NUMBER = "serial_number"
27 changes: 27 additions & 0 deletions homeassistant/components/lyngdorf/icons.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"entity": {
"sensor": {
"audio_information": {
"default": "mdi:surround-sound"
},
"audio_input": {
"default": "mdi:audio-input-stereo-minijack"
},
"streaming_source": {
"default": "mdi:cast-audio"
},
"video_information": {
"default": "mdi:television"
},
"video_input": {
"default": "mdi:video-input-hdmi"
},
"zone_b_audio_input": {
"default": "mdi:audio-input-stereo-minijack"
},
"zone_b_streaming_source": {
"default": "mdi:cast-audio"
}
}
}
}
2 changes: 1 addition & 1 deletion homeassistant/components/lyngdorf/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"iot_class": "local_push",
"loggers": ["lyngdorf", "async_upnp_client"],
"quality_scale": "silver",
"requirements": ["lyngdorf==1.4.9"],
"requirements": ["lyngdorf==1.6.0"],
"ssdp": [
{
"deviceType": "urn:schemas-upnp-org:device:MediaRenderer:2",
Expand Down
Loading
Loading