Hi all. I am trying to track which scene is currently activated in my bedroom (“Slaapkamer” in Dutch). In order to do so, I created a select_input
helper and an automation that listens to call_service
events, as so:
alias: Slaapkamer scene tracker
description: ''
trigger:
- platform: event
event_type: call_service
event_data:
domain: scene
service: turn_on
service_data:
entity_id: scene.slaapkamer_uit
- platform: event
event_type: call_service
event_data:
domain: scene
service: turn_on
service_data:
entity_id: scene.slaapkamer_nacht
- platform: event
event_type: call_service
event_data:
domain: scene
service: turn_on
service_data:
entity_id: scene.slaapkamer_fel
condition: []
action:
- service: input_select.select_option
target:
entity_id: input_select.slaapkamer_scenes
data_template:
option: >-
{{trigger.event.as_dict()['data']['service_data']['entity_id'].split('.')[1]}}
mode: single
This works. When I activate a scene from my dashboard, the variable changes. But I also have one of those small Ikea on/off buttons. I made a different automation that makes a service call to turn on a scene when I hit the button:
alias: Slaapkamer fel aan
description: ''
trigger:
- device_id: 9953220fc20a29dd6f6ae9f2db89015b
domain: deconz
platform: device
type: remote_button_short_press
subtype: turn_on
action:
- service: scene.turn_on
target:
entity_id: scene.slaapkamer_fel
mode: single
This automation also works. I hit the button and my light turns on. But when I do this, my first automation above is not triggered. But if I look at the events that get triggered, I do see the correct event:
{
"event_type": "call_service",
"data": {
"domain": "scene",
"service": "turn_on",
"service_data": {
"entity_id": [
"scene.slaapkamer_fel"
]
}
},
"origin": "LOCAL",
"time_fired": "2021-08-07T19:22:17.792653+00:00",
"context": {
"id": "3cd2a7224b072a834e13adf8c7755e11",
"parent_id": "6fecf59f5b1223ee63a1cf1d2b626458",
"user_id": null
}
}
Does anyone know why? Any idea how I can fix this? It does appear as if there is a difference between the entity_id when I activate a scene from the dashboard (a string) versus the event that I get from the button automation (an array containing a single string). Where does the difference come from? I do supply a string in my automation. Thanks in advance!