Need help with ELK/NESS alarm status over serial

Hi all,

I’ve been looking for a binding for the ELK/NESS M1 home alarm and while I see some discussion on the topic I haven’t found anything working at this time, so I started work on my own solution using the Serial binding.

I’m working on a combination of items and rules along with the serial binding to read the state of my ELK/NESS M1 home alarm and I’d like to be able to mirror the state of my home alarm zone status in OpenHAB. I have the basics working, but I need help with a few things:

  1. SOLVED What is the best way to set up PIR sensors in OpenHAB? I’ve read about Contact item types but haven’t had much success so I’m using Switch items at the moment.
  2. I couldn’t solve the problem of having to define the item types multiple times in both the items file and the rules file. Any suggestions would be appreciated. I’ve tried defining a group and them getting the members of that group but couldn’t get that combination to work for me without throwing and error.
  3. SOLVEDThe sitemap icon doesn’t seem to update with the update of the item state. I’m not sure what is the best way to make this happen

My items file:

Switch AlarmUpdate "Alarm Update" { serial="/dev/ttyUSB0@115200" }
String AlarmMessage "Alarm Message" { serial="/dev/ttyUSB0@115200" }

Group gAlarm_PIR

Switch Alarm_PIR_Zone1                                  (gAlarm_PIR)
Switch Alarm_PIR_Zone2                                  (gAlarm_PIR)
Switch Alarm_PIR_FF_MasterBedroom "Master Bedroom"      (gAlarm_PIR)
Switch Alarm_PIR_Zone4                                  (gAlarm_PIR)
Switch Alarm_PIR_Nursery "Nursery"                      (gAlarm_PIR)
Switch Alarm_PIR_FF_Stairs "Up Stairs"                  (gAlarm_PIR)
Switch Alarm_PIR_GF_Lounge "Lounge"                     (gAlarm_PIR)
Switch Alarm_PIR_GF_Stairs "Down Stairs"                (gAlarm_PIR)

My rules file:

import java.lang.Integer.*

val AlarmMemoryMessage = "AM"
val ZoneChangedMessage = "ZC"
val NetworkAdapterPing = "XK"

val ZoneStatusTable_NormalUnconfigured = "0"
val ZoneStatusTable_NormalOpen = "1"
val ZoneStatusTable_NormalEOL = "2"
val ZoneStatusTable_NormalShort = "3"
val ZoneStatusTable_TroubleOpen = "5"
val ZoneStatusTable_TroubleEOL = "6"
val ZoneStatusTable_TroubleShort = "7"
val ZoneStatusTable_ViolatedOpen = "9"
val ZoneStatusTable_ViolatedEOL = "A"
val ZoneStatusTable_ViolatedShort = "B"
val ZoneStatusTable_BypassedOpen = "D"
val ZoneStatusTable_BypassedEOL = "E"
val ZoneStatusTable_BypassedShort = "F"

rule "Interpret Alarm Command"
        Item AlarmMessage received update
        var lines = AlarmMessage.state.toString.split('\n')

        lines.forEach[line |
                if(line.length > 6) {
                        var messageLength = line.substring(0,2)
                        var commandType = line.substring(2,4)
                        var checksum = line.substring(line.length-3, line.length-1)
                        //logInfo("alarm", "Message:" + line + " Len:" + messageLength + " Command:" + commandType)

                        if(commandType == AlarmMemoryMessage) {
                                var alarmMemoryAreas = line.substring(4, 12)
                        else if(commandType == ZoneChangedMessage) {
                                var int zoneNumber = Integer::parseInt(line.substring(4,7))
                                var zoneStatus = line.substring(7,8)
                                var zone = Alarm_PIR_GF_Lounge
                                switch zoneNumber {
                                        case zoneNumber == 1 : zone = Alarm_PIR_Zone1
                                        case zoneNumber == 2 : zone = Alarm_PIR_Zone2
                                        case zoneNumber == 3 : zone = Alarm_PIR_FF_MasterBedroom
                                        case zoneNumber == 4 : zone = Alarm_PIR_Zone4
                                        case zoneNumber == 5 : zone = Alarm_PIR_FF_Nursery
                                        case zoneNumber == 6 : zone = Alarm_PIR_FF_Stairs
                                        case zoneNumber == 7 : zone = Alarm_PIR_GF_Lounge
                                        case zoneNumber == 8 : zone = Alarm_PIR_GF_Stairs

                                var state = "OFF"
                                switch zoneStatus {
                                        case zoneStatus == ZoneStatusTable_NormalUnconfigured : postUpdate(zone, OFF)
                                        case zoneStatus == ZoneStatusTable_NormalOpen : postUpdate(zone, OFF)
                                        case zoneStatus == ZoneStatusTable_NormalEOL : postUpdate(zone, OFF)
                                        case zoneStatus == ZoneStatusTable_NormalEOL : postUpdate(zone, OFF)
                                        case zoneStatus == ZoneStatusTable_NormalEOL : postUpdate(zone, OFF)
                                        case zoneStatus == ZoneStatusTable_TroubleOpen : postUpdate(zone, ON)
                                        case zoneStatus == ZoneStatusTable_TroubleEOL : postUpdate(zone, ON)
                                        case zoneStatus == ZoneStatusTable_TroubleShort : postUpdate(zone, ON)
                                        case zoneStatus == ZoneStatusTable_ViolatedOpen : postUpdate(zone, ON)
                                        case zoneStatus == ZoneStatusTable_ViolatedEOL : postUpdate(zone, ON)
                                        case zoneStatus == ZoneStatusTable_ViolatedShort : postUpdate(zone, ON)

                        else if(commandType == NetworkAdapterPing) {

                        else {
                                //logInfo("alarm", "No code match")

With this Items file and Rules file I’m able to receive and monitor the state of the PIR sensors on my home alarm using the serial adapter and the Serial binding.

I’ve written up a few points on how I got the serial binding here if anyone is interested. I’m keen to do a small write up once I get the NESS M1 serial device mirroring working as well.


1 Like

I’ve found an answer to my third question. Turns out there is a known bug with OH2 that causes errors with updating the sitemap in some browsers, but rebooting the OH server fixes this.

1 Like

I’ve settled on a solution for the motion sensor item type, I’ve decided to go with the Contact item type.

I’ll keep this site update with any updates I make to the .items and .rules files needed to get the ELK/NESS M1 controller communicating the motion sensor status over serial.


1 Like

Did you end up finding a solution to the ip-serial interface? I am trying to decide on which panel to get as I design my build. It sounds like you went usb-serial for the binding. I was looking at the ness 16 because it has a direct cbus interface, and the ip-serial which is half the price. Is the icomms/acomms mobile software any good?