Ajax alarm system

Hi,

Possible to make a sneak tutorial ? :smiley:

@eavanvalkenburg the ajax supports ARm/Disarm and Night Mode; i need to differentiate between these modes. At the moment i can see status as Armed or “Armed away”.

I don’t think the component supports arming and disarming as states I always trigger based on the new state, it should support night mode, does for me with ajax, so create some logs and post those!

such a trigger doesnt work;

that trigger also doesnt work

What do u mean by it should support night mode; if i activate night mode… the HASS shows all the time armed away

So couple of things, in this line you can see the translation that the component makes from a SIA code that comes in to a HA state: https://github.com/home-assistant/core/blob/ba0196137e9bf07c5c32a72b772a11e6288cc290/homeassistant/components/sia/alarm_control_panel.py#L51

So there are two codes that set it to night mode, if there is another let me know, so please turn on logging for the component (homeassistant.components.sia) and package (pysiaalarm) and post back here or create an issue in the HA core repo.

In your state trigger you use 'Armed away", that should be ‘armed_away’, and armed is also not a state, so not surprising that the above trigger doesn’t work (the other states are disarmed and armed_night (source: https://github.com/home-assistant/core/blob/ba0196137e9bf07c5c32a72b772a11e6288cc290/homeassistant/const.py#L277)!

I will also look into the device trigger for this, if I need to change something to make that work!

Yet, i’m having this state:

image

hi my friend. At this moment I have the alarm communicating via SIA (latest beta version v0.5.0-beta.9) and I can already see the status of the alarm, but a problem arises. If you activate and deactivate the alarm, the state in the home assistant changes, so far everything is ok. the problem is that when I do the nightly arming of the alarm or partial arming, it changes in the home assistant but later when I disarm the alarm it no longer changes to disarmed. it is still in night mode instead of disarmed. to update the status I have to arm and disarm.

From what I’ve checked I think the problem is in the alarm_control_panel.py file in custom_components/sia because the STATE_ALARM_DISARMED_NIGHT command is not there. I tried to add but I must be doing something wrong as it stopped detecting my zones. Can you check and help me solve the problem? Thank you

1 Like

Hi, please switch to the official integration, it is better (see above in this thread for the steps). There is no such thing as DISARMED_NIGHT, what happens is that the alarm reverts to the previous state (https://github.com/home-assistant/core/blob/0139bfa7497cfed160eeaf6016c50cb99e953361/homeassistant/components/sia/alarm_control_panel.py#L53). If your alarm uses some other code for disarming from night_mode, check which one in the log and please create an issue in the HA repo!

when i click on Nigh mode in ajax app / there is basically no change of the state of ajax… it still shows up in hass as Disarmed ;/

Then turn on logging and post the logs so we can see what’s happening!

Hello,
Are they any solution to get event like door is open or motion detected in living room for example ? I can get event arm/dis alarm but no other event…

Thank in advance

I have installed the official integration. I am getting guard state from AJAX Hub Plus. But from HA I can’t put under armed or disarm. Error - Failed to call service alarm_control_panel / alarm_disarm.
In the logs:

File "/usr/src/homeassistant/homeassistant/components/alarm_control_panel/__init__.py", line 152, in alarm_disarm
raise NotImplementedError ()

What am I missing?)

As is documented, the SIA protocol doesn’t allow for control of the alarm system, just monitoring it, so pressing arm or disarm in HA does indeed do nothing and throw that error.

In the Ajax system, nightmode is a (global) state separate from zone armed/disarmed and can be on/off independently of zone armed/disarmed state. I came up with this workaround automation for my 3 zones:

- alias: "On SIA event 1/NL, nightmode is on"
  trigger:
    - platform: event
      event_type: sia_event_12345_AAA
      event_data:
        ri: "1"
        code: "NL"
  action:
    - service: input_boolean.turn_on
      entity_id: input_boolean.ajax_nightmode

- alias: "On SIA event 1/NP, nightmode is off"
  trigger:
    - platform: event
      event_type: sia_event_12345_AAA
      event_data:
        ri: "1"
        code: "NP"
  action:
    - service: input_boolean.turn_off
      entity_id: input_boolean.ajax_nightmode

- alias: "On SIA event 1/CG, house is armed"
  trigger:
    - platform: event
      event_type: sia_event_12345_AAA
      event_data:
        ri: "1"
        code: "CG"
  action:
    - service: input_boolean.turn_on
      entity_id: input_boolean.ajax_house_armed

