I have two helper Buttons whitch call one script (not Automation). How do I get the trigger id of the Button which started the script?
alias: getTrigger
sequence:
- action: notify.pushover
metadata: {}
data:
title: test1
message: The sensor {{ context }} triggered.
enabled: false
mode: single
I tried trigger_id
and context
but I do not get a value which is always same.
Passing Variables to Scripts
Button helper entities do not have actions in-and-of-themselves… what are you using to connect the button to the script?
Also, you have disabled the action…
I have a watering system with two valves which I want to start with one script. To know which button was pressed, I need to know an id or something else.
With your hint I did:
alias: TapLinker1 EIN Zeit
sequence:
- action: notify.pushover
metadata: {}
data:
title: test1
message: The sensor {{ 123 }} triggered.
mode: single
fields:
taplinker1:
selector:
entity: {}
name: TapLinker1
default: input_button.taplinker1_bewaesserungnachzeit
required: true
taplinker2:
selector:
entity: {}
name: TapLinker2
default: input_button.taplinker2_bewaesserungnachzeit
required: true
what do I need to enter instead of 123
thah I get f.ex. the default name (input_button.taplinker1_bewaesserungnachzeit
or input_button.taplinker2_bewaesserungnachzeit
)?
i got it:
alias: TapLinker1 EIN Zeit
sequence:
- action: notify.pushover
metadata: {}
data:
title: test1
message: The sensor {{ taplinker }} triggered.
mode: single
fields:
taplinker:
selector:
entity:
multiple: true
name: TapLinker
default:
- input_button.taplinker1_bewaesserungnachzeit
- input_button.taplinker2_bewaesserungnachzeit
required: true
You have not answered how the script is being called.
The two most common options are:
- From a card action on the dashboard.
- From an automation that watches the states of the
input_button
entities.