-
-
Notifications
You must be signed in to change notification settings - Fork 34.5k
Description
The problem
If you setup a template entity that can have an action (like a template switch), when picking actions for the selector you are offered the choice of using device actions.
You can set these up and save them, but when the template attemps to run the action, it does not work correctly and generates errors.
For example, a template switch using the demo "AC" device, turning it on and off with the switch template:
When this config flow is saved, the following object is sent:
{
"value_template": "{{ states('switch.ac') }}",
"turn_on": [
{
"type": "turn_on",
"device_id": "7b38e15c51e425157239d2159ed507de",
"entity_id": "0ccbc3947c67983d5ba21f931f9f6319",
"domain": "switch"
}
],
"turn_off": [
{
"type": "turn_off",
"device_id": "7b38e15c51e425157239d2159ed507de",
"entity_id": "0ccbc3947c67983d5ba21f931f9f6319",
"domain": "switch"
}
]
}
Everything is saved successfully. When you attempt to turn on or off the template switch, you will instead see an error:
2025-05-27 16:42:42.997 INFO (MainThread) [homeassistant.helpers.script.ac_template_turn_on] AC Template turn_on: Running template script
2025-05-27 16:42:42.997 INFO (MainThread) [homeassistant.helpers.script.ac_template_turn_on] AC Template turn_on: Executing step device automation
2025-05-27 16:42:42.997 ERROR (MainThread) [homeassistant.helpers.script.ac_template_turn_on] AC Template turn_on: Error executing script. Invalid data for device at pos 1: not a valid value for dictionary value @ data['entity_id']
The same actions work fine in an automation, just not via the template. It is probably missing some step to dereference the entity unique id, not sure what that is exactly.
While this error has probably always existed, you will need 2025.6 to see it, as on 2025.5 and earlier the frontend was broken and would break if you tried to add device actions here. That has been fixed in 2025.6, which now exposes the next failure.
What version of Home Assistant Core has the issue?
2025.6
What was the last working version of Home Assistant Core?
No response
What type of installation are you running?
Home Assistant OS
Integration causing the issue
Template
Link to integration documentation on our website
https://www.home-assistant.io/integrations/template/
Diagnostics information
No response
Example YAML snippet
Anything in the logs that might be useful for us?
Additional information
No response