home-assistant.io/source/_components/input_boolean.markdown
cdce8p 5b873e2380 Added Restore state info + Updated config style (#4343)
* Updated input_boolean

* new Configuration style
* Linkable title Automation Examples

* Updated input_select

* new Configuration style
* Services as table
* Rearaged scenes
* small improvments

* Updated input_number

* linkformat

* Updated input_text

* New configuration style

* Update input_datetime

* New configuration style

* Updated recorder

* New configuration style

* Added Restore State Info
2018-01-05 11:53:52 +01:00

2.6 KiB

layout, title, description, date, sidebar, comments, sharing, footer, logo, ha_category
layout title description date sidebar comments sharing footer logo ha_category
page Input Boolean Instructions how to integrate the Input Boolean component into Home Assistant. 2016-01-17 16:58 true false true true home-assistant.png Automation

The 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 configuration.yaml:

# Example configuration.yaml entry
input_boolean:
  notify_home:
    name: Notify when someone arrives home
    initial: off
    icon: mdi:car

{% configuration %} input_boolean: description: Alias for the input. Multiple entries are allowed. required: true type: map keys: name: description: Friendly name of the input. required: false type: String initial: description: Initial value whe Home Assistant starts. required: false type: boolean default: false icon: description: Icon to display for the component. Refer to the Customizing devices page for possible values. required: false type: icon {% endconfiguration %}

{% linkable_title Restore State %}

This component supports the restore_state function which restores the state value after Home Assistant has started to the value it has been before Home Assistant stopped. The use this feature please make sure that the recorder component is enabled and your entity does not have and initial value. Additional information and a list of components that support this feature can be found here recorder/#restore-state.

{% linkable_title Automation Examples %}

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.turn_on, input_boolean.turn_off or input_boolean.toggle in your automations.

    - service: input_boolean.turn_on
      data:
        entity_id: input_boolean.notify_home