vespuccio
(vespuccio)
March 13, 2025, 6:11pm
1
RIght now I m creating one automation for each button on my 6 gang button from loratap:
alias: 6 gang escritorio, bt2, 1 click
description: ""
triggers:
- domain: mqtt
device_id: 44ae6c9b9e5b7483d6f09fb1f901f877
type: action
subtype: 2_single
trigger: device
conditions: []
actions:
- action: script.persiana_quarto_patch
metadata: {}
data:
command: open
device_name: persiana escritorio
mode: single
so I get a bunch of automations just for 1 button, they tend to pollute things.
Is there a way to add 1 call for each button (there are 6, each with single click, double click and hold) in a way that it does not need to create 6*3 automations?
Hi @vespuccio
You can have multiple triggers in 1 automation. One trigger for each button.
Each trigger can be given a trigger id.
You can then use a Choose action to perform actions depending on the trigger ids
2 Likes
Hello vespuccio ,
You can write a blueprint, which is basically 1 automation, then call that multiple times with different entity names.
tom_l
March 13, 2025, 8:29pm
4
Here’s how I deal with my LoraTap 4-way remote, note there is only one hold event per remote, not per button:
- id: a9918825-dc29-409b-ba37-832f9dd0f6e6
alias: Dining Button Events
triggers:
- trigger: state
entity_id: event.dining_button_action
to: ~
conditions:
- condition: template
value_template: "{{trigger.from_state.state != 'unavailable'}}"
actions:
- choose:
- conditions:
- condition: template
value_template: "{{trigger.to_state.attributes.event_type == '1_single'}}"
sequence:
- repeat:
count: 6
sequence:
- action: media_player.volume_up
target:
entity_id:
- media_player.dining_zone
- delay: 0.1
- conditions:
- condition: template
value_template: "{{trigger.to_state.attributes.event_type == '1_double'}}"
sequence:
- repeat:
count: 9
sequence:
- action: media_player.volume_up
target:
entity_id:
- media_player.dining_zone
- delay: 0.1
- conditions:
- condition: template
value_template: "{{trigger.to_state.attributes.event_type == '2_single'}}"
sequence:
- repeat:
count: 6
sequence:
- action: media_player.volume_down
target:
entity_id:
- media_player.dining_zone
- delay: 0.1
- conditions:
- condition: template
value_template: "{{trigger.to_state.attributes.event_type == '2_double'}}"
sequence:
- repeat:
count: 9
sequence:
- action: media_player.volume_down
target:
entity_id:
- media_player.dining_zone
- delay: 0.1
- conditions:
- condition: template
value_template: "{{trigger.to_state.attributes.event_type == '3_single'}}"
sequence:
- action: media_player.media_next_track
target:
entity_id:
- media_player.lounge_zone
- conditions:
- condition: template
value_template: "{{trigger.to_state.attributes.event_type == '3_double'}}"
sequence:
- action: media_player.media_previous_track
target:
entity_id:
- media_player.lounge_zone
- conditions:
- condition: template
value_template: "{{trigger.to_state.attributes.event_type == '4_single'}}"
sequence:
- action: media_player.media_play_pause
target:
entity_id:
- media_player.lounge_zone
- conditions:
- condition: template
value_template: "{{trigger.to_state.attributes.event_type == 'hold'}}"
sequence:
- action: media_player.toggle
target:
entity_id:
- media_player.dining_zone
- action: media_player.select_source
target:
entity_id:
- media_player.dining_zone
data:
source: Main Zone Sync
Also this is using the new Z2M event entities, not the legacy action entities.
Yes, trigger IDs and choose actions are the way. I’d paste my 6 button loratap automation but it’s too huge. Smart Home Junkie has an excellent tutorial video on this on YouTube.
I have several 4 gang and 6 gang buttons running under ZHA and they’re working great. And with short, double and long press triggers that gives me more than enough options for my needs.
tom_l
March 13, 2025, 10:26pm
6
It annoys me that LoraTap don’t implement a hold and a release event per button (like Aqara buttons). That would make volume control a lot easier. Increase volume in a loop while the button is held until release.
Same. I started with Aqara mini buttons and have replaced several with Loratap multi-gang, but having the release trigger for long press is handy. I hadn’t thought of using it for volume control though!