Forked from aderusha/link_multiple_switches.yaml
Last active
August 31, 2025 09:41
-
-
Save westerneer/ab3cf9a6f200e23485841c282aaeb450 to your computer and use it in GitHub Desktop.
Home Assistant Blueprint: Link Multiple Switches v1.0.1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| blueprint: | |
| name: Link Multiple Switches | |
| description: | | |
| ## Link multiple switches together v1.0.3 | |
| v1.0.3 - Filtering state to eliminate Home Assistant errors. | |
| v1.0.2 - Select multiple switch entities to link their on/off state. If any selected switch entity is turned on or off, the other selected entities will be sent a matching on or off command. As a debounce I modified it not to be queued, but have only a single instance running. So far working fine. | |
| -- westerneer | |
| Requires Home Assistant 2022.5.0 or newer. | |
| Credit to @adreshua for the previous blueprint: https://gist.github.com/aderusha/4f25658dbb855675b5b5ccf296fd801b | |
| Credit to @adchevrier for the initial blueprint: https://community.home-assistant.io/t/synchronize-the-on-off-state-of-2-entities/259010 | |
| Credit to @Hebus for this fantastic template: https://community.home-assistant.io/t/synchronize-the-on-off-state-of-2-entities/259010/38 | |
| domain: automation | |
| homeassistant: | |
| min_version: 2022.5.0 | |
| input: | |
| switches: | |
| name: Switch Entites | |
| selector: | |
| entity: | |
| domain: switch | |
| multiple: true | |
| source_url: https://gist.github.com/westerneer/ab3cf9a6f200e23485841c282aaeb450 | |
| mode: single | |
| max_exceeded: silent | |
| variables: | |
| switches: !input 'switches' | |
| trigger: | |
| - platform: state | |
| entity_id: !input 'switches' | |
| condition: | |
| - condition: template | |
| value_template: '{{ trigger.to_state.state != trigger.from_state.state }}' | |
| - condition: template | |
| value_template: '{{ trigger.to_state.state != ["unknown", "unavailable"] }}' | |
| - 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) }}' | |
| action: | |
| - service: homeassistant.turn_{{ trigger.to_state.state }} | |
| target: | |
| entity_id: '{{ expand(switches) | selectattr("entity_id", "!=", trigger.entity_id) | map(attribute="entity_id") | list }}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment