ELK M1 Security

Hi Mal,

Can i trouble you for a copy of your mqtt interface file please?


Sorry rsmonteiro - for some reason i dont get alerts from this list and only check it every now and then!

I will be back home at the weekend and will put it up then.

My email is mal.harwood at foresterit.com.au

drop me a note and i will send you the details …

The trail seems to have gone a bit cold on this one as does the comment thread on this github project:
https://github.com/openhab/openhab2-addons/pull/1955 (assuming it is the same one)

Does anyone have a working Elk binding? Either this one or any other?
Does anyone have an active dev project for an Elk binding we could contribute to and/or a .jar we could test??


Any update? Do you have anything we could test?

Check out the “Java library to interact with the Elk M1XEP RS232 protocol” project i made a few years ago.

Both secure port and default port connections work. Check the cdh test package for help obtaining the cert from your M1XEP.


This class is pretty straight forward, and has all of the core commands and message processing you need i assume.

I would think that this is the heavy lifting you require, it shouldn’t take much to call this from your addon, right? I’m completely new to OpenHAB and have just considered whether it is something i should add to my house.

Hey Everyone,

Other than the MQTT approach has anyone worked on a binding for this?

Has anyone had any luck using the TCP binding to receive status messages from the ELK?

I can view the status messages using a raw connection to port 2101, and using the ELK ASCII Protocol &
Interface Specification it looks like it will be pretty easy to act on the incoming strings. I’m using Putty to verify that the ELK is communicating.

ELK ASCII Protocol &
Interface Specification located here: https://www.fixagate.com/assets/m1_rs232_ascii_protocol.pdf

For my Items File, I am using this:

String ElkString "Elk String [%s]" { tcp="<['REGEX((.*))']"}

I don’t see any tcp binding related messages in the openhab.log or events.log

I have left the tcp.cfg file as default.

I’m viewing the strings in the sitemap and also with logInfo. Right now the string is just NULL

Text item=ElkString

Don’t ask me why this works but it does:

String ElkListener "ElkListener [%s]" {tcp=">[*:]"} is the ip address of my M1XEP.

I know this doesn’t make sense since it is an outgoing configuration but I see the ElkListener item updated every time the M1XEP outputs a new message.

It took me a long time to stumble upon this. After reading up on everything I could find on the not very well documented tcp binding, I concluded that the reason the incoming connection doesn’t work is that there is no way to tell the M1XEP to send messages to a particular ip address on a particular port, so it doesn’t matter what configuration you setup on the OH server you will never capture any ‘incoming’ messages.

There is an issue with my setup that I have been meaning to post about for a while but had not got round to:
I also have a true outgoing item setup to control a relay on my M1EZ8 -
Switch ElkM1EZ8_Relay03 "Relay03" {tcp=">[ON:'MAP(ELk M1EZ8\\relay03.map)'], >[OFF:'MAP(ELk M1EZ8\\relay03.map)']"}

The issue is that this item also gets updated every time the M1XEP sends out a message (not just responses to a message sent on this item). This is annoying since of course I don’t have mappings in the map files for all of the status messages the ELK sends out and so every 30s I get errors in my OH log telling me it couldn’t find a mapping for <insert status message here> in relay03.map. If anyone knows how to solve this, my disk drive would be grateful of the relief!

Anyway, try the first item and see if it works for you.

I have given up hope of a ‘proper’ Elk binding for OH and have been meaning to use this trick to build something out of the tcp binding and rules. If you wanted to use this thread as a place to collaborate on such I am interested in joining in.

1 Like


Wow thank you so much. I did struggle with the documentation because the “<” was for inbound communication only. You are the man. That would take anyone a long time to figure that out. Thank you for saving us all a huge amount of time.

Did you leave your tcp.cfg as default? I just tried directionssharedconnections=false

I still can’t seem to see any of the Elk strings, but I will try again tomorrow.

I can view the communications on the openhab system with netcat using the command

nc 2101

Hopefully, I might be able to help with OH log issue.I searched the forum just now and saw that wildcards was not supported in the .map file.

I messed quite a bit with my tcp.cfg to see if I could stop the messages coming in to the relay control item, below is the current state of my config file but the ‘magic’ may well work with other settings, in fact I think it does because at the time I was trying to stop the updates:

# all parameters can be applied to both the TCP and UDP binding unless
# specified otherwise

# Port to listen for incoming connections

# Cron-like string to reconnect remote ends, e.g for unstable connection or remote ends
#reconnectcron=0 0 0 * * ?

# Interval between reconnection attempts when recovering from a communication error,
# in seconds

# Queue data whilst recovering from a connection problem (TCP only)

# Maximum buffer size whilst reading incoming data

# Share connections within the Item binding configurations

# Share connections between Item binding configurations

# Share connections between inbound and outbound connections

# Allow masks in ip:port addressing, e.g.* etc

# Pre-amble that will be put in front of data being sent

# Post-amble that will be appended to data being sent

# Perform all write/read (send/receive) operations in a blocking mode, e.g. the binding
# will wait for a reply from the remote end after data has been sent

# timeout, in milliseconds, to wait for a reply when initiating a blocking write/read
#  operation

# Update the status of Items using the response received from the remote end (if the
# remote end sends replies to commands)

# Timeout - or 'refresh interval', in milliseconds, of the worker thread

# Timeout, in milliseconds, to wait when "Selecting" IO channels ready for communication

# Used character set
1 Like

hmm, those errors look vaguely familiar…
I tried so many things and changed so much stuff that it is hard to remember exactly what I did in what order, all I have is the current sate and vague memories :slight_smile:

Sorry to suggest such a noob-style fix, but maybe try restarting OH? That seems to fix all kinds of weirdness for me and I think that is what I did to solve that issue… I think.

