ELK M1 Security

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

mcquerty,

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=">[*:192.168.1.106:2101:default]"}

Many many thanks to you!!!

Very Respectfully,
Dave

1 Like

mcquerty,

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=">[192.168.1.106:2101:'REGEX((.*))']" }

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

sendCommand(ElkString,"06vn0056")

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

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

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

rule "Elk Parser"
when
	Item ElkString changed
then
	//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.")
		}
	}
end

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.

mcqwerty,

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:


https://docs.openhab.org/administration/logging.html

That’ll modify your org.ops4j.pax.logging.cfg file located in /var/lib/openhab2/etc
More info here:
https://docs.openhab.org/administration/logging.html#config-file

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=">[192.168.1.210:2101:‘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:
sendCommand(ElkString,“06vn0056”)

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.

SkipMorrow,

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"
when
	Item ElkString changed
then
	logInfo("test",ElkString.state.toString)
end

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.

In the M1XEP settings in ElkRP, do you have the unsecure port (2101) turned on?


Yes, I have both secure and non-secure ports enabled on the elk.

I have tried configuring OpenHab with port 2601 and got the same results, which is to say nothing happened at all. No errors, no logs, no nothing.

Try this in your .items file (copy exactly as I set the IP and port according to your screenshot):
String ElkListener "ElkListener [%s]" {tcp=">[*:192.168.1.210:2101:default]"}

Trigger some stuff on your Elk and check your events.log file to see if the ElkListener item value changes.

If you still don’t see any action on that item, try adding this additional item to your .items file:
Switch ElkRelay3 "Elk Relay 3" {tcp=">[ON:192.168.1.91:2101:'0Ecn0030000000D7'], >[OFF:192.168.1.91:2101:'0Ecf0030000000DF']"}

Then toggle the switch on and off via the sitemap:

sitemap main label="Test" {
    Frame label="Elk" {
        Default item=ElkRelay3 
     }
}

Watch your Elk through ELKRP and you should see Relay 3 switching on and off as you toggle the switch in OH.

Good luck

Just double-checking, do you have the TCP binding installed?

I don’t have any special settings in my tcp.cfg file.

Below is what I see in the logs when OpenHAB boots. Do you see this?

2018-06-19 19:29:53.650 [INFO ] [b.core.service.AbstractActiveService] - TCP Refresh Service has been started
2018-06-19 19:29:53.651 [INFO ] [ing.tcp.AbstractSocketChannelBinding] - Connecting the channel Channel [item=ElkString, command=0, direction=OUT, remote=/192.168.1.106:2101, buffer=, isBlocking=false, isReconnecting=false, channel=, host=192.168.1.106, port=2101]
2018-06-19 19:29:53.981 [INFO ] [ing.tcp.AbstractSocketChannelBinding] - The channel for /192.168.1.106:2101 is now connected

@SkipMorrow, @davez34 Makes a good point.
To be sure, type this at your OH console bundle:list
You should see ‘openHAB TCP-UDP Binding’ listed, please report the version listed, it will be something like 1.12.0

OK, here we go.

openhab> bundle:list | grep TCP
218 | Active | 80 | 1.12.0 | openHAB TCP-UDP Binding
openhab>

my tcp.cfg is all comments, so everything is defaults.

