Problem with switches

Hi!
I have set up my neato vacuum,google home, nvidia shield, yale doorman lock and so on and have created some switches

Theese 2 works fine:

switch:
  platform: template
  switches:
    yale_lock:
      friendly_name: 'Entrance'
      value_template: "{{ is_state('lock.entre', 'locked') }}"
      turn_on:
        service: lock.lock
        data:
          entity_id: lock.entre
          code: !secret house_pin
      turn_off:
        service: lock.unlock
        data:
          entity_id: lock.entre
          code: !secret house_pin
switch:
  platform: template
  switches:
    yale_alarm:
      friendly_name: 'Larm'
      value_template: "{{ is_state('alarm_control_panel.skivlingvagen_alarm', 'armed_away') }}"
      turn_on:
        service: alarm_control_panel.alarm_arm_away
        data:
          entity_id: alarm_control_panel.skivlingvagen_alarm
          code: !secret arm_pin
      turn_off:
        service: alarm_control_panel.alarm_disarm
        data:
          entity_id: alarm_control_panel.skivlingvagen_alarm
          code: !secret arm_pin

But when i add this code for my zoneminder installation the second switch (the alarm switch) just disappears, config reports valid but i guess im doing something wrong.

Zoneminder switch code:

switch:
  - platform: zoneminder
    command_on: Modect
    command_off: Monitor

Another question: is it possible to use the lock switch to arm/disarm the alarm with the same button? i cant get it working with automation, however i can get it working the other way around as in when arming alarm the door locks…

the problem is you can only have one "switch: " heading in your config. all switches go under the one section.

switch:
  - platform: template
    switches:
      yale_lock:
        friendly_name: 'Entrance'
        value_template: "{{ is_state('lock.entre', 'locked') }}"
        turn_on:
          service: lock.lock
          data:
            entity_id: lock.entre
            code: !secret house_pin
        turn_off:
          service: lock.unlock
          data:
            entity_id: lock.entre
            code: !secret house_pin
      yale_alarm:
        friendly_name: 'Larm'
        value_template: "{{ is_state('alarm_control_panel.skivlingvagen_alarm', 'armed_away') }}"
        turn_on:
          service: alarm_control_panel.alarm_arm_away
          data:
            entity_id: alarm_control_panel.skivlingvagen_alarm
            code: !secret arm_pin
        turn_off:
          service: alarm_control_panel.alarm_disarm
          data:
            entity_id: alarm_control_panel.skivlingvagen_alarm
            code: !secret arm_pin
  - platform: zoneminder
    command_on: Modect
    command_off: Monitor
2 Likes

ohh!

Thanks alot. works fine now! :slight_smile: