Ajax alarm system

Thank you very much, I’m still weak in this, but I seem to have begun to understand how to do it.

Hi there!

I tried to add the integration, but the “Monitoring station” stays “not connected” in the Ajax App.
I can see the entities in HA (both for Zone 1 and Zone 2), but without any state update. The only update I noted is a “2022 ISO8601” appeared in the Last Heartbeat entity after 2-3 days.

Could it be a port problem? How can I select a proper port for communication?
Thanks everyone!!!

Help, how to get the last_message I can not figure out how to do it. If I understand correctly, this is necessary to get to know the id of the spacecontrol.

Indeed. From where I am I do not have access to my HA ( as a matter of fact I discovered that VSC needs 4Mb of RAM, and HA is currently crashed, I need to remove this integration). However, from memory, you get access with this YAML instruction.

'{{state_attr(trigger.entity_id,''last_message'')}}'

It seems that everything is done correctly, but when the button is pressed, nothing happens.

Maybe this post will help you How to get alarm attributes and states and act accordingly
In my case any alarm change is send to another system with a Restfull command

If you have the last heartbeat sensor then you are using the custom component, the official integration is a bit more stable and in 2022.3 should also have a connectivity sensor and tighter behaviour for the entity attributes.

The port is up to you, on the server side (your HA system) it should be an open port (so not something like 80 or 443) and also not the HA port (default is 8123) but anything else (I usually use something like 8124) and then just make sure you have the same port set in your alarm.

1 Like

Thank you Eduard! I was able to solve my issue thanks to the official integration.
Now I can see correctly the status update and its history.

Since I’m using Homey as main domotic hub, I would like to create “virtual sensors” in HA indicating “armed” or “disarmed”, to create flows depending on the state. The current entity is not seen by Homey as a device :thinking:
Thanks again, going to study a solution :grin:

Good afternoon, I should have received this result or more data can be obtained.

From my experience, last_message is linked to the device that acted on the alarm (Ajax App account, Space Control, …). To my knowledge, there is no way to anticipate what could be the value, but when it is reported once it will stay forever the same. So far I rely on that to detect who did what.

Thank you very much.

@eavanvalkenburg: is there a way to customize this card in order to size it down and remove unecessary buttons (arm away and arm home). Four zones are managed, as it can be seen, it takes too much place. Thank you

I don’t know, I’m no front-end expert, but potentially there are people making custom visuals for alarms!

Thank you @eavanvalkenburg. It just happen that I was about to post the solution. I’m not expert either, still on the learning curve :wink: Until now, I did not make the switch to Lovelace personalization. Once that move is made, it is straighforward to remove the two buttons (just edit the card and set properties accordingly).

What was wrong and made it work? :slight_smile:

I’ve tried…a lot. Still Not connected from the Ajax app. IP is correct, ID of Ajax hub is correct… Don’t know what to do.

Good morning, can you put examples of your templates? some users have put some and I am very grateful but I am a novice and it is difficult for me to create them.

I put mine can someone help me interpret the data in the template and simplify them. Now to know which user arms and others I create several identities…

I do it by template because the alarm identity when a zone is opened says that it is in alarm but when it is closed it goes into normal armed mode… thanks

I’m sorry for my English

template:
  
#### HUB AJAX ULTIMO TEST

  - trigger:
      - platform: event
        event_type: sia_event_5000_2222
        event_data:
          code: "RP"

    sensor:
      - name: "Ajax HUB ultimo test"
        unique_id: ajax.test
        state: "{{trigger.event.data.timestamp}}"
        device_class: timestamp
        unit_of_measurement: ISO8611
        icon: mdi:clock-check-outline


