Group Homematic switches to act as one

I have four Homematic switches in the hallway, which makes each automation rule start like this:

  trigger:
  - platform: event
    event_type: homematic.keypress
    event_data:
      name: MEQ1850393
      channel: 1
      param: PRESS_SHORT
  - platform: event
    event_type: homematic.keypress
    event_data:
      name: MEQ1850385
      channel: 1
      param: PRESS_SHORT
  - platform: event
    event_type: homematic.keypress
    event_data:
      name: MEQ0085036
      channel: 1
      param: PRESS_SHORT
  - platform: event
    event_type: homematic.keypress
    event_data:
      name: MEQ0159704
      channel: 1
      param: PRESS_SHORT

Is there a way to group the switches to act as one?

You can leave out name from event_data, then check name in a condition instead. E.g.,:

  trigger:
  - platform: event
    event_type: homematic.keypress
    event_data:
      channel: 1
      param: PRESS_SHORT
  condition:
    condition: template
    value_template: >
      {{ trigger.event.data.name in
         ('MEQ1850393', 'MEQ1850385', 'MEQ0085036', 'MEQ0159704') }}
2 Likes

Perfect and elegant solution, thank you! :+1:

1 Like