2 or more lock template

How I can add another entities to lock template?
I’m a newborn

this is my actual code:

lock:
  - platform: template
    name: Cancello Grande
    value_template: "{{ is_state('switch.videocitofono_door_relay_1', 'off') }}"
    lock:
      service: switch.turn_off
      target:
        entity_id: switch.videocitofono_door_relay_1
    unlock:
      service: switch.turn_on
      target:
        entity_id: switch.videocitofono_door_relay_1

thanks.

All you need to do is duplicate your template code with different entities and a different name.

lock:
  - platform: template
    name: Cancello Grande
    value_template: "{{ is_state('switch.videocitofono_door_relay_1', 'off') }}"
    lock:
      service: switch.turn_off
      target:
        entity_id: switch.videocitofono_door_relay_1
    unlock:
      service: switch.turn_on
      target:
        entity_id: switch.videocitofono_door_relay_1

  - platform: template
    name: Cancello Grande 2
    value_template: "{{ is_state('switch.videocitofono_door_relay_2', 'off') }}"
    lock:
      service: switch.turn_off
      target:
        entity_id: switch.videocitofono_door_relay_2
    unlock:
      service: switch.turn_on
      target:
        entity_id: switch.videocitofono_door_relay_2
1 Like