#### AJAX HUB USUARIO

  - trigger:
      - platform: event
        event_type: sia_event_5000_2222
        event_data:
          code: 'CG'          # Area Cerrada
          ri: '1'

      - platform: event
        event_type: sia_event_5000_2222
        event_data:
          code: 'OG'          # Area Abierta
          ri: '1'

    sensor:
      - name: "Ajax USUARIO HUB A1"
        unique_id: ajax.usuario.a1
        icon: mdi:account
        state: "{{trigger.event.data.message}}" # Lee el usuario que a hecho la accion

  - sensor:
      - name: "USUARIO A1"
        icon: mdi:account
        state: >
          {% if is_state('sensor.ajax_usuario_hub_a1', '501') %}
            Alberto Pro
            
          {% elif is_state('sensor.ajax_usuario_hub_a1', '8') %}
            Mando Reserva
            
          {% elif is_state('sensor.ajax_usuario_hub_a1', '502') %}
            Alberto Normal

          {% else %}
            Desconocido
          {% endif %}


#-------------------------------------------
  - trigger:
      - platform: event
        event_type: sia_event_5000_2222
        event_data:
          code: 'CG'          # Area Cerrada
          ri: '2'

      - platform: event
        event_type: sia_event_5000_2222
        event_data:
          code: 'OG'          # Area Cerrada
          ri: '2'

    sensor:
      - name: "Ajax USUARIO HUB A2"
        unique_id: ajax.usuario.a2
        state: "{{trigger.event.data.message}}"
        icon: mdi:account

  - sensor:
      - name: "USUARIO A2"
        icon: mdi:account
        state: >
          {% if is_state('sensor.ajax_usuario_hub_a2', '501') %}
            Alberto Pro
            
          {% elif is_state('sensor.ajax_usuario_hub_a2', '8') %}
            Mando Reserva
            
          {% elif is_state('sensor.ajax_usuario_hub_a2', '502') %}
            Alberto Normal

          {% else %}
            Desconocido
          {% endif %}

        
#-------------------------------------------
  - trigger:
      - platform: event
        event_type: sia_event_5000_2222
        event_data:
          code: 'CG'          # Area Cerrada
          ri: '3'

      - platform: event
        event_type: sia_event_5000_2222
        event_data:
          code: 'OG'          # Area Cerrada
          ri: '3'

    sensor:
      - name: "Ajax USUARIO HUB A3"
        state: "{{trigger.event.data.message}}"
        icon: mdi:account

  - sensor:
      - name: "USUARIO A3"
        icon: mdi:account
        state: >
          {% if is_state('sensor.ajax_usuario_hub_a3', '501') %}
            Alberto Pro
            
          {% elif is_state('sensor.ajax_usuario_hub_a3', '8') %}
            Mando Reserva
            
          {% elif is_state('sensor.ajax_usuario_hub_a3', '502') %}
            Alberto Normal

          {% else %}
            Desconocido
          {% endif %}


#### HUB ARMADO Area 1

  - trigger:
  
    - id: 'armada'
      platform: event
      event_type: sia_event_5000_2222
      event_data:
        code: 'CG'          # Area armada
        ri: '1'
        
    - id: 'desarmada'
      platform: event
      event_type: sia_event_5000_2222
      event_data:
        code: 'OG'          # Area desarmada
        ri: '1'

    binary_sensor:
    - name: Armada A1 Exterior
      state: "{{ trigger.id == 'armada' }}"
      icon: mdi:shield-home


#### HUB ARMADO Area 2

  - trigger:
  
    - id: 'armada'
      platform: event
      event_type: sia_event_5000_2222
      event_data:
        code: 'CG'          # Armada Area
        ri: '2'

    - id: 'desarmada'
      platform: event
      event_type: sia_event_5000_2222
      event_data:
        code: 'OG'          # Desarmada Area
        ri: '2'

    binary_sensor:
    - name: Armada A2 Interior
      state: "{{ trigger.id == 'armada' }}"
      icon: mdi:shield-home
      
#### HUB ARMADO Area 3

  - trigger:
  
    - id: 'armada'
      platform: event
      event_type: sia_event_5000_2222
      event_data:
        code: 'CG'          # Armada Area
        ri: '3'

    - id: 'desarmada'
      platform: event
      event_type: sia_event_5000_2222
      event_data:
        code: 'OG'          # Desarmada Area
        ri: '3'

    binary_sensor:
    - name: Armada A3 Trastero
      state: "{{ trigger.id == 'armada' }}"
      icon: mdi:shield-home

