State Bonding - Dual

Tags: #<Tag:0x00007fc417991988> #<Tag:0x00007fc417991758>

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

1 Like

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.

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?