Last active
June 7, 2024 22:59
-
-
Save haade-administrator/f48574f3341c1ec5715dd1726177b05e to your computer and use it in GitHub Desktop.
création d'un va et vient dans homeassistant entre 2 interrupteurs intégration avec Blueprint
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: 2 way simulate | |
description: > | |
## Bind Two switches together to act in unison | |
🔥**Version**: v1.2 | |
source_url: https://gist.github.com/haade-administrator/f48574f3341c1ec5715dd1726177b05e | |
domain: automation | |
input: | |
switch_1: | |
name: Switch 1 | |
selector: | |
entity: | |
domain: switch | |
switch_2: | |
name: Switch 2 | |
selector: | |
entity: | |
domain: switch | |
variables: | |
switch_1: !input switch_1 | |
switch_2: !input switch_2 | |
trigger: | |
- platform: state | |
entity_id: | |
- !input switch_1 | |
- !input switch_2 | |
to: | |
- 'on' | |
- 'off' | |
mode: single | |
condition: | |
'{{ trigger.to_state.state != trigger.from_state.state }}' | |
action: | |
# Set to target value | |
- choose: | |
- conditions: | |
- '{{ trigger.entity_id != switch_1 }}' | |
- '{{ trigger.to_state.state != states(switch_1) }}' | |
sequence: | |
- service: 'switch.turn_{{ trigger.to_state.state }}' | |
entity_id: !input switch_1 | |
- choose: | |
- conditions: | |
- '{{ trigger.entity_id != switch_2 }}' | |
- '{{ trigger.to_state.state != states(switch_2) }}' | |
sequence: | |
- service: 'switch.turn_{{ trigger.to_state.state }}' | |
entity_id: !input switch_2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I would add something like :
trigger:
not_to:
As from latest HA update the message related with:
The automation "David Bedroom light 2 way" (automation.david_bedroom_light_2_way) has an action that calls an unknown service: switch.turn_unavailable.
came out at every Z2M restart.
Your automation calls the service: homeassistant.turn_unavailable which does not exist.
"unavailable" is a valid state for any entity (so is unknown"). The way you wrote service template in your automation, allows for calling:
homeassistant.turn_unavailable
homeassistant.turn_unknown
You need to make sure the "to_state" is either "on" or "off" to ensure you are not calling a non-existing service (and thus you automation will fail running).