#### HUB ARMADO Areas Noche

  - trigger:
      - platform: event
        event_type: sia_event_5000_2222
        event_data:
          code: "NL" # Armado Areas noche

      - platform: event
        event_type: sia_event_5000_2222
        event_data:
          code: 'NP' # Desarmada Areas noche

    binary_sensor:
      - name: Armado Modo Noche
        unique_id: ajax.modo.noche
        state: "{{ trigger.event.data.code == 'NL' }}"
        icon: mdi:shield-moon

#### HUB ESTADO AREA 1

  - sensor:
      - name: "A1 Exterior"
        unique_id: ajax.estado.area1
        icon: mdi:pool
        state: >
          {% if is_state('binary_sensor.armado_modo_noche', 'on') %}
            Armado modo Noche por {{ states('sensor.usuario_a1') }}
            
          {% elif state_attr('binary_sensor.armado_modo_noche', 'off') %}
            Desarmada por {{ states('sensor.usuario_a1') }}
            
          {% elif is_state('binary_sensor.armada_a1_exterior', 'on') %}
            Armada A1 por {{ states('sensor.usuario_a1') }}
            
          {% elif is_state('binary_sensor.armada_a1_exterior', 'off') %}
            Desarmada A1 por {{ states('sensor.usuario_a1') }}
            
          {% else %}
            Desconocido
          {% endif %}

#### HUB ESTADO AREA 2

  - sensor:
      - name: "A2 Interior"
        unique_id: ajax.estado.area2
        icon: mdi:home-circle-outline
        state: >
          {% if is_state('binary_sensor.armado_modo_noche', 'on') %}
            Armado modo Noche por {{ states('sensor.usuario_a2') }}
            
          {% elif state_attr('binary_sensor.armado_modo_noche', 'off') %}
            Desarmada por {{ states('sensor.usuario_a2') }}
            
          {% elif is_state('binary_sensor.armada_a2_interior', 'on') %}
            Armada por {{ states('sensor.usuario_a2') }}
            
          {% elif is_state('binary_sensor.armada_a2_interior', 'off') %}
            Desarmada por {{ states('sensor.usuario_a2') }}
            
          {% else %}
            Desconocido
          {% endif %}

#### HUB ESTADO AREA 3

  - sensor:
      - name: "A3 Trasero"
        unique_id: ajax.estado.area3
        icon: mdi:home-circle-outline
        state: >
          {% if is_state('binary_sensor.armado_modo_noche', 'on') %}
            Armado modo Noche por {{ states('sensor.usuario_a3') }}
            
          {% elif state_attr('binary_sensor.armado_modo_noche', 'off') %}
            Desarmada por {{ states('sensor.usuario_a3') }}
            
          {% elif is_state('binary_sensor.armada_a3_trastero', 'on') %}
            Armada por {{ states('sensor.usuario_a3') }}
            
          {% elif is_state('binary_sensor.armada_a3_trastero', 'off') %}
            Desarmada por {{ states('sensor.usuario_a3') }}
            
          {% else %}
            Desconocido
          {% endif %}


##---------ZONA: 1  --------------------------- (MULTITRANSMITER TAMPER)

  - trigger:
      - platform: event
        event_type: sia_event_5000_2222 # puerto y abonado
        event_data:
          code: 'TA'  # Tamper abierto
          message: '1' # Numero de dispositivo
          
      - platform: event
        event_type: sia_event_5000_2222
        event_data:
          code: 'TR' # Tamper Cerrado
          message: '1' # Numero de dispositivo
          
    binary_sensor:
      - name: Multitransmiter TAMPER (Z1)
        device_class: safety
        state: "{{ trigger.event.data.code == 'TA' }}"

##---------ZONA: 1  --------------------------- (MULTITRANSMITER FALLO 220V)

  - trigger:
      - platform: event
        event_type: sia_event_5000_2222 # puerto y abonado
        event_data:
          code: 'AT'  # 220 fallo
          message: '1' # Numero de dispositivo
          
      - platform: event
        event_type: sia_event_5000_2222
        event_data:
          code: 'AR' # 220 restauracion
          message: '1' # Numero de dispositivo
          
    binary_sensor:
      - name: Multitransmiter FALLO 220V (Z1)
        device_class: power
        state: "{{ trigger.event.data.code == 'AT' }}"


