Example of the manual alarm?

As you noticed it’s a rather simple component that allows you to create a custom DIY alarm system based on all your HASS connected sensors (and other devices). It can’t be compared to a dedicated alarm system, but depending on your needs or requirements it might just do the trick
Basically this component is just an alarm panel in software. To make this work you need sensors and automations

I have not gone back and added additional sensor points (that I have added after getting this working) but here is mine.
From my configuration.yaml:

alarm_control_panel:
  platform: manual
  name: "HA Alarm"
  code: !secret alarm_code
  pending_time: 45
  trigger_time: 45
  disarm_after_trigger: false

Also, further down the file:

#### scripts
script:
  light_flash:
    alias: Light flash on
    sequence:
      - service: homeassistant.turn_on
        data:
          entity_id: group.all_lights
      - delay:
          seconds: 1
      - service: homeassistant.turn_off
        data:
          entity_id: group.all_lights
      - service: script.turn_on
        data:
          entity_id: script.light_loop
  light_loop:
    alias: Light flash loop
    sequence:
      - delay:
          # time for flash light off
          seconds: 1
      - service: script.turn_on
        data:
          entity_id: script.light_flash

From my automation.yaml:

################################
### manual alarm panel
################################

- alias: Alarm Away
  hide_entity: True
  trigger:
    - platform: state
      entity_id: sensor.frontd_alarm_level_5
      state: '255'
    - platform: state
      entity_id: sensor.garaged_alarm_level_6
      state: '255'
    - platform: state
      entity_id: sensor.backd_alarm_level_7
      state: '255'
    - platform: state
      entity_id: binary_sensor.multisensor1_sensor_9
      state: 'on'
  condition:
    condition: state
    entity_id: alarm_control_panel.ha_alarm
    state: armed_away
  action:
    service: alarm_control_panel.alarm_trigger
    entity_id: alarm_control_panel.ha_alarm

- alias: Alarm Home
  hide_entity: True
  trigger:
    - platform: state
      entity_id: sensor.frontd_alarm_level_5
      state: '255'
    - platform: state
      entity_id: sensor.garaged_alarm_level_6
      state: '255'
    - platform: state
      entity_id: sensor.backd_alarm_level_7
      state: '255'
  condition:
    condition: state
    entity_id: alarm_control_panel.ha_alarm
    state: armed_home
  action:
    service: alarm_control_panel.alarm_trigger
    entity_id: alarm_control_panel.ha_alarm

################################
### alarm light flash on
################################

- alias: Triggered Flash
  hide_entity: True
  trigger:
    platform: state
    entity_id: alarm_control_panel.ha_alarm
    state: 'triggered'
  action:
    - service: script.turn_on
      entity_id: script.light_flash
    - service: notify.gmail
      data:
#        message: 'Home Alarm Triggered {{now.now().strftime("%Y%m%d-%H%M%S")}}'
        message: 'Home Alarm Triggered {{now().strftime("%Y%m%d-%H%M%S")}}'
################################
### alarm light flash off
################################

- alias: Disarmed Off
  hide_entity: True
  trigger:
    platform: state
    entity_id: alarm_control_panel.ha_alarm
    state: 'disarmed'
  action:
    - service: script.turn_off
      entity_id: script.light_loop
    - service: notify.gmail
      data:
#        message: 'Home Alarm Reset {{now.now().strftime("%Y%m%d-%H%M%S")}}'
        message: 'Home Alarm Reset {{now().strftime("%Y%m%d-%H%M%S")}}'

################################
5 Likes

So is it the case that alarm_control_panel.alarm_trigger only sets the state? There is no display on the HA frontend of this state? Or in other words can I add something on the HA frontend to just show that the alarm was triggered?

Not sure but I believe there is a thread elsewhere that incorporates this. I have HA text me when there is a triggered event.

1 Like

Thanks for sharing the code, it helps me a lot!

But one, many stupid, question. How do you arme and disarm the alarm in HA?

