βœ… Input Boolean Toggle Actions: call services/scenes, turns lights on and off, and use your own conditions

A simple blueprint for expediting the process of doing different things based on the edge of a toggle switch. Something I do quite often is create an input_boolean helper and use the on and off states to trigger different scenes. I wanted to share a simple yet versatile blueprint I created for quickly setting this up and adding multiple actions based on the state of this input_boolean. This blueprint allows you to add actions that will be executed when the input_boolean is turned on and different actions for when it’s turned off.

Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.

How It Works

  • Input Boolean: Select the input_boolean entity that you want to use as the toggle.
  • Actions When On: Define the actions you want to perform when the input_boolean is turned on.
  • Actions When Off: Define the actions you want to perform when the input_boolean is turned off.

How to Use

  1. Import the Blueprint to your instance of HA using the button above or save the YAML blueprint into a new file under the blueprints/automation directory in your Home Assistant configuration (e.g., blueprints/automation/input_boolean_toggle_actions.yaml).
  2. Create an input_boolean helper that you want to use to toggle scenes/actions/lights on and off
  3. Create a new automation based on this blueprint, selecting the desired input_boolean and defining the actions to perform for both the on and off states.

:shield: MY OTHER BLUEPRINTS
:dash: Adaptive fan speed control based on temperature and speed range


blueprint:
  name: Input Boolean Toggle Actions
  description: Perform multiple actions based on the state of an input boolean.
  domain: automation
  input:
    toggle_boolean:
      name: Input Boolean
      description: The input boolean to control actions
      selector:
        entity:
          domain: input_boolean
    actions_on:
      name: Actions When On
      description: Actions to perform when the input boolean is turned on (optional).
      default: []
      selector:
        action: {}
    actions_off:
      name: Actions When Off
      description: Actions to perform when the input boolean is turned off (optional).
      default: []
      selector:
        action: {}

trigger:
  - platform: state
    entity_id: !input toggle_boolean

action:
  - choose:
      - conditions:
          - condition: state
            entity_id: !input toggle_boolean
            state: 'on'
        sequence: !input actions_on
      - conditions:
          - condition: state
            entity_id: !input toggle_boolean
            state: 'off'
        sequence: !input actions_off

1 Like

Simple, but indeed helpful. Thank you for posting!

1 Like

You’re very welcome! Glad you like it :slight_smile: