YET another take on an alarm system

Thanks very much for your help Sunonline. I fixed it. It was the dark sky sensor.

GitHub lists this under the optional settings:

“weather: True #[OPTIONAL, Boolean] False by Default. Allows a weather summary to be displayed on the status bar. Dark Sky weather component must be enabled with the name sensor.dark_sky_summary

However reading through alarm.html panel I discovered as well as the dark sky summary sensor it also requires the apparent_temperature sensor. Once I had added this I had no more problems. Not sure why it was still messing up with the weather option disabled but it’s all good now.

I have a couple of other (hopefully simpler) questions now that I have it working.

  1. Is it possible to have the alarm panel in a view instead of (or in addition to) the side menu? What would I put in the group entitiy (as it is a custom panel)?

  2. I have an simple binary sensor RFID reader connected to a GPIO (mometary on when valid) that I would like to use to arm and disarm the system. I have added the two scripts to do this and they work to arm and disarm if activate them manually but am having trouble calling them from the automation. Any idea why this does nothing when I get a valid RFID:

- id: valid_rfid_detected
  alias: 'RFID Valid'
  trigger:
  - platform: state
    entity_id: binary_sensor.rfid_valid
    to: 'on'
  action:
    service: script.turn_on
    data_template:
      entity_id: >
        {% if states.alarm_control_panel.house == "disarmed" %}
          script.alarm_arm
        {% else %}
          script.alarm_disarm
        {% endif %}

you can try put the alarm_control_panel.home in group then add the group to view tab. I myself didn’t use this in view tab before. Just to show the way to group entity and display on view tab.

group:
  home_security:
    name: Home Security
    entities:
      - alarm_control_panel.home

  Security:
    name: Security
    icon: mdi:security  or change to name: security
    view: yes
    entities:
      - group.home_security

for automation trigger the state ‘on’ to able the armed then another automation state ‘off’ to able disarmed

  action:
    service: script.turn_on
    entity_id: script.alarm_arm  <== change name according to your script name.

  action:
    service: script.turn_on
    entity_id: script.alarm_disarm  <== change name according to your script name.

Thank’s for the panel view info. I’ll give it a try soon. /Edit, nope this did not pass the config check:

home_security:
  name: Home Security
  entities:
    - alarm_control_panel.home

Security:
  name: Security
  icon: mdi:security
  view: yes
  entities:
    - group.alarm_control_panel.home

/edit2 I thought the last line needed to be:

    - group.home_security

While that did pass the config check and after a restart did display an icon for the view, there was nothing dispalyed in the view.

As for the script I need to test the current state of the alarm system to toggle the state. My rfid reader only has a mometarty output. So detecting a valid rfid in any armed state needs to run the disarm script, but detecting a valid rfid in the disarmed state needs to run the arm script. Which is what I was trying to do with the data template. However it never calls the arm script.

Actually I just worked out that it does call the disarm script so this test is not evaluating to true when in the disarmed state:

{% if states.alarm_control_panel.house == "disarmed" %}

I’ve also tried:

{% if is_state(alarm_control_panel.house,"disarmed") %}

and

{% if is_state(states.alarm_control_panel.house,"disarmed") %}

Also just unsuccessfully tried:

{% if is_state("states.alarm_control_panel.house","disarmed") %}

None of them evaluate to true in the disarmed state. Any idea of the required syntax?

oh yes. sorry for the wrong group name.

I use normal automation to run script alarm armed and disarmed. trigger the motion detection or clear , condition when not_home or home then action run script to armed or disarmed.

Like this should be good. Unless is NOT disarmed it puts at night in armed_home

  - id: automatic_alarm_armed_home
    alias: '[Alarm] Automatic Home Mode Armed'
    trigger:
      - platform: time
        at: '23:59:00'
    condition:
      - condition: template
        value_template: "{{ not is_state('alarm_control_panel.house', 'disarmed') }}"
    action:
      - service: script.turn_on
        entity_id: script.alarm_arm_home
      - service: notify.claudio_telegram
        data_template:
          message: 'Allarme inserito modalita in casa'
      - service: notify.claudio_zanzito
        data_template:
          message: 'Allarme inserito modalita in casa'
      - service: notify.google_assistant
        data_template:
          message: 'The house alarm has been switched on in home mode. Goodnight'

After a bit of research I found that entity_id does not support data templates as seen here: Passing Arguments to Scripts However I dont think that’s my problem as the entity_id: in my code is inside the template (which is acceptable).

However it looks like gazoscalvertos’ post#123 of this thread has the answer to the syntax: YET another take on an alarm system

{% if is_state('alarm_control_panel.house', 'disarmed') %}

I’ll try it tomorrow.

I still haven’t figured out how to get the alarm panel to show as a view but that’s a job for tomorrow too.

1 Like

I can confirm {% if is_state('alarm_control_panel.house', 'disarmed') %}is working!

1 Like

I made it like this. I wan’t it to arm home unless it’s not already in away mode.
Thanks to both you and tom_I

- id: auto_armed_home
  alias: '[Alarm] AutoArm Home'
  trigger:
    - platform: time
      at: '00:30:00'
  condition:
    - condition: template
      value_template: "{{ not is_state('alarm_control_panel.house', 'armed_away') }}"
  action:
    - service: script.turn_on
      entity_id: script.arm_home

but what if its triggered, or any other status …

For turning off I do this

  - id: automatic_alarm_disarm
    alias: '[Alarm] Automatic Alarm Disarm'
    trigger:
      - platform: time
        at: '06:30:00'
    condition:
      - condition: template
        value_template: "{{ not is_state('alarm_control_panel.house', 'armed_away') }}"
    action:
      - service: script.turn_on
        entity_id: script.alarm_disarm

Yes!

{% if is_state('alarm_control_panel.house', 'disarmed') %}
  script.alarm_arm
{% else %}
  script.alarm_disarm
{% endif %}

Works perfectly to arm/diasrm with the one binary sensor.

I wonder though, is there a way to arm the system instantly rather than waiting the pending_time? Can I pass pending_time data to alarm_control_panel.alarm_arm_away ?

My RFID reader is outside the door, so I dont need the delay when using that to arm/disarm. I do still need the delay if arming/diarming from inside using the HA interface. So setting pending_time to zero in alarm.yaml is not a good option.

Is good sometimes to be a perfectionist, but I don’t think is so important to arm the alarm immediately or in 20 seconds time. Or?

It’s not really perfectionism, more impatience. I could be half way down the street on my bike instead of hanging around for 25 seconds to make sure it arms.

Just do this:

pending_time: 1

So like this?

alarm_arm_instant:
  sequence:
    service: alarm_control_panel.alarm_arm_away
    entity_id: alarm_control_panel.house
    data:
      pending_time: 1

/edit. Hmm. No, not like that.

Just a question on this I have tried to set this up but we each time I have gotten a partial config for the alarm panel. Is there anything I could be missing?

Probably the way you install it. If you tell us the way you install then we can help.

You have to change the pending time option in the alarm.yaml. So every time the alarm is armed, it will only count 1 second before arming. I havent tried with 0 seconds, but you can give it a shot.

Capture

1 Like

Thanks for your assistance but if you read my original post you will see that is not an option. I still need the delay if arming from inside. I only want to arm instantly if using the RFID reader outside.

Post your alarm.yaml file to aid diagnosis.

Oh, my! I am sorry! I didnt even notice! I obviously didnt read it cerefuly. I will try to look for a solution and if I find a way around, I will inform you.