Input boolean
The Input boolean integrationIntegrations connect and integrate Home Assistant with your devices, services, and more. [Learn more] lets you create a toggle helperA helper is a virtual entity you create inside Home Assistant. It is not backed by a physical device. Helpers store values, track state, or do calculations that your automations and dashboards need. [Learn more]: an entity that stores an on or off stateThe state holds the information of interest of an entity, for example, if a light is on or off. Each entity has exactly one state and the state only holds one value at a time. However, entities can store attributes related to that state such as brightness, color, or a unit of measurement. [Learn more] you can set yourself. Because the value is not tied to a physical device, you can use it as an adjustable switch for your automations, scripts, and dashboards. For example, you can create a toggle helper to enable or disable a set of automations, mark guest mode as active, or track whether you are on vacation.
On a dashboard, a toggle helper appears as a switch you can turn on or off. Each time the value changes, Home Assistant records a new state, which you can use as a trigger or a conditionConditions check whether something is true at that moment, for example, whether a door is closed. You can use them in automations and scripts. If a condition is not met, the actions that come after it in the same sequence do not run. At the top level of an automation or script, this stops the automation or script. [Learn more] in your automations. Your automations and scripts can also change the value, which makes a toggle helper a convenient way to share a setting between the user interface and your automations.
Configuration
-
Go to Settings > Devices & services > Helpers, and select Create helper.
-
Select Toggle.
-
Enter a Name, and select an Icon if you like.
-
Optional: To choose the state of the toggle when Home Assistant starts, expand More options. Under Each time Home Assistant starts, select one of the options:
- Restore previous state: the toggle keeps the state it had before Home Assistant stopped. This is the default.
- Turn on: the toggle is always on after Home Assistant starts.
- Turn off: the toggle is always off after Home Assistant starts.
Changing this option does not change the current state of the toggle. It only applies the next time Home Assistant starts.
-
Select Create.
Input booleans can also be configured via configuration.yamlThe configuration.yaml file is the main configuration file for Home Assistant. It lists the integrations to be loaded and their specific configurations. In some cases, the configuration needs to be edited manually directly in the configuration.yaml file. Most integrations can be configured in the UI. [Learn more] file:
Configuration Variables
Alias for the input. Multiple entries are allowed.
Initial value when Home Assistant starts.
a previous value is restored if available
Icon to display in front of the input element in the frontend.
# Example configuration.yaml entry
input_boolean:
notify_home:
name: Notify when someone arrives home
icon: mdi:car
List of actions
The Input boolean integrationIntegrations connect and integrate Home Assistant with your devices, services, and more. [Learn more] provides the following actions. Each link below opens a dedicated page with examples, parameters, and a step-by-step UI walkthrough.
-
Reload input booleans (
input_boolean.reload) Reloads the input boolean helpers from the YAML configuration. -
Toggle input boolean (
input_boolean.toggle) Toggles an input boolean between on and off. -
Turn off input boolean (
input_boolean.turn_off) Turns an input boolean off. -
Turn on input boolean (
input_boolean.turn_on) Turns an input boolean on.
For an overview of every action across all integrations, see the actions reference.
Restore state
By default, a toggle helper restores the state it had before Home Assistant stopped. If there is no state to restore, the toggle starts as off.
To always start with the same state, set Each time Home Assistant starts to Turn on or Turn off, as described in Configuration. To change this for an existing toggle helper, go to Settings > Devices & services > Helpers and select the toggle helper. Select Settings initial option.
Automation examples
Here’s an example of an automation using the above input_boolean. This action
will only occur if the input_boolean is on.
automation:
alias: "Arriving home"
triggers:
- trigger: state
entity_id: binary_sensor.motion_garage
to: "on"
conditions:
- condition: state
entity_id: input_boolean.notify_home
state: "on"
actions:
- action: 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.turn_on, input_boolean.turn_off or input_boolean.toggle in
your automation action.
action: input_boolean.turn_on
target:
entity_id: input_boolean.notify_home
Troubleshooting
The toggle helper option is missing from the user interface
Symptom
When you go to Settings > Devices & services > Helpers to add a helper, the Toggle option is not listed.
Description
Toggle helpers are available when default_config: is enabled (this is the default), or when you configure input_boolean: manually in your configuration.yamlThe configuration.yaml file is the main configuration file for Home Assistant. It lists the integrations to be loaded and their specific configurations. In some cases, the configuration needs to be edited manually directly in the configuration.yaml file. Most integrations can be configured in the UI. [Learn more]. If you removed default_config: and have not configured input_boolean:, the option is no longer available.
Resolution
- Add
input_boolean:to yourconfiguration.yamlThe configuration.yaml file is the main configuration file for Home Assistant. It lists the integrations to be loaded and their specific configurations. In some cases, the configuration needs to be edited manually directly in the configuration.yaml file. Most integrations can be configured in the UI. [Learn more]. - Restart Home Assistant.
- After the restart, create your toggle helpers from the user interface.