Interlock 2 Entities - Single Run Mode

A simple blueprint that, given two entities, turns one off when the other one is turned on. The entities can both be off, but only one at a time can be on.

blueprint:
  name: Interlock
  description: Turns off one entity when the other one is turned on
  domain: automation
  input:
    entity_1:
      name: First entity
      selector:
        entity:
    entity_2:
      name: Second entity
      selector:
        entity: 
mode: single
max_exceeded: silent
variables:
  entity_1: !input 'entity_1'
  entity_2: !input 'entity_2'
trigger:
- platform: state
  entity_id: !input 'entity_1'
- platform: state
  entity_id: !input 'entity_2'
condition: '{{ trigger.to_state.state == "on" }}'
action:
- service: homeassistant.turn_off
  target:
    entity_id: >
      {% if trigger.from_state.entity_id == entity_1 %}
      {{ entity_2 }}
      {% else %}
      {{ entity_1 }}
      {% endif %}
3 Likes

Hey, I changed it to work with 3 entities, it seems to be doing ok so far :slight_smile:

blueprint:
  name: Interlock
  description: Turns off one entity when the other one is turned on
  domain: automation
  input:
    entity_1:
      name: First entity
      selector:
        entity: {}
    entity_2:
      name: Second entity
      selector:
        entity: {}
    entity_3:
      name: Third entity
      selector:
        entity: {}
  source_url: https://community.home-assistant.io/t/interlock-2-entities-single-run-mode/410062
mode: single
max_exceeded: silent
variables:
  entity_1: !input 'entity_1'
  entity_2: !input 'entity_2'
  entity_3: !input 'entity_3'
trigger:
- platform: state
  entity_id: !input 'entity_1'
- platform: state
  entity_id: !input 'entity_2'
- platform: state
  entity_id: !input 'entity_3'
condition: '{{ trigger.to_state.state == "on" }}'
action:
- service: homeassistant.turn_off
  target:
    entity_id: >-
      {% if trigger.from_state.entity_id == entity_1 %}
      {{ entity_2, entity_3 }}
      {% elif trigger.from_state.entity_id == entity_2 %}
      {{ entity_3, entity_1 }}
      {% else %}
      {{ entity_1, entity_2 }}
      {% endif %}
4 Likes

@krash You’re the Master!!. Thank you so much for your help with this blueprint, is perfect. Only one question. I would like to use to manage 3 speed selector in a exhaust fan, and I suspect this automation first switch on the entity (L1 or speed 1 in my case) and them switch off the rest of entities (L2 and L3 in my case). In my case I don’t want 2 entities would be in ON a milliseconds because I’m managing fan motor. Would be possible to add a pause (1 or 2 seconds, no more) since I switch on and entity and automation switch off the others??.
Thanks for your help.

Since you are concerned about switching everything off before switching the desired switch turns on, and you only have 3 entities, I would just make 3 scripts.

Each script would turn all the switches off, delay some ms, then turn on the one you want.

Then just run script 1,2 or 3 instead of switches.

I don’t know if I’m making sense, let me know if you want me to explain it better :slight_smile: