Home Assistant integration - ParadoxAlarmInterface/pai GitHub Wiki

We support Home Assistant with MQTT autodiscovery. Support was added in 1.1.0

Requirements

MQTT Broker

Options:

You need to create a username+password pair for PAI that you will use in PAI configuration.

Paradox Alarm Interface (PAI) add-on configuration:

Enable the required module in the add-on configuration tab and all the other parameters.

MQTT_HOMEASSISTANT_AUTODISCOVERY_ENABLE: true

Home Assistant configuration

If using Home Assistant's default mqtt broker there is no need to modify configuration.yaml

Note that after setting MQTT_HOMEASSISTANT_AUTODISCOVERY_ENABLE: true, Home Assistant will now auto-discover all zones, partitions and PGMs automatically. No additional settings are required for configruation.yaml.

Restart Home Assistant.

Goto Configuration -> Integrations -> You should see a device with your panel model (EVO192, MG5050, ...).

Add more properties to zones or partitions

You can publish more states for partitions and zones (states listed here) by setting HOMEASSISTANT_PUBLISH_PARTITION_PROPERTIES and HOMEASSISTANT_PUBLISH_ZONE_PROPERTIES. For example:

HOMEASSISTANT_PUBLISH_PARTITION_PROPERTIES = [
    'target_state',
    'current_state',
    'entry_delay',
    'exit_delay',
]
HOMEASSISTANT_PUBLISH_ZONE_PROPERTIES = [
    'open',
    'tamper',
    'bypassed'
]

Make Home Assistant to ask for a code to arm/disarm (dev branch)

If you want to enter a code to arm or disarm the alarm in Home Assistant or HassKit.

  1. Set MQTT_HOMEASSISTANT_CODE to the code you want (should be characters and at least 1 digit)
  2. Configuration -> Customizations has been deprecated and you must add this config manually in your configuration.yaml for each alarm partition
homeassistant:
  customize:
    alarm_control_panel.partition_area_1: ## The name of your alarm partition(s)
      code_disarm_required: true
      code_arm_required: false
  1. Restart Home Assistant to reload this config
  2. Now you need to enter the code to disarm and arm.

Lovelace

If you want more or less arming states than default arm_home and arm_away take a look at the manual.

Remove unused zones, partitions, users or PGMs

You can limit (filter) the zones, partitions, users or PGMs that are exposed to Home Assistant as it can become cluttered. To do so you hvave to use the LIMITS option in your configuration:

  1. Stop the PAI add-on
  2. Open PAI add-on configuration and configure your zone limits (only listed items will be exposed):
LIMITS:
  user: '1-3'
  pgm: '3'
  door: ''
  module: ''
  repeater: ''
  partition: '1,2,3-4'
  1. Download MQTT Explorer or similar and remove the following topics:
  • all topics under homeassistant/alarm_control_panel/<panel_serial_number>
  • all topics under homeassistant/binary_sensor/<panel_serial_number>
  • any other unnecessary topics form switch or sensor
  1. Restart PAI add-on to populate homeassistant/alarm_control_panel again.
  2. Restart Home Assistant to reset discovered results (this might be unnecessary).

Custom notifications and automations

PAI supports several methods to deliver instant messages. However, if you are interested in using Home Assistant to deliver custom messages, or to trigger other automations based on any event, you may use the raw event feed.

The following automation, provided by @rjcds, sends a custom message through pushover with the name of the user that armed/disarmed the panel. This is a great way of sending messages in your own language. Feel free to change the service to notify.notify instead of notify.pushover.

- alias: ArmedBy
  trigger:
    platform: mqtt
    topic: 'paradox/events/raw'
  condition:
    condition: template
    value_template: >
      {{ trigger.payload_json['change']['arm'] == True or
         trigger.payload_json['change']['arm'] == False }}
  action:
    service: notify.pushover
    data:
      message: >
        {% if 'master' in trigger.payload_json['message'] and trigger.payload_json['change']['arm'] == True -%}
            House armed by {{ trigger.payload_json['message'][17:-12] }}
        {%- elif 'master' in trigger.payload_json['message'] and trigger.payload_json['change']['arm'] == False -%}
            House disarmed by {{ trigger.payload_json['message'][19:-12] }}
        {%- elif trigger.payload_json['change']['arm'] == True -%}
            House armed by {{ trigger.payload_json['message'][17:-5] }}
        {%- else -%}
            House disarmed by {{ trigger.payload_json['message'][19:-5] }}
        {%- endif %}

The raw messages being parsed are:

Arming XXXX with YYYY master code
Unarming XXXX with YYYY master code
Arming XXXX with ZZZZ code
Unarming XXXX with ZZZZ code

You will need to adjust the string slicing if your partition name is not 4 characters long (eg Home)

Similarly, the following automation will notify critical events as both homeassistant notifications and persistent notifications, for instance zones being tampered or power trouble.

- alias: AlarmCritical
  trigger:
    platform: mqtt
    topic: 'paradox/events/raw'
  condition:
    condition: template
    value_template: >
      {{ trigger.payload_json['level'] == 'CRITICAL' }}
  action:
    - service: persistent_notification.create
      data:
        title: >
          {{ trigger.payload_json['label'] }} {{ trigger.payload_json['message'] }}
        message: >
          {{ trigger.payload_json['label'] }} {{ trigger.payload_json['message'] }} {{ trigger.payload_json['key'] }}
    - service: notify.notify
      data:
        title: >
          {{ trigger.payload_json['label'] }} {{ trigger.payload_json['message'] }}
        message: >
          {{ trigger.payload_json['label'] }} {{ trigger.payload_json['message'] }} {{ trigger.payload_json['key'] }}  

@camsaway has implemented this automation in HASS for sending an alert when the alarm is triggered. This uses a persistant notification within HASS but you can also use it with any notify service such as push to mobile client, email, etc You will need to replace the entity_id of your alarm panel device in the appropriate place.

alias: Alarm Triggered
description: ""
trigger:
  - platform: state
    entity_id:
      - alarm_control_panel.partition_area_1
    to: triggered
condition: []
action:
  - service: notify.persistent_notification
    data:
      title: |
        'Alarm Triggered'
      message: >
        The following zones are triggered: {{- '\n' -}} {% for state in states
        if state.entity_id in
        device_entities('85c3e68cb1afa155df178f17f8215efa') and state.domain ==
        'binary_sensor' and state.state == 'on' -%}
          * {{ state.entity_id|replace('binary_sensor.zone_','') }} sensor is {{ state.state }}
        {% endfor %}
mode: single