Link On/Off State of Multiple Devices

Thanks to this Blueprint, Thanks @luma . I was following since @hebus time…great blueprint until the the “unavailable” error occurs on the latest HA update.

This one works fantastically.

Solid work @luma. Will you make an update to add in presets, effects and/or effects? Lights I’ve linked to these switches don’t survive notification blinks with their color intact.

Hi all, noob here. In regards to this blueprint I only want it to happen during certain times and days of the week. Can I assume that I can just insert the below code into this code under the conditions section?

condition:
  - condition: time
    weekday:
      - mon
      - tue
      - wed
      - thu
      - fri
      - sat
    after: "07:00:00"
    before: "23:59:00"

I assume that I will have to not use the blueprint but instead create an automation from the source code?

All good. I sorted it out with some code from Twanne’s blueprint_day_time_condition. Added this to the blueprint and now it works between days and time that are specified. If anyone is interested this is how I set it up

This conditions exists to prevent loop:

S1 physically turns on (trigger blueprint) > Link Blueprint turn S2 (also trigger blueprint, wont get past the condition you deleted)

But appears that the parent id of the context.to_state.parent_id wont appear as null in this sceario:

S1 off > on (physically)
S2 off > on (blueprint turned on)
S2 on > off) (parent_id is not null) (wont get past condition)

edit: seems to only happen when trigged when changing state using the phyisical button on the device, if done via UI works fine.

For my situation, I have a device that reports unavailable when HA restarts. Therefor, I’ve added an extra condition template to have it not trigger the automation when the state of a device changes “from unavailable”:

- condition: template
  value_template: '{{ trigger.from_state.state != "unavailable" }}'

Seems to work like a charm now for me :slight_smile:

1 Like

I have the same issue, How did you manage to solve it?

Thanky for this blueprint !
I used it to link a ZWave in-wall-switch to a Hue Zigbee ceiling lamp (complex with many lights).

Sadly, I found an error I can’t quite get behind :

  • Using the Home Assistant app / Lovelace UI everything works as expected. I can even see the switch state change as expected.
  • When using the switch alone, everything works as expected

Here comes the error :

  • When I change the state over the UI / App, I can’t change the state using the switch for some seconds (something like 4-5 seconds)
    Does anyone have an idea what it might be ?
    Thanks !

Whjile this plugin works great, anyone also noticing a noticable delay between flcking a switch (not the main one but the slave one),

takes about 10-15 seconds in order to switch the other switch. Any idea how i can resolve this delya??

View the traces in your automation and check the timestamps to find where the delay is happening. Either the master switch is slow to report, or your slave switch is slow to respond.

Got it fixed.

Device causing it was an ESP32. Setting the powersafe option in ESP home to none, fixed it.

Thought it was the plugin, but my mistake. Plugin is working instantly!!

Excuses :slight_smile:

Hello,

This is a great blueprint, thank you! One question, is there a way to still operate the switches individually? Most of the times I want all of the switches to turn on/off at the same time, but there are occasions when I would only one to turn on. Can this be achieved? (Ideally I’d like to create a ‘master’ switch for all the switches, but then also retain all the idividual switches).

Thanks

edit: just figured out i can do this with a Group Helper

Edit 2: is there a way to add Helpers to dashboard??

I use this to link a wifi wall switch with a wifi power inline on a light cord. Very simple setup.

Yesterday I had it freak out on me after turning the wall switch off and on quickly by mistake, then trying to turn it off again. They both start toggling on and off continuously for about 10 seconds. Never seen this before.

Sharing my v1.1 update with @bart_lauwers53 code and every minute background check. Nothing else changed. Source code here

Getting many errors in log from you 1.1 script (15.000 errors in 2 days).