Edit: Looks like you deleted your post - not sure what is going on but I’ll leave my reply here for a while anyway.

1 Like


Thank you thank you thank you! I deleted my post because I realized I had a stupid typo in my Item definition, so I wanted to restart Openhab and try again before I bugged you. It works perfectly now! When I get a chance, I’ll go back to the default tcp.cfg to see if it still works.

I can see each string come across into the sitemap.

This is my working item definition

String ElkString "Elk String [%s]" {tcp=">[*:]"}

Many many thanks to you!!!

Very Respectfully,

1 Like


I appreciate all of your help. You saved me a ton of time.

I have a few suggestions below that seem to work great for me.

I can send commands to the Elk Alarm, and I don’t have to use a transformation map file. I also commented everything in the tcp.cfg so I am back to the defaults.

My Elk item is different from yours. For some reason, I couldn’t use your ElkListener item to send commands. I am using the same ElkString to send and receive commands.

String ElkString "Elk String [%s]" { tcp=">['REGEX((.*))']" }

To send a command to the Elk, you can use sendCommand. Here’s an example


For your switch, you could have a item and rule as follows:

Switch ElkM1EZ8_Relay03	"Relay03"
rule "ElkM1EZ8_Relay03 toggle"
	Item ElkM1EZ8_Relay03 changed
	if (ElkM1EZ8_Relay03.state == ON) { sendCommand(ElkString,"06vn0056") }  // insert your relay on command here
	else { sendCommand(ElkString,"06rr0056") }  // insert your relay off command here

My Elk parser is probably going to be pretty simple. This just outputs the zones. Seems to work reliably.

rule "Elk Parser"
	Item ElkString changed
	//logInfo("Elk Parser","Elk status string: " + ElkString.state.toString)
	if (ElkString.state.toString.substring(2,4).equals("ZC"))
		if (ElkString.state.toString.substring(7,8).equals("B"))
			logInfo("Elk Parser","Zone " + ElkString.state.toString.substring(4,7) + " is open.")
		} else if (ElkString.state.toString.substring(7,8).equals("2"))
			logInfo("Elk Parser","Zone " + ElkString.state.toString.substring(4,7) + " is closed.")

Thanks for the info on the .cfg file. As I suspected my tinkering made no difference :slight_smile:

As for my setup, I only use the ‘ElkListener’ item to receive commands, I have different items for sending commands, one such is the ‘ElkM1EZ8_Relay03’ item.
I know I could eliminate the mappings using the method you suggest but I want to keep the mappings as they mean:
a) I can abstract the elk commands away into a neat .map file, one for each item.
b) I don’t need any rules to make it all work, I just command the ‘ElkM1EZ8_Relay03’ item to ON or OFF and the mappings take care of the rest.

The only issue is that since I don’t understand why the magic is happening that causes all of my Elk-related items to be updated every time the M1EZ8 sends out a message, I am unable to exclude items such as the ‘ElkM1EZ8_Relay03’ from these updates and so get the mapping warnings.

Hopefully we will one day understand why the magic is happening and then maybe be able to selectively ‘listen’ to the M1XEP on only one item. Until then I just deal with the warnings in the log.


I wonder if you could get into karaf (ssh -p 8101 openhab@localhost) (password is habopen) and type in:

log:set ERROR org.openhab.binding.TCPBinding (caveat: I haven’t tried this myself)
log:set ERROR org.openhab.binding.AbstractFileTransformationService (caveat: I haven’t tried this myself)

That will set your logging for those two services at level ERROR, and will not log Warnings.

More info here:


That’ll modify your org.ops4j.pax.logging.cfg file located in /var/lib/openhab2/etc
More info here:

I don’t see anyway to do wildcards or such in the transformation file :frowning:

Hi everyone. First post here. I have been tinkering with HA for ten-ish years. I have an Elk M1G with the ethernet adapter. I just installed OH over the Father’s day weekend, and of course I want the Elk to interface with it. I found this post and I plan to try some of this stuff out tonight. I see that the last post here was from a few months ago, so I do wonder if there have been any developments. Any files worth sharing or tips that I should know about?
I realize that I may be starting off with a difficult project here considering I haven’t even written my first rule on OH, so do apologize in advance for any probable newb questions.

Second question (and the first one isn’t even answered yet!)

I have added an item as suggested here:
String ElkString “Elk String [%s]” { tcp=">[‘REGEX((.*))’]" }

I see the log entry that it has been parsed, so all it well, I think??? I then opened a zone (a door) and thought something would show up in the log, but nothing did. But I am not sure that anything would log, so maybe this isn’t a problem.

I then wanted to try the sendCommand as here:

Which asks the elk for the version number. But I couldn’t figure out how to run that command. My karaf has a send command, but no sendCommand command. How can I run that command? I haven’t done any rules yet, because I just want to make sure this part is working first, and not has to try and figure out if the rule isn’t working or the elk binding. Know what I mean?

Also, is there a way to view the value of ElkString in karaf? I thought I would be able to echo $ElkString, but that came up null.


I would see if you can view the ElkString in the sitemap.

sitemap main label="Test" {
    Frame label="Elk" {
        Text item=ElkString


Also, you can run this in the rules:

rule "Elk String Update"
	Item ElkString changed

and run tail -f /var/log/openhab2/openhab.log in linux to view the openhab log.

Good luck!!

I have added the sitemap and the rule, and I am watching the openhab.log (I’m on Windows). So far, no logging other than the loading of the files (no error messages). I tested by opening and closing a door and nada.

I also saw the link for the elk in the basic UI, but no value displayed.

I also just reconfirmed the M1XEP IP address.