Question
I've tried a few things here but seem stuck regarding action_templates and nested data.
First, the setup..
The Bilresa when paired creates a hole heap of event-entities, one for the button, one for scrolling in one direction and another for scrolling the other direction multiplied by 3 for it's different modes.
It also create an equal amount of sensor-entities for momentary data (these are 1 while a thing are happening and 0 in rest. Why not a binary_sensor? I have no idea.. ..)
Right now we are focusing on button-press in mode 1 so we can ignore the others.
The event for this looks like this:
event_type: state_changed
data:
entity_id: event.bilresa_2_mode1_press_or_hold
old_state:
entity_id: event.bilresa_2_mode1_press_or_hold
state: "2026-02-17T13:51:11.049+00:00"
attributes:
event_types:
- multi_press_1
- multi_press_2
- multi_press_3
- long_press
- long_release
event_type: multi_press_1
previousPosition: 1
totalNumberOfPressesCounted: 1
device_class: button
icon: fluent:radio-button-16-filled
friendly_name: Mode 1 - Press or Hold
last_changed: "2026-02-17T13:51:11.049203+00:00"
last_reported: "2026-02-17T13:51:11.049203+00:00"
last_updated: "2026-02-17T13:51:11.049203+00:00"
context:
id: 01KHNXX1696MFH33AD0V0PZ5F0
parent_id: null
user_id: null
new_state:
entity_id: event.bilresa_2_mode1_press_or_hold
state: "2026-02-17T13:51:41.309+00:00"
attributes:
event_types:
- multi_press_1
- multi_press_2
- multi_press_3
- long_press
- long_release
event_type: multi_press_1
previousPosition: 1
totalNumberOfPressesCounted: 1
device_class: button
icon: fluent:radio-button-16-filled
friendly_name: Mode 1 - Press or Hold
last_changed: "2026-02-17T13:51:41.309890+00:00"
last_reported: "2026-02-17T13:51:41.309890+00:00"
last_updated: "2026-02-17T13:51:41.309890+00:00"
context:
id: 01KHNXXYQXGMF44WKZ3P99RNRK
parent_id: null
user_id: null
origin: LOCAL
time_fired: "2026-02-17T13:51:41.309890+00:00"
context:
id: 01KHNXXYQXGMF44WKZ3P99RNRK
parent_id: null
user_id: null
I'm looking at the event "state_changed" with controller_key "entity_id" and controller "event.bilresa_2_mode1_press_or_hold".
Now, the mapping in action_template..
I need to go down the nested data into "new_state" and then "attributes" and grab "event_type".
I have no issue grabbing "{new_state[entity_id]}" and then set mapping to the entity_id for toggle, it toggles the light just fine but I do need the multi_press_2 and long_press too.
However, I cannot for the life of me find any reference or figure out with trial and error the syntax for nested data. I even went through AppDaemons documentation and your source-code for hints..
I've also tried the state-integration however this controller is being weird there too.
If I map it to the event-entity I need to double-click for it to register a single-click, but that's fair, the attribute doesn't change if I do repeated single-clicks.
However, if I map it to the sensor-entities and in mapping I just map it to 1 (it flips between 1 and 0), nothing happens. I do find this odd and it will be an issue later but I haven't looked to deeply into that right now, one issue at a time :).
Additional information
-
Devices involved:
- Model: BILRESA scroll wheel (32768) as Controller
-
Integration: Event
-
AppDaemon version: 4.5.13
-
ControllerX version: v5.0.0
-
HACS version (if installed from there): 2.0.5
-
Home Assistant Core version: 2026.2.2
AppDaemon app configuration
bilresa_2_test_app_event:
module: controllerx
class: LightController
controller: event.bilresa_2_mode1_press_or_hold
light: light.martins_desk_neon
integration:
name: event
event_type: state_changed
controller_key: entity_id
action_template: ??
mapping:
multi_press_1: toggle
Logs
Too many logs of it not matching my attempts at templating to the event, it does however list the event in data={} so it finds it. And it works as long as I don't do nested matching. It's down to me not finding the correct syntax to match the data.
I will however provide if it's needed of course :)
Additional Context
Add any other context or screenshots about the question here.
Question
I've tried a few things here but seem stuck regarding action_templates and nested data.
First, the setup..
The Bilresa when paired creates a hole heap of event-entities, one for the button, one for scrolling in one direction and another for scrolling the other direction multiplied by 3 for it's different modes.
It also create an equal amount of sensor-entities for momentary data (these are 1 while a thing are happening and 0 in rest. Why not a binary_sensor? I have no idea.. ..)
Right now we are focusing on button-press in mode 1 so we can ignore the others.
The event for this looks like this:
I'm looking at the event "state_changed" with controller_key "entity_id" and controller "event.bilresa_2_mode1_press_or_hold".
Now, the mapping in action_template..
I need to go down the nested data into "new_state" and then "attributes" and grab "event_type".
I have no issue grabbing "{new_state[entity_id]}" and then set mapping to the entity_id for toggle, it toggles the light just fine but I do need the multi_press_2 and long_press too.
However, I cannot for the life of me find any reference or figure out with trial and error the syntax for nested data. I even went through AppDaemons documentation and your source-code for hints..
I've also tried the state-integration however this controller is being weird there too.
If I map it to the event-entity I need to double-click for it to register a single-click, but that's fair, the attribute doesn't change if I do repeated single-clicks.
However, if I map it to the sensor-entities and in mapping I just map it to 1 (it flips between 1 and 0), nothing happens. I do find this odd and it will be an issue later but I haven't looked to deeply into that right now, one issue at a time :).
Additional information
Devices involved:
Integration: Event
AppDaemon version: 4.5.13
ControllerX version: v5.0.0
HACS version (if installed from there): 2.0.5
Home Assistant Core version: 2026.2.2
AppDaemon app configuration
Logs
Too many logs of it not matching my attempts at templating to the event, it does however list the event in data={} so it finds it. And it works as long as I don't do nested matching. It's down to me not finding the correct syntax to match the data.
I will however provide if it's needed of course :)
Additional Context
Add any other context or screenshots about the question here.