Implementing SIA protocol

Use this forum to discuss possible implementation of a new feature before opening a ticket.
A developer shall edit the topic title with "[xxx]" where xxx is the id of the accompanying tracker id.
Duplicate posts about the same id. +1 posts are not allowed.

Moderators: leecollings, remb0

Post Reply
Number8
Posts: 374
Joined: Friday 23 May 2014 7:55
Target OS: Linux
Domoticz version: 2022.1
Location: Saint Pierre de Jards
Contact:

Implementing SIA protocol

Post by Number8 »

Hello
SIA protocol seems to be widely used in the alarm business. I run an Ajax alarm system on my premises. I'd like to get the report of any alarm event whevever they are triggered. After some search, I found this implementation for Home assistant https://github.com/eavanvalkenburg/sia and I found all the protocol codes here https://docs.google.com/spreadsheets/d/ ... 2144546461
To start with, I tried to use a TCP client to connect to the Hub without success so far. I may need some help to achieve this basic task. Does anyone having a clue on how to do that?
What would be then the path to implement it in Domoticz? Develop a Python plugin?
Thank you
Debian buster on NUC and three RPi with buster.
User avatar
waltervl
Posts: 5148
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Implementing SIA protocol

Post by waltervl »

There is a Jablotron SIA Alarm Python plugin https://github.com/andyboeh/domoticz-jablotron

Perhaps this can be used? Or copy and modify to your needs?
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
User avatar
FireWizard
Posts: 1745
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Implementing SIA protocol

Post by FireWizard »

Hi,

Complete documentation, you can find at: https://www.securityindustry.org/wp-con ... 201027.pdf

Also Home Assistant has something implemented.

https://github.com/Cheaterdev/sia-ha. This has been used with Ajax Security Hub

See also: https://community.home-assistant.io/t/n ... stem/89030

Regards
Number8
Posts: 374
Joined: Friday 23 May 2014 7:55
Target OS: Linux
Domoticz version: 2022.1
Location: Saint Pierre de Jards
Contact:

Re: Implementing SIA protocol

Post by Number8 »

Thanks to all for the inputs
Debian buster on NUC and three RPi with buster.
User avatar
oeildefeu
Posts: 8
Joined: Saturday 28 December 2013 15:21
Target OS: Raspberry Pi / ODroid
Domoticz version: 2023.2
Location: France
Contact:

Re: Implementing SIA protocol

Post by oeildefeu »

Hello,
I did a small script that runs as a service on my Pi that recover the state of the alarm (armed, normal or night mode) but it could recover many other states
It requires pysiaalarm and python3-systemd (this latter being installed by apt) as packages and some I forgot (requests?)..

Here is the code:

Code: Select all

#! /usr/bin/env python3.9
import json
import requests
#import logging
import time

from pysiaalarm import SIAAccount, SIAClient, SIAEvent
import systemd.daemon

#logging.basicConfig(level=logging.DEBUG)

local_ip = "192.168.0.1"
sia_port = 8125
sia_account = "AAAA"
url_domoticz = "http://192.168.0.1:80/"
id_armed_night = "11" #night mode alarm switch id
id_armed_normal = "21" #alarm switch id
id_text = "35" #text device to recover non recognized code

reactions = {
	"BA" : [{"state":"ALARM","value":True}],
	"BS" : [{"state":"ALARM","value":True}],#device shorted
	"BV" : [{"state":"ALARM","value":True}],#intrusion
	"HA" : [{"state":"ALARM","value":True}],#hold-up
	"JA" : [{"state":"ALARM","value":True}],#Unauthorized access keypad
	"PA" : [{"state":"ALARM","value":True}],
	"SM" : [{"state":"ALARM","value":True}], #Alarm because of movement
	"YC" : [{"state":"ALARM","value":True}],#hub offline mobile and ethernet
	"NL" : [{"state":"ARM NIGHT" ,"value":True}],
	"NC" : [{"state":"ARM NIGHT" ,"value":True}],
	"OP" : [{"state":"ARM","value":False}],
	"CF" : [{"state":"ARM","value":True}], #armed with malfunction
	"CL" : [{"state":"ARM","value":True}],
	"OA" : [{"state":"ARM","value":False}],
	"FA":  [{"state":"FIRE" ,"value":True}],
	"KA":  [{"state":"FIRE" ,"value":True}],#temperature of fire sensor
	"WA":  [{"state":"LEAK","value":True}],
	"WH":  [{"state":"LEAK" ,"value":False}],
	"GA":  [{"state":"GAS","value":True}],
	"GH":  [{"state":"GAS" ,"value":False}],
	"BR" : [{"state":"ALARM","value":False}],
	"TA" : [{"state":"LID OPEN","value":True}],
	"TR" : [{"state":"LID OPEN","value":False}],
	"ZZ" : [{"state":"Device OFF","value":True}],
	"ZY" : [{"state":"Device OFF","value":False}],
	"YP" : [{"state":"Power failure","value":True}],
	"YQ" : [{"state":"Power failure","value":False}],
	"RB" : [{"state":"Updating firmware","value":True}],
	"RS" : [{"state":"Updating firmware","value":False}],
	"RP" : [],
	"YG" : [] #New settings
	}