Here’s my startup log:
2018-06-20 22:04:36.547 [INFO ] [basic.internal.servlet.WebAppServlet] - Stopped Basic UI
2018-06-20 22:04:46.820 [INFO ] [arthome.ui.paper.internal.PaperUIApp] - Stopped Paper UI
2018-06-20 22:04:46.824 [INFO ] [panel.internal.HABPanelDashboardTile] - Stopped HABPanel
2018-06-20 22:04:46.828 [INFO ] [er.internal.HomeBuilderDashboardTile] - Stopped Home Builder
2018-06-20 22:04:46.834 [INFO ] [.dashboard.internal.DashboardService] - Stopped Dashboard
2018-06-20 22:05:24.380 [INFO ] [er.internal.HomeBuilderDashboardTile] - Started Home Builder at /homebuilder
2018-06-20 22:05:26.016 [INFO ] [.dashboard.internal.DashboardService] - Started Dashboard at http://192.168.1.114:8080
2018-06-20 22:05:26.018 [INFO ] [.dashboard.internal.DashboardService] - Started Dashboard at https://192.168.1.114:8443
2018-06-20 22:05:28.693 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model ‘elk.items’
2018-06-20 22:05:29.721 [INFO ] [thome.model.lsp.internal.ModelServer] - Started Language Server Protocol (LSP) service on port 5007
2018-06-20 22:05:30.414 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model ‘elk.rules’
2018-06-20 22:05:30.564 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model ‘main.sitemap’
2018-06-20 22:05:30.582 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model ‘demo.sitemap’
2018-06-20 22:05:30.986 [WARN ] [lipse.smarthome.io.net.exec.ExecUtil] - Execution failed (Exit value: -559038737. Caused by java.io.IOException: Cannot run program “arping” (in directory “.”): CreateProcess error=2, The system cannot find the file specified)
2018-06-20 22:05:30.996 [INFO ] [ternal.dhcp.DHCPPacketListenerServer] - DHCP request packet listener online
2018-06-20 22:05:31.146 [INFO ] [thome.binding.astro.internal.job.Job] - Scheduled Astro event-jobs for thing astro:sun:ffeaf125
2018-06-20 22:05:31.692 [INFO ] [basic.internal.servlet.WebAppServlet] - Started Basic UI at /basicui/app
2018-06-20 22:05:31.764 [INFO ] [arthome.ui.paper.internal.PaperUIApp] - Started Paper UI at /paperui
2018-06-20 22:05:31.817 [INFO ] [panel.internal.HABPanelDashboardTile] - Started HABPanel at /habpanel

So, no, it doesn’t look like TCP binding is starting correctly.

I tried using the new .items line and still nothing:
String ElkListener “ElkListener [%s]” {tcp=">[*:192.168.1.210:2101:default]"}

And when I tried adding the new sitemap, I got this in the log:
2018-06-20 22:17:41.030 [WARN ] [ing.tcp.AbstractSocketChannelBinding] - There is no channel that services [itemName=ElkRelay3, command=ON]
2018-06-20 22:17:43.542 [WARN ] [ing.tcp.AbstractSocketChannelBinding] - There is no channel that services [itemName=ElkRelay3, command=OFF]

I think we are getting somewhere???

By the way, thank you all SO MUCH for the help! I’m a fast learner with this kind of stuff, so I think once we get this working, I’ll be setting stuff up like crazy!

Skip

I messed up the definition of the second item, I forgot to update it to reflect your setup.

Your TCP items file shoudl look like this:

String	ElkListener	"ElkListener [%s]"	{tcp=">[*:192.168.1.210:2101:default]"}
Switch ElkRelay3 "Elk Relay 3" {tcp=">[ON:192.168.1.210:2101:'0Ecn0030000000D7'], >[OFF:192.168.1.210:2101:'0Ecf0030000000DF']"}

Not sure what to make of your startup log. Once you have updated your items file, maybe try an OH restart. That seems to fix weird stuff for me, especially with the TCP binding and is worth a go.

I restarted OH, made the change suggested, went to the basic UI and clicked on the Elk Relay3. Still getting the same channel error:
2018-06-21 06:08:38.498 [WARN ] [ing.tcp.AbstractSocketChannelBinding] - There is no channel that services [itemName=ElkRelay3, command=ON]
2018-06-21 06:08:40.995 [WARN ] [ing.tcp.AbstractSocketChannelBinding] - There is no channel that services [itemName=ElkRelay3, command=OFF]

Does anyone think this is a network setup issue, or is this an OH configuration issue? I was thinking this afternoon I could try using PuTTY to connect to my XEP and see if I can observe the commands and responses there.

Checking with Putty sounds like a great idea! I don’t know enough about OpenHAB to say if its a network or OpenHAB config issue.

Perhaps, try my .items example and not mcquerty’s example?

String ElkString “Elk String [%s]” { tcp=">[192.168.1.210:2101:‘REGEX((.*))’]" }

I don’t have anything uncommented in tcp.cfg

If you want to try mcquerty’s line, try uncommenting the following in tcp.cfg

itemsharedconnections=true
bindingsharedconnections=true
directionssharedconnections=true

I am not sure about the exact meaning of those issues in the log either but it does mean that the TCP binding is not setup correctly to carry out the command.

In addition to the tcp.cfg settings @davez34 suggests, also try adding the following:

postamble=\r\n
updatewithresponse=false
charset=ASCII

Make sure everything else other than those six settings is commented out.

I know it’s a pain, but I would try restarting OH again after making those config changes.