State Bonding - Dual

Incredibly simple way to bond the states of 2 entities together,

NB. not to be confused with “groups”, this would usually be used to bond the states of physical devices.

Dual:

blueprint:
  name: State Bonding - Dual
  description: Bind 2 entities together to act in unison (selected entites must all support the same state values)
  domain: automation
  source_url: https://community.home-assistant.io/t/state-bonding-dual/264183
  input:
    switch_1:
      name: Entity 1
      selector:
        entity:
          #domain: switch
          
    switch_2:
      name: Entity 2
      selector:
        entity:
          #domain: switch
      
trigger:
  - entity_id:
    - !input switch_1
    - !input switch_2
    platform: state
action:
- entity_id:
  - !input switch_1
  - !input switch_2
  service: '{% if trigger.to_state.state == "on" %} homeassistant.turn_on {% elif trigger.to_state.state == "off" %} homeassistant.turn_off {% endif %}'

You can extend this blueprint to include any number of entities simply by adding more inputs and adding them to the “entity_id” lists in the “trigger” and “action” sections

1 Like

Isn’t that the same as putting the entities in a group and using the group?

I must be missing something here…

It’s mainly for bonding physical entities together, eg. two light switches, when one is switched on, the other also turns on

Groups allow you to have one switch for multiple devices in the UI. but switching on a member doesn’t switch the other members on

2 Likes

Is there any way to make this work for brightness levels? I have a zwave dimmer light switch and a hue bulb on a lamp and would love to have those two levels match at all times.

1 Like

See

Just for you my friend :wink: (and the community)

1 Like

This:

service: '{% if trigger.to_state.state == "on" %} homeassistant.turn_on {% elif trigger.to_state.state == "off" %} homeassistant.turn_off {% endif %}'

can be simplified to this:

service: 'homeassistant.turn_{{ trigger.to_state.state }}'
1 Like

I just wanted to drop in and say that this was a great idea. I am in the midst of building a master switch box for four independently controlled lights in my son’s room (major cool dad points on the way) and was trying to figure out how I could automate it so that the switches connected to a wemos d1 mini could be reliably automated and match the state of the smart plugs. I saw the email notification for this come through a few minutes after messing about with some automations to do it manually.

FYI, at least two other blueprints that do the same thing (posted 2 and 3 weeks ago, respectively):

Will it be possible to make similar for 3 entities? I have 3 Switches to control 1 light and it would be awesome to link them together.

Thank you!!!

This is a life saver. Every time I wanted to link a switch to a light that it wasn’t physically connected to, it took FOUR automations. This makes it 1, and taught me some new tricks I didn’t know were possible

THANK YOU!!!111111111

I extended the blueprint to three entities, feel free to use the modified version here.

1 Like

How do you prevent the infinite loop when a button is tapped in quick succession?

getting an error

Logger: homeassistant.components.automation.state_bonding_dual
Source: helpers/script.py:1344
Integration: Automation (documentation, issues)
First occurred: July 27, 2021, 7:59:57 PM (5 occurrences)
Last logged: 4:13:31 AM

shower fan State Bonding - Dual: Already running
shower fan State Bonding - Dual: Error executing script. Error for call_service at pos 1: Template rendered invalid service: 

This is an excellent blueprint! thanks for that :slight_smile:
It works perfect when bonding between 2 light or switch entities, however i’m having issues when i try to bond an input_boolean entity with a climate entity.
The use case is:
I have a climate entity that is created with the smartir integration which is basically an entity that allows me to control my AC with a Broadlink remote. When adding the climate entity in an entities card in the UI, turning the AC on and off is more complicated, so I have created an input_boolean helper and used that with this blueprint to bond between it and the climate’s state.
It works for 2 of my ACs, but on a third one, the automation for some reason is triggered without any apparent reason, the logbook says that the automation has been triggered due to a change in the climate’s state, looking at the automation trace, i see that it was triggered, but the ‘from_state’ and to_state’ are the same:

