Alarm Card to control a Switch in Lovelace

Hey guys,

I was trying to add an alarm card in lovelace, but I want it to control a switch. I build a switch that controls my alarm. Switch on arms the alarm, switch off disarms the alarm.

I could just make a simple switch, but I like the alarm card UI, and maybe I want it to ask for a pincode to disarm the alarm.

I tried to do it using this code:

      - type: alarm-panel
        states:
          - arm_home
          - arm_away
        entity: movie.switch

But it would not work (as I expected). The alarm card does not accept a switch entity.
I searched the forum, but i could not find anyone with the same idea.

I hope you can help me,
Thanks in advance!

That is not a valid entity id, and no the manual alarm does not accept entities. These are the only valid options: https://www.home-assistant.io/integrations/manual/#configuration-variables

You can turn your switch on and off with automations. e.g.

- alias: 'Switch turn on when alarm is Armed in Away mode'
  trigger:
    - platform: state
      entity_id: alarm_control_panel.home_alarm
      to: "armed_away"
  action:
    - service: switch.turn_on
      entity_id: switch.your_actual_switch_entity_id_here

There are other examples of triggers (like disarmed to turn off your switch) on the page linked to above.

Alright then, i’ll try that. Thanks!