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
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:
Don’t worry - we’ve all been there. Fortunately for you, it’s all documented…
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.