this:
  entity_id: automation.top_floor_ac_climate_bind
  state: 'on'
  attributes:
    last_triggered: '2021-08-17T13:20:13.174279+00:00'
    mode: single
    current: 1
    id: '1629096519129'
    friendly_name: Top Floor AC Climate Bind
  last_changed: '2021-08-17T06:05:54.460338+00:00'
  last_updated: '2021-08-17T13:20:13.174463+00:00'
  context:
    id: 903a778f2650118249969f8eef93a34d
    parent_id: 4bd56ef0410abbb2657ba9c1e8dcc821
    user_id: null
trigger:
  id: '0'
  idx: '0'
  platform: state
  entity_id: climate.top_floor_ac_climate
  from_state:
    entity_id: climate.top_floor_ac_climate
    state: 'off'
    attributes:
      hvac_modes:
        - 'off'
        - cool
        - heat
        - heat_cool
      min_temp: 18
      max_temp: 30
      target_temp_step: 1
      fan_modes:
        - low
        - mid
        - high
      current_temperature: 28.4
      temperature: 23
      current_humidity: 49.4
      fan_mode: low
      last_on_operation: cool
      device_code: 1620
      manufacturer: Tornado
      supported_models:
        - Super - Inverter A, i
        - Inverter
        - Inverter A
        - Super Design
        - Super Plasma
        - Gold i
        - Multi ON-OFF
        - Multi Inverter
        - Super Gold i
        - Plasma Gold
      supported_controller: Broadlink
      commands_encoding: Base64
      friendly_name: Climate - Top Floor
      supported_features: 9
    last_changed: '2021-08-17T12:37:51.397533+00:00'
    last_updated: '2021-08-17T13:20:13.167305+00:00'
    context:
      id: 4bd56ef0410abbb2657ba9c1e8dcc821
      parent_id: null
      user_id: null
  to_state:
    entity_id: climate.top_floor_ac_climate
    state: 'off'
    attributes:
      hvac_modes:
        - 'off'
        - cool
        - heat
        - heat_cool
      min_temp: 18
      max_temp: 30
      target_temp_step: 1
      fan_modes:
        - low
        - mid
        - high
      current_temperature: 28.4
      temperature: 23
      current_humidity: 51.2
      fan_mode: low
      last_on_operation: cool
      device_code: 1620
      manufacturer: Tornado
      supported_models:
        - Super - Inverter A, i
        - Inverter
        - Inverter A
        - Super Design
        - Super Plasma
        - Gold i
        - Multi ON-OFF
        - Multi Inverter
        - Super Gold i
        - Plasma Gold
      supported_controller: Broadlink
      commands_encoding: Base64
      friendly_name: Climate - Top Floor
      supported_features: 9
    last_changed: '2021-08-17T12:37:51.397533+00:00'
    last_updated: '2021-08-17T13:20:13.190906+00:00'
    context:
      id: 903a778f2650118249969f8eef93a34d
      parent_id: 4bd56ef0410abbb2657ba9c1e8dcc821
      user_id: null
  for: null
  attribute: null
  description: state of climate.top_floor_ac_climate

Anyone familiar with this issue?

So the blueprint automation is triggered because this climate entity also has a temperature sensor, and when the temperature changes, it is considered a state change, which triggers the automation.
Any idea how to overcome this?

I keep getting this error.

Logger: homeassistant.components.automation.stove_light_state_bonding_dual
Source: components/automation/init.py:522
Integration: Automation (documentation, issues)
First occurred: 6:05:42 AM (2 occurrences)
Last logged: 9:01:43 AM

Error while executing automation automation.stove_light_state_bonding_dual: Template rendered invalid service:

alias: stove light State Bonding - Dual
description: ‘’
use_blueprint:
path: chrissalter/state-bonding-dual.yaml
input:
switch_1: switch.stove_light_new
switch_2: switch.stove_wall_switch