Hi there,
I’m trying to streamline some of my configuration. To this end, I would like to use some kind of “catch-all” trigger and then match it later on with my own with templates. Here’s my working example:
- alias: Fernbedienung Komplett
id: fernbedienung
trigger:
#- platform: template
# value_template: "true"
#- platform: template
# value_template: '{{ "elro_800_switch_s15" in trigger.to_state.name and trigger.to_state.state == "on" }}'
#- platform: state
# to: 'on'
# entity_id: '*'
- platform: state
to: 'on'
entity_id:
- binary_sensor.elro_800_switch_s15_ua_on
- binary_sensor.elro_800_switch_s15_ua_off
- binary_sensor.elro_800_switch_s15_ub_on
- binary_sensor.elro_800_switch_s15_ub_off
- binary_sensor.elro_800_switch_s15_uc_on
- binary_sensor.elro_800_switch_s15_uc_off
- binary_sensor.elro_800_switch_s15_ud_on
- binary_sensor.elro_800_switch_s15_ud_off
#condition:
#- condition: template
# value_template: '{{ "elro_800_switch_s15" in trigger.to_state.name and trigger.to_state.state == "on" }}'
action:
service: script.toggle_it
data_template:
entity: >
{% if 'ua_on' in trigger.to_state.name %}
switch.wohnzimmer_buchregal
{% elif 'ua_off' in trigger.to_state.name %}
...
But I don’t like listing all those entity ids. It makes my automations hard to maintain. So, I’d like to use on of the other triggers instead.
I have tested the condition with the state trigger and its long entity list: It allows all the state events to actually run the action. So, the condition should be fine. The problem seems that the automation does not even get there, if I use one of the other triggers.
I think, the template triggers don’t work, because:
- “trigger” is not a recognized variable in the trigger itself yet. (So says the error, I receive.)
- They only fire, when one of the mentioned entities changes its state. So “true” won’t ever fire. [Why won't this trigger?!]
The *
entity_id however, should work. There is something in the code called MATCH_ALL
. But when I use it, the automation is never started at all.
Here’s the code lines, whch I think should do the job…
- [https://github.com/home-assistant/home-assistant/blob/f2296e1ff8318fb34ea83a2b3e9215da474fee8a/homeassistant/helpers/event.py#L66]
- [https://github.com/home-assistant/home-assistant/blob/f2296e1ff8318fb34ea83a2b3e9215da474fee8a/homeassistant/const.py#L15]
What am I missing?
Thanks!
Andreas