Input Boolean help to configure

Hi
I never used an input boolean before and although I (semi) understand the concept I am not sure how to implement. I have the following automation and I need to get reminded to “don’t forget the garbage” from the 2nd time I will open the door and for max 5 times.

##Don't forget the garbage
- id: Don't forget the garbage
  alias: Don't forget the garbage
  trigger:
    - platform: state
      entity_id: binary_sensor.1_main_door
      to: 'on'
  condition:
    condition: and
    conditions:
      - condition: state
        entity_id: binary_sensor.2_radar_outdoor
        state: 'off'
      - condition: time
        after: '06:00:00'
        before: '23:00:00'
  action:
    - service: media_player.volume_set  
      data_template:
        entity_id: media_player.living_room_speaker
        volume_level: 0.5
    - service: tts.google_translate_say
      entity_id: media_player.living_room_speaker
      data_template:
        message: "Please, don't forget the garbage"
    - delay:
        seconds: 30
    - service: media_player.volume_set  
      data_template:
        entity_id: media_player.living_room_speaker
        volume_level: 0.3

So I think that the input boolean part should be like this

input_number:
  main_door_sequence:
    initial: 0
    min: 1
    max: 5

but I can not figure out how to add it in my automation.
Can someone help please?

First, an input_boolean is basically a UI element in the form of an on/off switch.
There’s also input_number which is what your example shows - a UI element that represents a numerical value, and input_select - a UI element with a pre-defined list that the user can choose an element from.

None of which is what you’d need for your use case.

Have a look at the alert component, I think that’s exactly what you are looking for:

Sebastian

2 Likes

Thanks. That’s meaning that I don’t even understand what input boolean does

Don’t worry - we’ve all been there. Fortunately for you, it’s all documented… :wink:

Those input_* elements were created as an easy way for the user to get values into HA using the frontend, such as numbers, on/off states etc. - values that do not depend on any “automatable” stuff.

Let’s say you want to be able to turn off some automations depending on your mood…
You can add an input_boolean (i.e. an on/off switch) to the UI and query its state from the condition: part of those automations so that they only run when the switch is in the “on” position.

Or lets say you have an automation that turns off your heating when you open a window.
If you do that by setting your thermostats to their minimum value, you’ll lose the current setting (there may be different types of thermostats…).
You need something to store the current value so you can restore it as soon as you close the window.
You can use (hidden) input_number elements for that purpose.

The possibilities are endless…

Sebastian

You made that a little clearer. I am looking for a video explaining (in HA) but haven’t manage it yet.
Thanks again!