##---------ZONA: 2  --------------------------- (BOCA 1)

  - trigger:
  
    - id: 'on'
      platform: event
      event_type: sia_event_5000_2222
      event_data:
        code: 'BA'          # ALARMA zona
        message: '2'        # Numero de dispositivo
        
    - id: 'off'
      platform: event
      event_type: sia_event_5000_2222
      event_data:
        code: 'BR'          # RESTAURACION zona
        message: '2'        # Numero de dispositivo
        
    - platform: homeassistant
      event: start
      id: 'off'
    - platform: event
      event_type: event_template_reloaded
      id: 'off'
      
    binary_sensor:
    - name: Z1 (ZX2)
      device_class: motion
      state: "{{ trigger.id == 'on' }}"
      auto_off: 10

##---------ZONA: 3  --------------------------- (BOCA 2)


  - trigger:
  
    - id: 'on'
      platform: event
      event_type: sia_event_5000_2222
      event_data:
        code: 'BA'          # ALARMA zona
        message: '3'        # Numero de dispositivo
        
    - id: 'off'
      platform: event
      event_type: sia_event_5000_2222
      event_data:
        code: 'BR'          # RESTAURACION zona
        message: '3'        # Numero de dispositivo
        
    - platform: homeassistant
      event: start
      id: 'off'
    - platform: event
      event_type: event_template_reloaded
      id: 'off'
      
    binary_sensor:
    - name: Z2 (ZX3)
      device_class: motion
      state: "{{ trigger.id == 'on' }}"
      auto_off: 10

##---------ZONA: 4  --------------------------- (BOCA 3)

  - trigger:
  
    - id: 'on'
      platform: event
      event_type: sia_event_5000_2222
      event_data:
        code: 'BA'          # ALARMA zona
        message: '4'        # Numero de dispositivo
        
    - id: 'off'
      platform: event
      event_type: sia_event_5000_2222
      event_data:
        code: 'BR'          # RESTAURACION zona
        message: '4'        # Numero de dispositivo
        
    - platform: homeassistant
      event: start
      id: 'off'
    - platform: event
      event_type: event_template_reloaded
      id: 'off'
      
    binary_sensor:
    - name: Z3 (ZX4)
      device_class: motion
      state: "{{ trigger.id == 'on' }}"
      auto_off: 10

##---------ZONA: 5  --------------------------- (BOCA 4)

  - trigger:
  
    - id: 'on'
      platform: event
      event_type: sia_event_5000_2222
      event_data:
        code: 'BA'          # ALARMA zona
        message: '5'        # Numero de dispositivo
        
    - id: 'off'
      platform: event
      event_type: sia_event_5000_2222
      event_data:
        code: 'BR'          # RESTAURACION zona
        message: '5'        # Numero de dispositivo
        
    - platform: homeassistant
      event: start
      id: 'off'
    - platform: event
      event_type: event_template_reloaded
      id: 'off'
      
    binary_sensor:
    - name: Z4 (ZX5)
      device_class: motion
      state: "{{ trigger.id == 'on' }}"
      auto_off: 10
      
##----- Alarma disparada ----
      
  - trigger:
  
    - id: 'on'
      platform: event
      event_type: sia_event_5000_2222
      event_data:
        code: 'BA'          # ALARMA zona

    - id: 'off'
      platform: event
      event_type: sia_event_5000_2222
      event_data:
        code: 'OG'          # Area desactivada

    binary_sensor:
    - name: "Alarma disparada"
      icon: mdi:alarm-panel
      state: "{{ trigger.id == 'on' }}"
      auto_off: 10

It was due to a setting in my router (blocked port). I changed the port and it solved my issue!

Maybe this post could help you? see above Feb 23, 9:17am

Tried a bunch of ports, no luck at all :frowning:

So a couple of very basic questions:

Should I be seeing the port I set in the integration config now be open on my HA box (it’s not)?

How do I get the device ID? Is it displayed on the Ajax hub itself or do I just make ones up hub side and ensure it matches in the integration config?

Cheers!