Skip to content

Instantly share code, notes, and snippets.

@gaetanars
Created December 6, 2025 22:00
Show Gist options
  • Select an option

  • Save gaetanars/eed070d778007d8a2e6bf6a0cd1e8802 to your computer and use it in GitHub Desktop.

Select an option

Save gaetanars/eed070d778007d8a2e6bf6a0cd1e8802 to your computer and use it in GitHub Desktop.
Synchroniser un interrupteur sur l'état d'un capteur
blueprint:
name: Synchroniser un interrupteur sur l'état d'un capteur
description: >
Allume ou éteint un interrupteur (ou une lumière) pour qu'il corresponde à
l'état d'un capteur binaire. L'état est synchronisé au changement du capteur
et au redémarrage de Home Assistant.
domain: automation
homeassistant:
min_version: 2024.6.0
input:
binary_sensor:
name: Capteur binaire de référence
description: Ce capteur dictera si l'entité de sortie doit être allumée ('on') ou éteinte ('off').
selector:
entity:
domain: binary_sensor
output:
name: Interrupteur ou lumière à contrôler
description: Cette entité suivra l'état du capteur binaire.
selector:
entity:
domain:
- switch
- light
mode: single
max_exceeded: silent
variables:
binary_sensor: !input binary_sensor
output: !input output
triggers:
- trigger: state
entity_id:
- !input binary_sensor
- trigger: homeassistant
event: start
conditions:
- condition: template
value_template: "{{ states(binary_sensor) != states(output) }}"
actions:
- action: >
{% if is_state(binary_sensor, 'on') %}
homeassistant.turn_on
{% else %}
homeassistant.turn_off
{% endif %}
target:
entity_id: !input output
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment