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
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
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.
Does not work, when used with two entities it set status of the first by the status of the second, but not other way round.
This is brilliant! I use this to run the warm water circulation pump when the lights in any of the bathrooms are on. For this I created a âbinary sensorâ from the on/off state of lights:
Helpers > New > Template > Binary State > Template:
{{ is_state(âlight.e1_slaapkamer1_badkamer_plafondâ, âonâ)
or is_state(âlight.e1_slaapkamer2_badkamer_plafondâ, âonâ)
or is_state(âlight.bs_wellness_doucheâ, âonâ)
or is_state(âlight.bs_wellness_wastafelâ, âonâ)
or is_state(âlight.e1_master_bathroom_wastafelâ, âonâ) }}
When the light is on in any of the bathrooms the pump is ON and otherwise itâs off.
Thanks so much for this blueprint solving an issue that has caused me so much headache!
I tried again, and this bluepriont actually works, but at least with zigbee, you must not change states fast etc.
Yes, this script goes badly wrong if you quickly turn on and off a switch in the set.
The system then appears to post hundreds of messages to the other entities, and your lights flicker on and off light a bad 1970âs disco until you disable the automation.
Itâs been a couple of years but I see weâre still struggling with this: Synchronize the on/off state of 2 entities - #81 by dbrand666.
This still seems to work but it hasnât caught on: Select multiple entities to link their on/off state. If any selected entity is turned on or off, the other selected entities will be sent a matching on or off command. ¡ GitHub.
Use my gist or just change the mode on your favorite variant to ârestartâ instead of âqueuedâ.
My first Home Assistant blueprint is a fork of the variant shared by @dbrand666 above. I found that it worked great for turning things on and off, but Iâve got a dimmer that I also wanted to sync, and I also wanted to enable the possibility of using transitions. If you want things to be instantaneous-ish, then just leave the transition time set to 0
.
I hope someone finds this useful!
Love this blueprint. Only issue I had was (as others have noted) it would get into an infinite loop if there were multiple button presses in quick succession.
I solved this by adding a companion automation that consumes double press on a button. My button supports this (Aqara H1) not sure how available that is in others switch variants but someone out there might find this useful.
alias: no_op.double_tap.bathroom_left
description: ""
triggers:
- domain: mqtt
device_id: <switch_device_id>
type: action
subtype: double_left
trigger: device
conditions: []
actions: []
mode: single
⌠or you could use Link On/Off State of Multiple Devices - #33 by dbrand666 which doesnât have the infinite loop problem.
Newbie here.
I am trying to find an automation to replace 2 x 2 way traditional dumb switches with ,2 x zigbee no-neutral switches.
Would this automation, which replicates the state of a switch be appropriate and work?
Very helpful! Thank you
Iâve added a check to avoid issues when devices go offline
condition:
- condition: template
value_template: '{{ trigger.to_state.state != "unknown" }}'
- condition: template
value_template: '{{ trigger.to_state.state != "unavailable" }}'
- condition: template
value_template: >
{{
trigger.to_state.state != trigger.from_state.state
}}
- condition: template
value_template: >
{{
(trigger.to_state.state == "on") or
(trigger.to_state.state == "off")
}}
- condition: template
value_template: >
{{
trigger.to_state.context.parent_id is none or (
trigger.to_state.context.id != this.context.id and
trigger.to_state.context.parent_id != this.context.id)
}}
I combined your logic with the original blueprint from @aderusha and published a version that includes:
restart
mode for safer rapid toggles- Full protection against recursion using
context.id
- Your state validity checks (
unknown
,unavailable
, etc.) - Comments for clarity and reuse
https://gist.github.com/abramvp/46f17c6ffc07fcf816a079230967fd1c
You should be able to combine both unknown and unavailable states in a single line using not in
if you want to clean up the code.
I use this in my automations and it works well - you just need to change the from_state
to to_state
:
- condition: template
value_template: "{{ trigger.from_state.state not in ['unknown', 'unavailable'] }}"