Using a helper as a condition in an automation

Hi Guys,
I have automation ( google tts ) to announce when a door is left open.

Please can you help me how do I add a Helper into a CONDITION that I can toggle the automation on and off with the button card. remember my door shows open or closed and NOT on or off.

I create a Toggle Boolean but no success

Thanks in advance

Post your current automation so we don’t have to guess at its structure.

Thanks here is my code also it only announces once, would like to announce every 20 min:

`lias: Back Door open or Closed Announce
description: “”
trigger:

  • platform: state
    entity_id:
    • binary_sensor.back_door
      from: “off”
      to: “on”
      id: Door Open
      for:
      hours: 0
      minutes: 0
      seconds: 45
  • platform: state
    entity_id:
    • binary_sensor.back_door
      from: “on”
      to: “off”
      id: Door Closed
      condition: []
      action:
  • choose:
    • conditions:
      • condition: trigger
        id: Door Open
        sequence:
      • service: tts.google_translate_say
        data:
        cache: false
        entity_id: media_player.home_group
        message: Door is open
    • conditions:
      • condition: trigger
        id: Door Closed
        sequence:
      • service: tts.google_translate_say
        data:
        cache: false
        entity_id: media_player.home_group
        message: Door has been closed
        mode: single`

So, you want a toggle to enable / disable the notification ?

If so then simply create an input Boolean helper then edit your automation and add a condition to include the state of the Boolean being on or off

Or have I misunderstood your requirements?

1 Like

Thanks , could you help me. Do I add the input boolean helper ( toggle ) under condition and use STATE ?
If so do i add ON or OFF under state ?

Thanks

Yes, exactly that :+1:t2:

Personal preference really. Depends how you want to think of the Boolean or what you call it…

1 Like

Do I add the state as ON or OFF ?

On or off, will depend on what you call your Boolean.

Boolean called ‘notifications on’ for example would require the condition, boolean state to be on for the automation to run.

Boolean called ‘notifications off’ would require the the condition, Boolean state to be off for the automation to run.

It’s all personally preference depending on what you name the Boolean, how you think of the Boolean etc

I want the toggle input boolean to turn off the automation via a button on dashboard or turn back on ?

I am using the Helpers ( Toggle ) in HA and was told to put under the conditions of my automation

Hello, What exactly are you trying to achieve?

To create a button that would toggle the automation on or off you would need a button card on your dashboard like this:

Add card on your dashboard.

Select button card

show_name: true
show_icon: true
type: button
tap_action:
  action: toggle
entity: automation.name
name: Name

Replace the entity with your desired automation name and the custom name that you want.

Again this would create a button that will turn on and off an automation, but I don’t think that’s your end goal here.

1 Like
  1. I have already created the Helper Toggle
  2. I have already created a Custom button card that uses the Helper input Boolean toggle and it works.
  3. I have an automation that tells me that the back door is open.

I was told to add the input boolean that I created and add to my automation ( under ) conditions so that I can stop the automation.
I don’t understand how to add it to my automation under conditions , this is my problem.

thanks

Here’s an example automation that uses an input_boolean as a condition.

If the input_boolean.water_emergency is on the automation will not run. If it’s off the condition passes and the action is triggered. Is this what you looking for? You can also share your code so we can see the names for your entities and code it accordingly.

alias: Sprinklers On at 5:30 am
description: ""
trigger:
  - platform: time
    at: "05:30:00"
condition:
  - condition: state
    entity_id: input_boolean.water_emergency
    state: "off"
action:
  - type: turn_on
    device_id: 71df7514ef30c6c17fe3fba2e669d8ff
    entity_id: switch.water_pump
    domain: switch
  - type: turn_on
    device_id: d7271b05c8d11b98eb14ba268c0a02a0
    entity_id: switch.sprinklers_valve_switch_1
    domain: switch
  - delay:
      hours: 0
      minutes: 5
      seconds: 0
      milliseconds: 0
  - type: turn_off
    device_id: d7271b05c8d11b98eb14ba268c0a02a0
    entity_id: switch.sprinklers_valve_switch_1
    domain: switch
mode: single

1 Like

This what i am looking for .
is that a toggle input boolean ?
If you toggle the input boolean to off will the automation stop and if on will the automation proceed ?

Trying to understand how that condition works ?

Thanks

That example automation triggers at 5:30 am and last for 5 minutes until the final action is completed

- type: turn_off
    device_id: d7271b05c8d11b98eb14ba268c0a02a0
    entity_id: switch.sprinklers_valve_switch_1
    domain: switch

If I were to manually set the input_boolean to on at 5:29 am the automation would not run.

If I were to manually set the input_boolean to on at 5:32 am (after the trigger time) the automation would remain running because at 5:30 am (trigger time) the input_boolean was off at that time.

Does that answer your question?

1 Like

Not really, I just want to stop the automation , its fine I found another way around it.
Thanks for helping appreciate it

Thanks to everyone for helping