def func(event: SIAEvent):
	#print(event.code)
	tipo = event.code
	if tipo in reactions:
		reaction = reactions[tipo]
		for reactio in reaction:
			state = reactio["state"]
			value = reactio["value"]
			print("Event: " + state + " : " + str(value))
			if state == "ARM" and value == False:
				r = requests.get(url_domoticz + 'json.htm?type=command&param=switchlight&idx=' + id_armed_normal + '&switchcmd=Off')
				r = requests.get(url_domoticz + 'json.htm?type=command&param=switchlight&idx=' + id_armed_night + '&switchcmd=Off')
			elif state == "ARM" and value == True:
				r = requests.get(url_domoticz + 'json.htm?type=command&param=switchlight&idx=' + id_armed_normal + '&switchcmd=On')
			elif state == "ARM NIGHT" and value == True:
				r = requests.get(url_domoticz + 'json.htm?type=command&param=switchlight&idx=' + id_armed_night + '&switchcmd=On')
	else:
		print("Unknown event: " + tipo )
		r = requests.get(url_domoticz + 'json.htm?type=command&param=udevice&idx=' + id_text + '&nvalue=0&svalue='+tipo)


account = [SIAAccount(sia_account, "")]
sleep_time = 1200
count = 0
#systemd.daemon.notify('READY=1')
with SIAClient(local_ip, sia_port, account, function=func) as client:
	#time.sleep(sleep_time)
	client.start()
	systemd.daemon.notify('WATCHDOG=1')
	while (True) :
		time.sleep(1)
		count = count + 1
		if count == 30:
			count = 0
			systemd.daemon.notify('WATCHDOG=1')
Raspberry Pi 3 - Raspbian + Razberry (OpenZwave) + RFXtrx433
Number8
Posts: 374
Joined: Friday 23 May 2014 7:55
Target OS: Linux
Domoticz version: 2022.1
Location: Saint Pierre de Jards
Contact:

Re: Implementing SIA protocol

Post by Number8 »

@ oeildefeu. Thank you for your input. Much appreciated. It turns out that I set up an HA instance and made both systems communicating thanks to MQTT which turns to be very efficient. Based on that, I took some time to discover HA which turns to be far superior to Domoticz, at least as far as GUI is concerned. It is really night and day. So I decided to keep Domoticz as my backbone which is quite easy to master (thanks among other things to dzVents), it would be to much time consuming to migrate everything than developing a brand new interface using HA and MQTT.
Debian buster on NUC and three RPi with buster.
anwar
Posts: 1
Joined: Monday 22 April 2024 8:54
Target OS: Windows
Domoticz version:
Contact:

Re: Implementing SIA protocol

Post by anwar »

Can any one help me to setup acknowledge message to client from the server using SIA Protocol
User avatar
FireWizard
Posts: 1745
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Implementing SIA protocol

Post by FireWizard »

Hi @anwar,

Have a look at Node RED.

See: https://flows.nodered.org/node/node-red ... a5g6xfUKhS

OR

https://flows.nodered.org/node/node-red-contrib-sia

Don't use both nodes, but only one of them. I would suggest the first one.

With Node-RED you can can simply push the required data to Domoticz by MQTT.

Regards
CronoS
Posts: 135
Joined: Wednesday 15 July 2015 23:40
Target OS: -
Domoticz version:
Contact:

Re: Implementing SIA protocol

Post by CronoS »

FireWizard wrote: Monday 22 April 2024 13:57 Hi @anwar,

Have a look at Node RED.

See: https://flows.nodered.org/node/node-red ... a5g6xfUKhS

OR

https://flows.nodered.org/node/node-red-contrib-sia

Don't use both nodes, but only one of them. I would suggest the first one.

With Node-RED you can can simply push the required data to Domoticz by MQTT.

Regards
Can you do an export of your Node Red Configuration? Because I am not familiar enough with Node Red to setup this node? I want to buy the Ajax home security system, but I want to be able to connect it to Domoticz so that I can use it on other devices. Otherwise I order the Ayax Relay and connect it to a Shelly :)
User avatar
FireWizard
Posts: 1745
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Implementing SIA protocol

Post by FireWizard »

Hi @CronoS,

You asked:
Can you do an export of your Node Red Configuration?
My Node-RED configuration is the default configuration, as I got it, when installing Node-RED.
Because I am not familiar enough with Node Red to setup this node?
You can install it, on your device.
See: https://nodered.org/docs/getting-started/