- alias: "On SIA event 1/OG, house is disarmed"
  trigger:
    - platform: event
      event_type: sia_event_12345_AAA
      event_data:
        ri: "1"
        code: "OG"
  action:
    - service: input_boolean.turn_off
      entity_id: input_boolean.ajax_house_armed

- alias: "On SIA event 2/CG, garage is armed"
  trigger:
    - platform: event
      event_type: sia_event_12345_AAA
      event_data:
        ri: "2"
        code: "CG"
  action:
    - service: input_boolean.turn_on
      entity_id: input_boolean.ajax_garage_armed

- alias: "On SIA event 2/OG, garage is disarmed"
  trigger:
    - platform: event
      event_type: sia_event_12345_AAA
      event_data:
        ri: "2"
        code: "OG"
  action:
    - service: input_boolean.turn_off
      entity_id: input_boolean.ajax_garage_armed

- alias: "On SIA event 3/CG, garden is armed"
  trigger:
    - platform: event
      event_type: sia_event_12345_AAA
      event_data:
        ri: "3"
        code: "CG"
  action:
    - service: input_boolean.turn_on
      entity_id: input_boolean.ajax_garden_armed

- alias: "On SIA event 3/OG, garden is disarmed"
  trigger:
    - platform: event
      event_type: sia_event_12345_AAA
      event_data:
        ri: "3"
        code: "OG"
  action:
    - service: input_boolean.turn_off
      entity_id: input_boolean.ajax_garden_armed
input_boolean:
  ajax_house_armed:
    name: House is armed
  ajax_garage_armed:
    name: Garage is armed
  ajax_garden_armed:
    name: Garden is armed
  ajax_nightmode:
    name: Alarm Nightmode
alarm_control_panel:
  - platform: template
    panels:
      alarm_house:
        name: "House Alarm"
        value_template: >
          {% if is_state('input_boolean.ajax_house_armed', 'on') %}
            armed_away
          {% elif is_state('input_boolean.ajax_nightmode', 'on') %}
            armed_night
          {% else %}
            disarmed
          {% endif %}
      alarm_garage:
        name: "Garage Alarm"
        value_template: >
          {% if is_state('input_boolean.ajax_garage_armed', 'on') %}
            armed_away
          {% elif is_state('input_boolean.ajax_nightmode', 'on') %}
            armed_night
          {% else %}
            disarmed
          {% endif %}
      alarm_garden:
        name: "Garden Alarm"
        value_template: >
          {% if is_state('input_boolean.ajax_garden_armed', 'on') %}
            armed_away
          {% elif is_state('input_boolean.ajax_nightmode', 'on') %}
            armed_night
          {% else %}
            disarmed
          {% endif %}

I’m not sure this is necessary, the codes you use are handled in such a way that as far as I can see will result in the same state as your two alarm_control_panel templates, because coming off night mode it will revert to the previous state (armed or disarmed), if not then let me know and let’s fix it in the code!

In Ajax I can arm and disarm zones while night mode is engaged, independently of the night mode. With the current SIA integration, the NL code sent by Ajax when night mode is turned off turns the zone states into “unknown”, at least if I have armed or disarmed some zone after night mode was last turned off.

Also, I haven’t tried this yet, but I think it will send BA to trigger intruder alert, which should set the panel to “triggered”, then BR when the alert is recalled, which should set it back to night mode and/or armed.

ah ok, is that only available when you switch to group/zone based setup? Because for me it seems I just have armed, disarmed and night!

Possibly. I have zone/group mode enabled because I want to have my garage, which is a separate building, armed most of the time, even when I’m home inside or in the garden. The garage is configured to remain armed when the main system is disarmed, but become armed when the main system is armed. It can only be disarmed using a second keypad inside the garage or using the app. When in night mode, I can still choose to have the house and/or the garage fully armed.

1 Like

Hey all, I just created a beta release of the custom component that has the same code and config as the official integration, I decided to not yet replace the regular version so someone who updates without looking in HACS doesn’t get errors and stuff but that will happen soon. I plan to do further development here before then merging that into the official integration. One of the open PR’s of the official integration is to readd the last heartbeat sensor, so that is already in this beta as well, as well as the latest version of the package, which has better support for ADM-CID! I will also see if I can work on improved logic for the night mode based on the comments by @Puxie!

1 Like

Hi,

I have almost all solved.

I have only one problem, when I desactivate the night mode, status on HA change to unknown. If I desactivate the alarm form the normal armed_away status change correctly to disarmed.

Please could you help me , step by step how can I solve it?.

Thanks