1mfaasj
(Bowa)
August 16, 2024, 1:21pm
1
Hi
I created a button on my dashboard that triggers a specific automation, but I’ve got like 6 automations that I want to setup the same way. Is there a smart way to reduce the amount of automations?
I would like to put all of them in just one automation,
and then set a trigger ID in the button card (for instance), that triggers the correct automation part. Is that possible?
show_name: true
show_icon: true
type: button
tap_action:
action: perform-action
perform_action: automation.trigger
target:
entity_id: automation.backup
data:
skip_condition: true
Hellis81
(Hellis81)
August 16, 2024, 1:24pm
2
What you are describing is usually what we call a script.
A script is manually triggered.
An automation runs automatic
If it’s a script, then you can pass parameters and use a Choose based on the parameter to decide which actions to take.
1mfaasj
(Bowa)
August 16, 2024, 1:40pm
4
hmm I already have those automations in place, can be time consuming to convert everything to a script which I’m not experienced in.
this could also be a solution right? I created an input_boolean (so for each button).
then I can define the button like this, to trigger the boolean.
show_name: true
show_icon: true
type: button
tap_action:
action: perform-action
perform_action: input_boolean.toggle
target:
entity_id: input_boolean.test
and the automation looks like this, which executes the automation part that belongs to the button.
description: ""
mode: single
trigger:
- platform: state
entity_id:
- input_boolean.test
to: "on"
id: "1"
condition: []
action:
- if:
- condition: trigger
id:
- "1"
then: []
....
I can include the other automations like this easily.
thoughts?
1mfaasj
(Bowa)
August 16, 2024, 1:46pm
5
that way I reduce the amount of automations but with an increase of helpers not sure if this is the cleanest way.
tom_l
August 16, 2024, 1:48pm
6
Sure, just like using a sledgehammer is a solution to cracking nuts. It is a solution but not the correct one.
Use the correct tool for the job.
A script will not require you to create any input booleans. They are easy to learn, they are just like automations without triggers.
Hellis81
(Hellis81)
August 16, 2024, 2:17pm
7
Converting an automation to a script is really just a copy paste from action to sequence.
All the time you spend on creating the booleans will be better spent learning scripts.
1 Like