Try to watch the videos: https://www.youtube.com/@Node-RED

Regards
CronoS
Posts: 135
Joined: Wednesday 15 July 2015 23:40
Target OS: -
Domoticz version:
Contact:

Re: Implementing SIA protocol

Post by CronoS »

I have got an Ajax Alarm system and I see that there is a HA plugin available... Did a quick test n HA and that seems to work. But I am looking for a way to integrate it with Domoticz using SIA. Is there anything available for my Ajax and Domoticz?.
User avatar
FireWizard
Posts: 1745
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Implementing SIA protocol

Post by FireWizard »

Hi,

Did you already look at my previous posts?
As far as I know, no plug in is available. I recommend to look at
the Node-RED solution.

Regards
CronoS
Posts: 135
Joined: Wednesday 15 July 2015 23:40
Target OS: -
Domoticz version:
Contact:

Re: Implementing SIA protocol

Post by CronoS »

Thanks.. I am looking into Node Red; I have imported this code... that seems to be OK..
But unfortunately I am not familiar with Node Red enought to know how to setup the last part, to connect it to Domoticz. Do you have a flow for that which I can use (maybe in relation with the Ajax?)

Thanks!
.
User avatar
FireWizard
Posts: 1745
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Implementing SIA protocol

Post by FireWizard »

Hi,

Can you send me your flow as far you have it created.
If you prefer a PM is okay

Send also a screenshot of the debug sidebar or better a copy of the debug sidebar

Regards
CronoS
Posts: 135
Joined: Wednesday 15 July 2015 23:40
Target OS: -
Domoticz version:
Contact:

Re: Implementing SIA protocol

Post by CronoS »

With the help of FireWizard we have created an Node Red flow for my Ajax Jeweller Home Security System by using the SIA protocol. It works OK. If someone is interested, please send me a PM...
DutchHans
Posts: 229
Joined: Friday 03 April 2015 20:44
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Germany (near dutch border)
Contact:

Re: Implementing SIA protocol

Post by DutchHans »

Hi, i am very interested in the implementation of the SIA protocol. Please keep me posted. The SIA protocol with all codes, not only the security codes

Regards, Hans Willem
User avatar
FireWizard
Posts: 1745
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Implementing SIA protocol

Post by FireWizard »

Hello @ DutchHans,

The SIA protocol, developed by the Security Industry Association, is a one way protocol. So a device, mostly an Alarm Receiving Center, listens to the Intrusion Alarm Panel. Although acknowledgments are returned to the Alarm Panel, the information flow is unidirectional.

So, it listens to events, send from the Alarm Panel and is not capable to return commands, such as arm, disarm, silence or reset the panel.

We used the contrib node in Node-RED: https://flows.nodered.org/node/node-red ... a-ultimate

This node support 280 different SIA codes. See: https://github.com/Supergiovane/node-re ... acodes.csv

For integration with other systems the following payload is available:

Code: Select all

"payload":{ // This contains the message decoded
      "deviceName": "PIR Bedroom", // The device name is taken from the list you filled in the server configuration node
      "deviceID": "4", // Device ID that fired the event
      "code":"RP",
      "description":"AUTOMATIC TEST"
   },
With this payload, you can filter the device and/or SIA code, in order to complete your flow and send data to Domoticz or control sounders or visual indicators.
Finally we selected the virtual "Alert" sensor as the device to indicate statuses in Domoticz, but in my opinion, you should also use a ("Text") device in Domoticz to indicate an error status.

So, sorry, there is not an easy flow, that you can copy/paste into your Node-RED instance and that works out of the box.

You should specify for yourself:
- How many detection zones do you have?
- How many "arm" statuses (arm_home, arm_away, arm_night, etc) do you want?
- What do you want to control (lights, led-indicators, sounders, doors, locks, etc)?
- The logic of the data (if this then that and delay's)

So there is a lot to consider and to make a specification.

We created some very simple flow and send the data to Domoticz by MQTT (and not MQTT AutoDetect)

@Cronos has been responsible for testing and creating the NR part after the SIA Input node.
So, he can probably support you with that part or I will be able to support you as well, if you have the specification ready.
And testing is also important. You have to do that, as I do not own an Intrusion Panel with SIA support.

Best regards
DutchHans
Posts: 229
Joined: Friday 03 April 2015 20:44
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Germany (near dutch border)
Contact:

Re: Implementing SIA protocol

Post by DutchHans »

Hi... I know a little about the SIA protocol and want to connect human alarms for elderly or disabled people to Domoticz.. so more ore less medical alarms. That is what I meant in my previous message. I am on vacation now and can't test anything but am very interested..

I will be back to you when I am home again...
Regards, Hans
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest