Logic Machine Forum
Monitoring Ness/ELK Alarm Zone Status - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8)
+--- Thread: Monitoring Ness/ELK Alarm Zone Status (/showthread.php?tid=2467)



Monitoring Ness/ELK Alarm Zone Status - jamesng - 12.02.2020

Hi

We run a Ness (aka ELK) DX16X alarm here which as an IP connection.  The status reporting and control protocol is documented at the following link

http://www.nesscorporation.com/Software/Ness_D8-D16_ASCII_protocol.pdf


I can find integrations using this protocol for other platforms such as the following https://nessclient.readthedocs.io/en/latest/examples.html  and https://community.home-assistant.io/t/ness-dx8-dx16-alarm/23285/163 but nothing for LogicMachine as yet.


I've started writing a script to connect the the system and can receive data ok, but need some help with getting the specific info and processing the responses in LUA.

Code:
socket = require("socket").tcp()
  socket:connect('192.168.1.150', 2401)
  socket:send(command .. '\n')
  res = socket:receive('*l')
  log('\nNESSCommand: ' .. command .. '\nNESSResponse : ' .. res)



Initially I'm interested in mapping the state of each zone back to objects in Logic Machine (after sending a status update command) from a resident script but haven't been able to figure out the protocol as yet.

Does anyone have a script that can do this?   Initially the is the info that I'm keen to track


0/210/1  Sealed/Unsealed state of Zone 1
0/210/2  Sealed/Unsealed state of Zone 2
0/210/3  Sealed/Unsealed state of Zone 3
0/210/4  Sealed/Unsealed state of Zone 4
0/210/5  Sealed/Unsealed state of Zone 5
0/210/6  Sealed/Unsealed state of Zone 6
0/210/7  Sealed/Unsealed state of Zone 7
0/210/8  Sealed/Unsealed state of Zone 8
0/210/9  Sealed/Unsealed state of Zone 9
0/210/10  Sealed/Unsealed state of Zone 10
0/210/11  Sealed/Unsealed state of Zone 11
0/210/12  Sealed/Unsealed state of Zone 12
0/210/13  Sealed/Unsealed state of Zone 13
0/210/14  Sealed/Unsealed state of Zone 14
0/210/15  Sealed/Unsealed state of Zone 15
0/210/16  Sealed/Unsealed state of Zone 26

and also the overall state of the alarm

0/210/20  All Zones Ok - true/false
0/210/30  Armed State - Disarmed (0), Fully armed (1), Partially armed (2)
0/210/40  Alarm Sounding - true/false

Many thanks in advance

Kind Regards
James


RE: Monitoring Ness/ELK Alarm Zone Status - admin - 14.02.2020

The protocol is rather simple, here's a starter example that you can use to decode data further:
Code:
res = socket:receive('*l')
if res then
  data = lmcore.hextostr(res, true)
  st, addr, len, cmd, event, id, area = data:byte(1, 7)
  log(st, addr, len, cmd, event, id, area)
end

Note that the logged event number will be in decimal whereas it is written in hexadecimal in the protocol description.


RE: Monitoring Ness/ELK Alarm Zone Status - jamesng - 15.02.2020

Many thanks for the starter example. I'm still struggling a bit.

Here's an example of the data I'm receiving with the above after connecting to the alarm panel

* arg: 1
* number: 135
* arg: 2
* number: 0
* arg: 3
* number: 131
* arg: 4
* number: 97
* arg: 5
* number: 1
* arg: 6
* number: 7
* arg: 7
* number: 0

Am I correct in my interpretation that this would map to a sensor in zone / 1D 7 being triggered (event id = 1)?


Also how would I formulate an input command to retrieve the status of all 16 zones to update the group addresses in LM?

Many thanks in advance

Kind Regards
James