Open cdk222 opened 4 years ago
ARM:
{"additional_data": {}, "change": {}, "id": 5, "key": "user,USERNAME,", "label": "USERNAME", "label_type": null, "level": "INFO", "major": 29, "message": "Arming by user USERNAME", "minor": 5, "module": "0xe", "name": "USERNAME", "partition": 1, "tags": ["arm"], "timestamp": "2020-10-11T11:27:00", "type": "user"}
DISARM:
{"additional_data": {}, "change": {}, "id": 5, "key": "user,USERNAME,", "label": "USERNAME", "label_type": null, "level": "INFO", "major": 31, "message": "Disarming by user USERNAME", "minor": 5, "module": "0xe", "name": "USERNAME", "partition": 1, "tags": ["disarm"], "timestamp": "2020-10-11T11:27:00", "type": "user"}
However, because the events are not exposed as homeassistant entities, I'm not sure you can easily create a template sensor to extract these values. I would start with exposing the Sensor and then look at building the template.
I was able to capture the events using MQTT Explorer;
What are you editing in the config to get this ?
I've tried uncommenting MQTT_PUBLISH_RAW_EVENTS = True but I'm not seeing anything in MQTT Explorer in paradox/events/raw other than the panel time and date...
Yes. You should get events when zones open or when a partition is armed/disarmed
Yes. You should get events when zones open or when a partition is armed/disarmed
Just seeing panel date/time in paradox/events/raw
What needs to be enabled in the config to get all the other events ?
Can you increase the log level to DEBUG including packet and message dumps? Then activate some zones or arm/disarm the panel and see if there are events coming from the panel. If you prefer, send the log to my email.
Thanks @jpbarraca I've emailed you the log. There are a few errors relating to 'Could not create event from change'...
You can safely ignore that message as it is a bit misleading.
Regarding the log you sent, the normal set of messages is there, including messages such as the following. XXXXX is the partition and YYYYY the user. Some other fields are redacted.
If you wish to extract the user, you can parse the text in the message
field. Other fields present the partition directly.
{
"change":{
"arm":true
},
"id":1,
"key":"partition,XXXXX,arm=True",
"label":"XXXXX",
"label_type":"b'\\x01'",
"level":"INFO",
"major":9,
"message":"Arming XXXXX with YYYYYY master code",
"minor":1,
"minor2":0,
"name":"XXXXX",
"partition":1,
"tags":[
"arm"
],
"timestamp":"TIMESTAMP",
"type":"partition"
}
Thanks so much @jpbarraca
Here's the automation that's working for me so far:
(The exact string slicing required in ‘message’ will vary depending on what you have labeled your partition as. The example below works for a partition labeled ‘Home’)
- 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 trigger.payload_json['change']['arm'] == True -%}
House armed by {{ trigger.payload_json['message'][17:-12] }}
{%- else -%}
House disarmed by {{ trigger.payload_json['message'][19:-12] }}
{%- endif %}
Great! I may use that, and will add it to our wiki. PAI natively supports pushover, signal, pushbullet and sms but it's not possible to customize the type and text in the messages. This automation allows a great amount of flexibility.
PAI natively supports pushover, signal, pushbullet and sms but it's not possible to customize the type and text in the messages.
I must admit I glanced over these wiki pages many times and it really didn't register with me !
The native pushover integration works perfectly (I just set it up); yes the text is not customised, but it includes the username, which is the main thing for me.
I also assume (yet to try or have it triggered) it will send out a pushover emergency alert if the actual alarm is triggered (as per the wiki)
My wife accidentally set our alarm off today while I was away, and the Inside Gold app alert was quite good.
I'm hoping the pushover emergency alert will be similarly attention grabbing; just planning for Swan/Insite's eventual demise :)
Messages sent through pushover will have a priority that reflects the criticality of the event. When the alarm triggers you will receive an emergency notification, which you will need to manually acknowledge. The App will keep notifying (sound, vibration, etc...) you until you do it (see Emergency Priority at https://pushover.net/api#priority)
If I use the built in pushover integration, am i correct in thinking I can turn off MQTT_PUBLISH_RAW_EVENTS ?
Hi, I'm a bit noob and I'm trying to get the "user" information in Node-Red. Can you please detail a bit more how you did get the user parameter in PAI from a standard installation.
Thanks a lot.
Can you please detail a bit more how you did get the user parameter in PAI from a standard installation.
Increase the log level to DEBUG, including packet and message dumps And MQTT_PUBLISH_RAW_EVENTS = True
Then arm/disarm the panel a few times with different users
Then search the log for something like "arm":true
In message
field (from my testing at least), the if you have a partition with a name of Home
, master username of John
and a standard username of Spare
, the messages are:
Arming Home with John master code
Unarming Home with John master code
Arming Home with Spare code
Unarming Home with Spare code
You'll then need to parse those messages as per my example automation above
Hi, Thanks a lot for your explanations and sorry to reply so late.
I've managed to do what I needed based on your infos, but I since I needed to do it in node-red I did it differently. And It seams easier.
I didn't need to change the DEBUG level. I've added MQTT_PUBLISH_RAW_EVENTS = True And then in node-red, I'm catching the raw event, I parse it with a simple yaml parse and that give me the user info separated.
Thanks again for your help.
Hi Danch99
Are you able to share your node red flow?
Hi cdk222,
here it is:
[{"id":"73fab893.915d38","type":"mqtt in","z":"c1648d58.82ffd8","name":"","topic":"paradox/events/raw","qos":"2","datatype":"auto","broker":"a76cb2c2.58f2d","x":170,"y":660,"wires":[["24163ac1.fd8bd6"]]},{"id":"f59ff599.a76fb8","type":"debug","z":"c1648d58.82ffd8","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload.label","targetType":"msg","statusVal":"","statusType":"auto","x":770,"y":660,"wires":[]},{"id":"24163ac1.fd8bd6","type":"yaml","z":"c1648d58.82ffd8","property":"payload","name":"","x":370,"y":660,"wires":[["21a9cad3.2fcf56","f51ae841.e9f958"]]},{"id":"21a9cad3.2fcf56","type":"switch","z":"c1648d58.82ffd8","name":"","property":"payload.additional_data","propertyType":"msg","rules":[{"t":"nempty"},{"t":"empty"}],"checkall":"true","repair":false,"outputs":2,"x":550,"y":660,"wires":[["f59ff599.a76fb8"],[]]},{"id":"f51ae841.e9f958","type":"debug","z":"c1648d58.82ffd8","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":550,"y":720,"wires":[]},{"id":"a76cb2c2.58f2d","type":"mqtt-broker","name":"Home assistant MQTT broker","broker":"192.168.1.2","port":"1883","clientid":"","usetls":false,"compatmode":false,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthRetain":"false","birthPayload":"","closeTopic":"","closeQos":"0","closeRetain":"false","closePayload":"","willTopic":"","willQos":"0","willRetain":"false","willPayload":""}]
Legend - Thank you
Finally !!! 🥳 I got this From paradox keypad
Hi to all! Could 'Username for arm/disarm' be integrated into Homebridge mqttthing plugin, so I have notifications with names in Apple Home app? Can I get some help with this, please? I can define a custom 'topic' and 'message' strings directly inside mqtt plugin. Thanks in advance!
Finally !!! 🥳 I got this From paradox keypad
Could you share code of notification ?
hi guys, i don't really get where the MQTT_PUBLISH_RAW_EVENTS = True is. there is no option in the PAI configuration for that, or i must be blind
MG5050 HomeAssistant
Im not sure if this is possible given the sheer volume of events in the 'Events -- Raw' topic; however has anybody tried to isolate the events that deal with Arming and Disarming the system so that we can isolate the Username of the person who last Arm/Disarm with a timestamp.
I was able to capture the events using MQTT Explorer; however Im not sure how to isolate the information I need from those......or if even if it is possible within the Homeassistant Pai addon