home-assistant/core · warning · ServiceValidationError

invalid_device_id

invalid_device_id

Error message

Invalid device ID: {device_id}

What it means

ServiceValidationError raised when resolving a `device_id` passed to a bsblan service/action: the device registry lookup (`async_get(device_id, include_child_devices=False)`) returns None, meaning no device with that exact ID exists (or only a parent of a child device matches, since child devices are excluded). Translation key `invalid_device_id` includes the offending ID.

Source

Thrown at homeassistant/components/bsblan/services.py:135

    modify that day.
    """
    return {
        day_name: _convert_time_slots_to_day_schedule(service_call.data.get(attr_name))
        for day_name, attr_name in _DAY_NAME_SLOT_ATTR_PAIRS
    }


def _resolve_config_entry(
    service_call: ServiceCall,
) -> tuple[BSBLanConfigEntry, dr.DeviceEntry]:
    """Resolve device_id from a service call into a loaded BSBLAN config entry."""
    device_id: str = service_call.data[ATTR_DEVICE_ID]

    device_registry = dr.async_get(service_call.hass)
    device_entry = device_registry.async_get(device_id, include_child_devices=False)

    if device_entry is None:
        raise ServiceValidationError(
            translation_domain=DOMAIN,
            translation_key="invalid_device_id",
            translation_placeholders={"device_id": device_id},
        )

    # Find the config entry for this device
    matching_entries: list[BSBLanConfigEntry] = [
        entry
        for entry in service_call.hass.config_entries.async_entries(DOMAIN)
        if entry.entry_id in device_entry.config_entries
    ]

    if not matching_entries:
        raise ServiceValidationError(
            translation_domain=DOMAIN,
            translation_key="no_config_entry_for_device",
            translation_placeholders={"device_id": device_entry.name or device_id},
        )

View on GitHub (pinned to 58a3fdb3ea)

Solutions

  1. Re-pick the device in the action's device selector UI, which only offers valid current devices.
  2. Update hardcoded device_id values in automations/scripts after re-adding an integration.
  3. Find the current ID via Developer Tools > States or the device registry (include_child_devices=False means you must target the exact sub-device).

Example fix

// before
action: bsblan.set_hot_water_schedule
data: {device_id: "0a1b2c3d OLD_STALE_ID"}
// after — use the current device id from Developer Tools > States
action: bsblan.set_hot_water_schedule
data: {device_id: "9f8e7d6cCURRENT_ID"}
Defensive patterns

Strategy: validation

Validate before calling

# in Developer Tools > Template, verify the id resolves to a device
{{ device_id | string in device_entities or (devices | selectattr('id','equalto',device_id) | list | length > 0) }}

Prevention

When it happens

Trigger: Calling a bsblan action (set_hot_water_schedule, sync_time) with a stale, typo'd, or parent-device `device_id`, e.g. one copied from an old automation after the device was re-added and got a new registry ID.

Common situations: Devices removed and re-discovered (new device_id), automations/scripts with hardcoded old IDs, passing the hub/controller device instead of the sub-device, or YAML authoring with fabricated IDs.

Related errors


AI-assisted analysis of home-assistant/core@58a3fdb3ea (2026-08-14). Data as JSON: /api/errors/ca07d3fe2bee765e. Report an issue: GitHub.