I have several automatons that turn on light scenes throughout the day. I recently added an automation to call a command line script when specific scenes are activated. This works if I manually enable the scene using the web interface, however, it will not work if I activate the scene via an automation. I found the reason and it has to due with how the entity_id string is formatted in each case.
Here is what a manual scene activation looks like in the dev-event tool:
{
"event_type": "call_service",
"data": {
"domain": "scene",
"service": "turn_on",
"service_data": {
"entity_id": "scene.relax"
}
},
"origin": "LOCAL",
"time_fired": "2019-05-10T02:08:06.466463+00:00",
Here is what a scene activation looks like in the dev-event tool when called from another automation:
{
"event_type": "call_service",
"data": {
"domain": "scene",
"service": "turn_on",
"service_data": {
"entity_id": [
"scene.relax"
]
}
},
"origin": "LOCAL",
"time_fired": "2019-05-10T02:11:19.217490+00:00",
The difference seems to be the square braces around the entity_id.
In order to deal with this I had to create two automations, one to deal with the manual scene activation, and one for when an automation activates a scene:
- alias: 'Scene Automation - Romantic'
trigger:
platform: event
event_type: call_service
event_data:
service_data:
entity_id: [scene.romantic]
domain: scene
service: turn_on
action:
service: shell_command.dashboard_romantic
- alias: 'Scene Automation (Manual) - Romantic'
trigger:
platform: event
event_type: call_service
event_data:
service_data:
entity_id: scene.romantic
domain: scene
service: turn_on
action:
service: shell_command.dashboard_romantic
Is there any workaround for this? or syntax I can use to just have one of these “Scene Automation” entries? or is this a bug?
Thanks again!