The button card in the lovelace UI has the ability to call a service and that service can be automation.trigger. That would be a useful feature for initiating activity from the UI with no switch or boolean input needed. Unfortunately automation.trigger seems somewhat broken in that automations which have been externally triggered then ignore their internally defined conditions. That means the automation.trigger is not really a trigger. It only executes the action and is the equivalent of the execute switch on the configuration/animations page.
I donât see the usefulness in having an automation ignore itâs internally defined condition but, even if I am missing something, whether or not to ignore conditions could be made selectable.
Already possible
You can have it respect the conditions by specifying skip_condition: False
in the data section of the services page. Assuming of course youâre on a vaguely recent version of HA.
Conditions can reside in an automationâs action.
If you relocate them there, they will be evaluated when the automation is executed by automation.trigger
.
Ideally, the button should not call automation.trigger
. The primary difference between an automation and a script is the automation has a trigger. If your use-case has no need for the trigger then itâs best to use a script. The button can call the script directly. Scripts can also contain conditions.
How long has that been possible?
I recall reading the PR for it a few versions ago ⌠and then promptly forgot all about it.
I hunted through the documentation for it and found nothing.
This section doesnât mention it:
Itâs not in the Automation integration page:
Nor here:
Not sure how that PR introduced a new feature without updating the docs.
BTW, where you can see it is in the Developer Tools > Services page when you select automation.trigger
.
I found it. It was merged in January.
Thanks everyone for the prompt reply.
That solves my problem.
A correction
Adding skip_condition: False with the developer tools-states page did not work. Adding a condition as the first action solved my problem.
Are you SERIOUS?
(Not you 123, the global âYouâ)
This is a major improvement! How on earth does a project which is so âgrown-upâ about most things allow this to be implemented and undocumented?
Because⌠sometimes the devs forget/donât think about it and nobody else steps up.
Many of us have contributed to the docs to cover things like this, and more. Nothing is stopping somebody adding this to the docs somewhere, other than the usual problem that itâs assumed somebody else will
Yeah, I get that but I just thought it was part of the acceptance process that the docs were updated but if Iâm wrong then fair enough (but maybe if it isnât it should be?).
And yeah, I get that too. Iâve made a few changes to the docs myself
Yeah, itâs the old : -
âsomebodyâ, âanybodyâ, ânobodyâ story !
But to be fair, we have contributors from all over the world and perhaps their language skills are far less important than their coding skills, in which case perhaps they should be paired with (say) a native English language speaker from this forum. Maybe moderator or higher ?
The reason why the documentation was not updated is revealed within the PR. Itâs not a very compelling reason but it does explain why this new feature has no description.
I couldnât find any service description of
automation.trigger
within the docs.
As for the feature itself, I have not tried it yet but do plan to test it especially since harvey reported it failed to work.
That just makes no sense âŚ
âI couldnât find a hook to hang my coat on, so rather than make the hook and hang my coat (all the work Iâve just done). I decided to drop it all on the floor so that everyone could ignore it.â
I actually put in a feature request a while back to have the pop-up window for the automation have an âexecute with conditionsâ and âexecute skipping conditionsâ button so you could do it right there without having to resort to setting up the service call.
It got a couple of votes but we all know that the âfeature requestsâ section is where feature requests go to die.
here it is if anyone would like to vote on it and exercise their futility muscle :
That makes more sense than having to decide in advance of needing it
Me + 1
Revisiting this old thread, since I have problem related to what exactly was described hereâŚ
So, I have and automation that applies scene, then checks what is over light level and if dark aditionally turns on LED candles. Clearly for this automation condition is within the action. When triggered from Aeotec Wallmote works perfectly:
- id: 'mood_lights_on'
alias: Mood Lights On
trigger:
- event_data:
node_id: 43
value: "KeyPressed"
label: "Scene 004"
event_type: zwave_js_value_notification
platform: event
action:
- service: scene.turn_on
entity_id: scene.mood_lights
- condition: numeric_state
entity_id: sensor.light_state
below: 0
- service: switch.turn_on
entity_id: switch.ledcandlelights
initial_state: true
Now, I also want to be able to trigger this automation from UI, by just by pressingg the button. Here is the code (part of glance card):
- entity: scene.mood_lights
icon: mdi:music-circle
name: Music
tap_action:
action: call-service
service: automation.trigger
data:
skip_condition: false
service_data:
entity_id: automation.mood_lights
Unfortunatelly it does not work⌠It applies the scene, but skips part after condition (regardless of skip_condition option setting), so as result LED candles are never turned on. Is it a bug or Iâm using this incorrectly? Or skip_condition applies only to the top level automation conditions, not to specific action one?
I know I can overcome this using script, but since automation already exists it is simpler to reuse it (especially that given numner of scenes, I want to apply this concept to, Iâd need to create several new scripts, not just one). Any advice?
Itâs my understanding that it should perform everything in the action section - including the conditional stuff - unless the condition (or any other thing) references a trigger property (trigger.id, etc).
skip_condition should only be applicable for the condition section.
as far as I knowâŚ
if not then submit an issue and see if you get an answer there.
Correct, it skips the condition:
section, not condition:
in the actions.
So fact that HA always skips part of automation after condition inside action is a bug⌠?
The condition
in the action will always be evaluated, it shouldnât be ignored. If it is being ignored that sounds like a bug.