Logger: homeassistant.components.automation
Source: components/automation/__init__.py:1006
Integration: Automatisierung ([documentation](https://www.home-assistant.io/integrations/automation), [issues](https://github.com/home-assistant/core/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+automation%22))
First occurred: 18:27:00 (645 occurrences)
Last logged: 19:09:00

* Error evaluating condition in 'Link_Spüle_Alexa': In 'condition' (item 1 of 4): In 'template' condition: UndefinedError: 'dict object' has no attribute 'to_state' In 'condition' (item 2 of 4): In 'template' condition: UndefinedError: 'dict object' has no attribute 'to_state' In 'condition' (item 3 of 4): In 'template' condition: UndefinedError: 'dict object' has no attribute 'to_state' In 'condition' (item 4 of 4): In 'template' condition: UndefinedError: 'dict object' has no attribute 'from_state'
* Error evaluating condition in 'Link_Badstreifen_Alexa': In 'condition' (item 1 of 4): In 'template' condition: UndefinedError: 'dict object' has no attribute 'to_state' In 'condition' (item 2 of 4): In 'template' condition: UndefinedError: 'dict object' has no attribute 'to_state' In 'condition' (item 3 of 4): In 'template' condition: UndefinedError: 'dict object' has no attribute 'to_state' In 'condition' (item 4 of 4): In 'template' condition: UndefinedError: 'dict object' has no attribute 'from_state'
* Error evaluating condition in 'Link_Werkbank_Alexa': In 'condition' (item 1 of 4): In 'template' condition: UndefinedError: 'dict object' has no attribute 'to_state' In 'condition' (item 2 of 4): In 'template' condition: UndefinedError: 'dict object' has no attribute 'to_state' In 'condition' (item 3 of 4): In 'template' condition: UndefinedError: 'dict object' has no attribute 'to_state' In 'condition' (item 4 of 4): In 'template' condition: UndefinedError: 'dict object' has no attribute 'from_state'
* Error evaluating condition in 'Link_Werkstatt_Alexa': In 'condition' (item 1 of 4): In 'template' condition: UndefinedError: 'dict object' has no attribute 'to_state' In 'condition' (item 2 of 4): In 'template' condition: UndefinedError: 'dict object' has no attribute 'to_state' In 'condition' (item 3 of 4): In 'template' condition: UndefinedError: 'dict object' has no attribute 'to_state' In 'condition' (item 4 of 4): In 'template' condition: UndefinedError: 'dict object' has no attribute 'from_state'
* Error evaluating condition in 'Link_Unten_Alexa': In 'condition' (item 1 of 4): In 'template' condition: UndefinedError: 'dict object' has no attribute 'to_state' In 'condition' (item 2 of 4): In 'template' condition: UndefinedError: 'dict object' has no attribute 'to_state' In 'condition' (item 3 of 4): In 'template' condition: UndefinedError: 'dict object' has no attribute 'to_state' In 'condition' (item 4 of 4): In 'template' condition: UndefinedError: 'dict object' has no attribute 'from_state'

Can you tell me whats wrong here? (Links are working flawlessly)

1 Like

What is the functional difference between this this other Template? Linked Entities - keep mutlple entities binary state in sync (lights, switches, etc.) - #4 by TimU

Thanks for the work on this blueprint, it’s saved me a ton of time.

I have one issue which might be my use-case but possibly someone has come across this.

I have 4 lightstrips which are part of a group.
I’ve got this blueprint syncing the group entity with the light switch entity.
This works great for turning the group on/off from the switch.

But sometimes I want to just turn on a single light strip, The issue I have is I toggle the single strip, and then will then toggle the group entity.
Without this blueprint, if i toggle a single lightstrip the entity for the group turns to “on” but the other 3 strips don’t turn on (which is ideal).

Previously i was using another blueprint: adchevrier/synchronize-the-on-off-state-of-2-entities which allowed this to work, however with this new blueprint if i toggle 1 lightstrip, it will toggle the lightswitch to ON which is expected, but then that would trigger the whole group to ON rather than just keeping the 1 lightstrip that i turned on.

Any ideas on a way to overcome this ?

Thank you so much :smiley:

There’s an option when setting up the group which lets you choose whether to show the group as on when ONE light is on, or when ALL lights are on.

Maybe that would fix your issue?

Edit: found the option. It’s called All

So in my case that setting doesn’t work as I want.
I’ve found that turning on 1 light, doesn’t toggle the light switch, but also since the light switch it paired with the group entity, turning off one light when they’re all on turns all off :frowning:

I need to somehow get it to ignore the state of the other lights if they’re toggled manually, but regardless have the light switch toggle all on/off

This blueprint is designed for two-way sync, but you’re trying to do one-way. That’s easy enough with a simple automation, when your light switch turns on, turn on all the individual lights. Switch turns off, lights turn off. The tricky bits in the code here all deal with the various problems which come up with two-way sync. One-way has no such problems, so just a simple automation should do ya.