Open FigJam23 opened 1 year ago
@FigJam23 are you by any chance using the home assistant integration? I have done this via an automation in Home Assistant.
Adding it below if anyone is interested.
Create an input text helper: input_text.last_zone_in_alarm
alias: Paradox Zone In Alarm
description: ""
trigger:
- platform: mqtt
topic: paradox/states/zones/+/generated_alarm
payload: "True"
condition: []
action:
- service: input_text.set_value
data:
value: >-
Zone: {{ trigger.topic | regex_replace(find='paradox/states/zones/',
replace='', ignorecase=True) | regex_replace(find='/.*', replace='',
ignorecase=True)| regex_replace(find='_', replace=' ', ignorecase=True)
| lower}}
target:
entity_id: input_text.last_zone_in_alarm
- delay:
hours: 0
minutes: 0
seconds: 2
milliseconds: 0
- service: notify.notify
data:
title: Alarm
message: The alarm went of in {{ states('input_text.last_zone_in_alarm') }}
mode: single
Note: the regex replaces can be simplified by a split on '/' and then selecting the index but leaving it as is for now. I am currently testing the paradox/states/zones/+/presently_in_alarm
and paradox/states/zones/+/generated_alarm
topics to see which works the best.
@FigJam23 are you by any chance using the home assistant integration? I have done this via an automation in Home Assistant.
Adding it below if anyone is interested.
Create an input text helper:
input_text.last_zone_in_alarm
alias: Paradox Zone In Alarm description: "" trigger: - platform: mqtt topic: paradox/states/zones/+/generated_alarm payload: "True" condition: [] action: - service: input_text.set_value data: value: >- Zone: {{ trigger.topic | regex_replace(find='paradox/states/zones/', replace='', ignorecase=True) | regex_replace(find='/.*', replace='', ignorecase=True)| regex_replace(find='_', replace=' ', ignorecase=True) | lower}} target: entity_id: input_text.last_zone_in_alarm - delay: hours: 0 minutes: 0 seconds: 2 milliseconds: 0 - service: notify.notify data: title: Alarm message: The alarm went of in {{ states('input_text.last_zone_in_alarm') }} mode: single
Note: the regex replaces can be simplified by a split on '/' and then selecting the index but leaving it as is for now. I am currently testing the
paradox/states/zones/+/presently_in_alarm
andparadox/states/zones/+/generated_alarm
topics to see which works the best.
This looks amazing thanks definitely be cool to play with, Do you know what happened in a multiple activation even. So if the alarms on and triggered this will report the first zone that alarms. What if a second zone goes off shortly after. I would love to see if this info can be grabbed out of the Pai log file when active. I'm not sure if my log level needs to be lower or not to get the template data from. What's the best log level setting for raw data
It's a pleasure, from my understanding with regards to multiple zones is that the automation above will send a notification for each zone, I have yet to tests this though. To view the zones triggered you can add the entity last_zone_in_alarm
to a dashboard and view it's history on home assistant and it will show the different zones triggered at which times.
When it comes to setting up these templates I mostly use mqtt explorer and view the topics and the values sent to these and not the actual Pai logs. I then make use of the mqtt template to configure them as required.
Example of browsing the systems/troubles topic:
You could also as an example do graphs on the system voltages, by looking at the topics under paradox/states/system/power/
Dosn't work for me this way. I got this the easiest way. When partition, trigered and Zone true, do notifcication.
I am struggling to understand this.
I already have an automation that notifies me what partition was triggered. I just want to add the zone that triggered.
Your code given confuses me. I try create a text helper and it doesnt give me an option to paste yaml instead of the visual builder. The regex part you mentioned also confuses the life out of me.
Please help?
Can i not just add a line of yaml in my existing automation under the 'data' section that can just give me the zone name?
Thank you
Try something like this might work just adjust yours to suit
trigger:
platform: state
entity_id:
- binary_sensor.dakotas_door
- binary_sensor.laundryhall_pir
- binary_sensor.driveway_beem
- binary_sensor.ellies_door
- binary_sensor.front_door_rs
- binary_sensor.kitchen_entrance
- binary_sensor.laundry_door
- binary_sensor.lincolns_door
- binary_sensor.living_pir
- binary_sensor.lounge_pir
- binary_sensor.office
- binary_sensor.office_door
- binary_sensor.dakotas_pir
- binary_sensor.lincolns_pir
- binary_sensor.master_bed_pir
- binary_sensor.upstairshall_pir
to: 'on'
condition:
- condition: state
entity_id: alarm_control_panel.intruder_alarm
state: 'triggered'
action:
- service: notify.all_mikes
data_template:
message: >
{% set timestamp = now().strftime('%Y-%m-%d %H:%M:%S') %}
{% set friendly_names = {
"binary_sensor.dakotas_door": "Dakota's door",
"binary_sensor.ellies_door": "Ellie's door",
"binary_sensor.front_door_rs": "Front door",
"binary_sensor.kitchen_entrance": "Kitchen door",
"binary_sensor.laundry_door": "Laundry room door",
"binary_sensor.lincolns_door": "Lincoln's door",
"binary_sensor.office_door": "Office door",
"binary_sensor.driveway_beem": "Driveway",
"binary_sensor.living_pir": "Living room",
"binary_sensor.lounge_pir": "Lounge",
"binary_sensor.laundryhall_pir": "Laundry hall",
"binary_sensor.office": "Office",
"binary_sensor.dakotas_pir": "Dakota's PIR",
"binary_sensor.lincolns_pir": "Lincoln's PIR",
"binary_sensor.master_bed_pir": "Master bedroom PIR",
"binary_sensor.upstairshall_pir": "Upstairs hallway PIR"
} %}
{% if trigger.entity_id in friendly_names %}
{% if 'door' in friendly_names[trigger.entity_id] %}
Warning! {{ friendly_names[trigger.entity_id] }} has been opened at {{ timestamp }}.
{% else %}
Warning! Motion detected on {{ friendly_names[trigger.entity_id] }} at {{ timestamp }}.
{% endif %}
{% else %}
Warning! Motion detected on {{ trigger.entity_id | replace("binary_sensor.", "") }} at {{ timestamp }}.
{% endif %}
data:
icon: "mdi:alarm"
# Set the priority to critical
priority: "critical"
Is there a easy way to get the triggered by what Zones when armed. I get armed disarmed triggered via the Pai alarm Panel but it would be nice if the alarm panel integration could show what Zone or zones have been triggered while armed and push them to notify mobile app