Can I disable/enable a trigger using a Blueprint option?

Before I get too involved with this idea I want to make sure it is possible to do this. I know that triggers are handled a bit differently than other parts of the automations (or I think that’s the case).

What I would like to do for one of my BP is to have a boolean toggle that would allow the user to decide whether to use the feature or not. Can I do something like this:

trigger_variables:
  rotate_enabled: false
trigger:
- platform: time_pattern
  minutes: /15
  id: rotateimage
  enabled: "{{ rotate_enabled }}"

I would, of course pull the value from the blue print like rotate_enabled: !input rotate_enbled_value but wanted to illustrate by defining it above for clarity.

For the record I did try this with the proof of concept automation but it seems the trigger_variables is not retained on save so I guess it is only available in blueprints?

Your response is most appreciated.

Hi dinki,

Trigger variables is a valid key for any automation, blueprint or not.

There is a possibility that enabled: does not accept templates.
in that case it should accept !rotate_enabled !input rotate_enabled there in a blueprint.

I’m unfamiliar with this. Can you provide a bit more detail?

It’s shown in the example in the docs about disabling triggers

image

1 Like

This should read !input rotate_enabled right? I was saying I was unfamiliar with the bang variable format you are showing.

Perfect. It is definitely possible then and shame . Next time I’ll RTFM. Thank you!

Ya my typo, sorry I meant

Sorry to continue this but for the trigger I want to use something like:

triggers:
  - trigger: time_pattern
    minutes: /15
    id: rotateimage

But I have a input number as a variable. How can I format that in the trigger? I think I need the leading ‘/’ right? Will it accept a string? I am wanting it to fire every 5 minutes as an example but it is dynamic based on user input.

So working a bit more on this:

triggers:
  - platform: time_pattern
    minutes: !input rotate_minute
    id: rotateimage
    enabled: true

This is valid BUT it will only fire at whatever the value is after the hour (like 12:19) and not every 19 minutes as I had hoped. Is there any chance I will be able to format the variable to be something like /19 ?

Yeah, the correct format is “/19”, but you would need to use a text input and instruct the user in order to use that as an input for that type of trigger.

Otherwise, I think you would need to use a template trigger.

This is not as pretty as the slider but I will side on ease of coding for me versus user comfort! haha Thanks for the information.