input_boolean component allows the user to define boolean values that can be controlled via the frontend and can be used within conditions of automation. This can for example be used to disable or enable certain automations.
To enable input booleans in your installation, add the following lines to your
# Example configuration.yaml entry input_boolean: notify_home: name: Notify when someone arrives home initial: off icon: mdi:car
(map)(Required)Alias for the input. Multiple entries are allowed.
(String)(Optional)Friendly name of the input.
(boolean)(Optional)Initial value when Home Assistant starts.
Default value: false
(icon)(Optional)Icon to display for the component. Refer to the Customizing devices page for possible values.
This component will automatically restore the state it had prior to Home Assistant stopping as long as you have the
recorder component enabled and your entity does not have a set value for
initial. To disable this feature, set a valid value for
initial. Additional information can be found in the Restore state section of the
recorder component documentation.
Here’s an example of an automation using the above
input_boolean. This action will only occur if the switch is on.
automation: alias: Arriving home trigger: platform: state entity_id: binary_sensor.motion_garage to: 'on' condition: condition: state entity_id: input_boolean.notify_home state: 'on' action: service: notify.pushbullet data: title: "" message: "Honey, I'm home!"
You can also set or change the status of an
input_boolean by using
input_boolean.toggle in your automations.
- service: input_boolean.turn_on data: entity_id: input_boolean.notify_home