home-assistant/core · error · InvalidDeviceAutomationConfig
BTHome trigger {event_type} is not valid for device_id '{dev
Error message
BTHome trigger {event_type} is not valid for device_id '{device_id}' What it means
Raised as InvalidDeviceAutomationConfig when a BTHome device automation trigger references an event subtype that the device does not actually advertise. During async_validate_trigger_config, the config is schema-validated, then the event subtype (CONF_SUBTYPE) is checked against get_event_types_by_event_class(event_class). A mismatch means the stored device no longer supports that button/switch event.
Source
Thrown at homeassistant/components/bthome/device_trigger.py:103
async def async_validate_trigger_config(
hass: HomeAssistant, config: ConfigType
) -> ConfigType:
"""Validate trigger config."""
config = TRIGGER_SCHEMA(config)
event_class = config[CONF_TYPE]
event_type = config[CONF_SUBTYPE]
device_id = config[CONF_DEVICE_ID]
event_classes = get_event_classes_by_device_id(hass, device_id)
if event_class not in event_classes:
raise InvalidDeviceAutomationConfig(
f"BTHome trigger {event_class} is not valid for device_id '{device_id}'"
)
if event_type not in get_event_types_by_event_class(event_class):
raise InvalidDeviceAutomationConfig(
f"BTHome trigger {event_type} is not valid for device_id '{device_id}'"
)
return config
async def async_get_triggers(
hass: HomeAssistant, device_id: str
) -> list[dict[str, Any]]:
"""Return a list of triggers for BTHome BLE devices."""
event_classes = get_event_classes_by_device_id(hass, device_id)
return [
{
# Required fields of TRIGGER_BASE_SCHEMA
CONF_PLATFORM: "device",
CONF_DEVICE_ID: device_id,
CONF_DOMAIN: DOMAIN,
# Required fields of TRIGGER_SCHEMAView on GitHub (pinned to 58a3fdb3ea)
Solutions
- Re-create the trigger via the UI (Settings > Automations) so the trigger is built from the device's currently advertised events
- Delete and re-pair the BTHome device so the coordinator re-discovers its event classes and subtypes
- Manually correct the subtype in the automation YAML to one reported by the device (check the BTHome advertisement data or the integration's event schema)
Example fix
# before (automation.yaml)
- triggers:
- trigger: device
domain: bthome
type: button
subtype: unknown_button # not advertised by this device
# after
- triggers:
- trigger: device
domain: bthome
type: button
subtype: button_1 # a subtype the device actually advertises Defensive patterns
Strategy: validation
Validate before calling
from homeassistant.helpers import config_validation as cv
from homeassistant.components.bthome.device_trigger import async_get_triggers
# Before installing an automation trigger, confirm the subtype is offered
triggers = await async_get_triggers(hass, device_id)
subtypes = {
t["subtype"] for t in triggers if t.get("type") == wanted_type
}
if wanted_subtype not in subtypes:
# skip or re-select instead of raising InvalidDeviceAutomationConfig
... Type guard
def is_valid_bthome_trigger(trigger: dict, available: list[dict]) -> bool:
return any(
t.get("type") == trigger.get("type")
and t.get("subtype") == trigger.get("subtype")
for t in available
) Try / catch
from homeassistant.helpers.device_automation import InvalidDeviceAutomationConfig
try:
await async_validate_trigger_config(hass, config)
except InvalidDeviceAutomationConfig as err:
# rebuild the trigger list for this device and prompt re-selection
logger.warning("Stale BTHome trigger: %s", err) Prevention
- Always create device triggers through the UI so subtypes come from the live device advertisement
- Re-pair the BTHome device after firmware changes and re-generate dependent automations
- Validate stored automation YAML against async_get_triggers output after device replacement
When it happens
Trigger: Calling async_validate_trigger_config (e.g. when an automation using a device trigger is loaded or validated) with a trigger whose type/subtype pair is not in the event types advertised by the BTHome device's parser for that event class. Happens when a device firmware changes its advertised data or the automation YAML was hand-edited or copied from another device.
Common situations: Copying automation YAML between different BTHome devices, a device firmware update that changes exposed buttons, or a stale device registry entry after a device was replaced/re-paired.
Related errors
- BTHome trigger {event_class} is not valid for device_id '{de
- Heat/Cool is not supported in this mode
- No entity_id provided and no preferred entity set
- AI Task entity {entity_id} not found
- AI Task entity {entity_id} does not support generating data
AI-assisted analysis of home-assistant/core@58a3fdb3ea (2026-08-14).
Data as JSON: /api/errors/9e9c72b1255dbbfd.
Report an issue: GitHub.