There should be a frontend icon. You can also set a code. (I’m doing this, and coupled with HADashboard it’ll hopely function as a great alarm system.) There’s someone on the forum who expanded the manual alarm component so you could see which monitored sensors are open an the moment of engaging the alarm, and some other features. I hope he’ll file a pull-request soon.
edit: here is the thread: A different take on an alarm system

You can simply that automation quite a bit using multiple entity_id’s:

- platform: state
      entity_id: 
        - sensor.frontd_alarm_level_5
        - sensor.garaged_alarm_level_6
        - sensor.backd_alarm_level_7
      state: '255'
3 Likes

Thanks, I wrote that early on and never looked back :slight_smile: but will defintely re-examine it.

Once you set up the alarm in your configuration and restart there will be a tile on your main interface. From there you click the status (mine is currently “disarmed” and use the pop-up. Enter your code and select the new status for the alarm.

Thanks, I found it!

I created a sensor to map the alarm state value (e.g. “disarmed”) to be Title cased (looks much better and appeases my wife’s OCD spelling nature) . . . but then it doesn’t support the tile click.

I really really wish I could control the UI tiles better in Home Assistant, or have more control over the format the UI values of any state for any component . . . so I could just Title case the value of the darn Manual Alarm component . . .

1 Like

I built off Corey’s example and it works like a champ! I’m not completely done with it, as I want some notifications and pics from cameras and such, but it is working as basic as it is. Right now I just have the door sensors and motion sensors set up. I have a zwave siren (GoControl Zwave Siren and Strobe) for the alarm.

Here’s my config, hopefully it’ll help someone:

configuration.yaml

alarm_control_panel:

  • platform: manual
    name: “HA Alarm”
    code: ****
    pending_time: 30
    disarm_after_trigger: false

groups.yaml

doors:
  name: Doors
  view: yes
  icon: mdi:robot
  entities:
    - binary_sensor.garage_entry_door_sensor_2_0
    - binary_sensor.garage_door_sensor_3_0
    - binary_sensor.kitchen_door_sensor_5_0
    - binary_sensor.front_door_sensor_11_0

doors_sensors:
  name: Doors and Sensors
  view: yes
  icon: mdi:robot
  entities:
    - binary_sensor.garage_entry_door_sensor_2_0
    - binary_sensor.garage_door_sensor_3_0
    - binary_sensor.kitchen_door_sensor_5_0
    - binary_sensor.front_door_sensor_11_0
    - binary_sensor.kitchenmotion_sensor_7_0

alarm:
 name: Alarm
 view: yes
 icon: mdi:shield
 entities:
   - alarm_control_panel.ha_alarm

automations.yaml

  • alias: Security - Disarmed

    trigger:

    • platform: state
      entity_id: alarm_control_panel.ha_alarm
      to: ‘disarmed’

    action:

    • service: homeassistant.turn_off
      entity_id: switch.housealarm_switch_10_0
  • alias: Security - Armed Home

    trigger:

    • platform: state
      entity_id: group.doors
      from: ‘off’
      to: ‘on’

    condition:
    condition: state
    entity_id: alarm_control_panel.ha_alarm
    state: ‘armed_home’

    action:

    • service: homeassistant.turn_on
      entity_id: switch.housealarm_switch_10_0
  • alias: Security - Armed Away

    trigger:

    • platform: state
      entity_id: group.doors_sensors
      from: ‘off’
      to: ‘on’

    condition:
    condition: state
    entity_id: alarm_control_panel.ha_alarm
    state: ‘armed_away’

    action:

    • service: homeassistant.turn_on
      entity_id: switch.housealarm_switch_10_0

I’m new to HA, but this is pretty slick. I’m automating everything!! LOL

4 Likes

BTW- my alarm fires instantly when I open the door after arming. Now on to notifications and snapshots from cameras :wink:

OK, I just noticed my formatting in the previous post is all jacked up. I’m new to this forum, what do I need to do to format it so people can just copy paste for the most part?

Cameras set to record on alarm trigger now. Now for snapshots to be sent via sms or email… once done, I think I’ll add the check for open sensors etc etc.

Honestly, this really could be a reliable system. Put an APC UPS on the Pi, say a 1000 KVA, it’d stay on for hours and hours. The next question would be notifications should you lose power. Hmmmm… maybe a USB cellular device, or a USB connected MiFi… ideas ideas ideas…

3 Likes

Hey do you have your config samples posted to a repo anywhere?

Here is my last push:

1 Like

use the ups with your modem too.

For away alarm I use this one in my front door, So 1 have 40 sec to disarm before the alarm goes off.

  - alias: 'Larm - Bortalarm - Huvudentre'
trigger:
  - platform: state
    entity_id: alarm_control_panel.alarm
    to: 'triggered'   
action:
  - service: notify.ios
    data:
      message: 'Larmet gått på ## (Dörren huvudentre) (Bortalarm)'   
      data:
        push:
          category: camera
        entity_id: camera.foscam_camera_2         

For the other doors i use this, cause I want the alarm to go of in 1 sec

  - alias: 'Larm - Hemmalarm - Dorrsensor Altan'
trigger:
  - platform: state
    entity_id: binary_sensor.dsad_126
    to: 'on'      
condition:
  - condition: state
    entity_id: alarm_control_panel.alarm
    state: armed_home
action:
  - service: alarm_control_panel.alarm_trigger
    entity_id: alarm_control_panel.alarm 
  - service: notify.ios
    data:
      message: 'Larmet gått på ### (Dörr Altan) (Hemmalarm)'   
      data:
        push:
          badge: 0  

Fot the motion stuff i use

  - alias: 'Larm - Bortalarm - Rorelse Huvudentre'
trigger:
  - platform: state
    entity_id: binary_sensor.rorelse_huvudenter_135
    to: 'on'   
condition:
  - condition: state
    entity_id: alarm_control_panel.alarm
    state: armed_away
action:
  - service: alarm_control_panel.alarm_trigger
    entity_id: alarm_control_panel.alarm

I dunno if its for any help, but it might be.

1 Like

I have problem - my switch (motion sensor) won´t turn on alarm. Is there something bad with configuration or I can´t use switch for alarm trigger?

configuration.yaml

homeassistant:
  name: Home
  latitude: 60
  longitude: 18
  elevation: 242
  unit_system: metric
  time_zone: Europe/Prague
  customize: !include customize.yaml
frontend:
config:
http:
updater:
logbook:
rflink:
  port: /dev/serial/by-id/usb-1a86_USB2.0-Serial-if00-port0
switch:
  platform: rflink
  devices:
    rfcustom_524643_0:
      name: senzor pohybu 1
      aliases:
        - tristate_49912a_1
        - chuango_88cea3_02
        - tristate_09912a_10
logger:
  default: error
  logs:
    rflink: debug
    homeassistant.components.rflink: debug
alarm_control_panel:
  - platform: manual
    name: Alarm
    code: 1234
    pending_time: 10
    armed_home:
      pending_time: 0
    triggered:
      pending_time: 10
    trigger_time: 4

group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml

automations.yaml:

 - alias: 'Turn off PIRs'
   initial_state: 'on'
   trigger:
     - platform: state
       entity_id: switch.senzor_pohybu_1
       to: 'on'
   action:
     - delay: '00:00:02'
     - service: switch.turn_off
       entity_id: switch.senzor_pohybu_1

 - alias: 'Trigger alarm while armed away'
   trigger:
     - platform: state
       entity_id: switch.senzor_pohybu_1
       to: 'on'
   condition:
     - condition: state
       entity_id: alarm_control_panel.alarm
       state: armed_away
   action:
     - service: alarm_control_panel.alarm_trigger
       entity_id: alarm_control_panel.alarm

Oh I´ve got it. My default armed state is armed_home. This is it. Now it works.

1 Like