Insteon Leak Detector Support

I have an Insteon Leak Sensor (Model 2852) and I’d like to add heartbeat support for it since this is an indication of battery status (there is no battery level reporting). The Insteon binding’s device_features.xml maps a cmd attribute (“Command 1”) to message handlers. However, the leak sensor heartbeat uses the same primary command as the wet/dry status notifications. For the heartbeat, the Command 2 value (“group” attribute in device_features.xml) is different.

I’m considering modifying the device_features.xml parsing to use both Command 1 (cmd) and Command 2 (group) as the key for message handlers and then use the extended keys to add the leak sensor heartbeat handlers. I’m wondering if @Bernd_Pfrommer or others have any concerns about this approach.

Steve,

First questions:

  1. What do you want to ultimately do with the heartbeat? Parse it, and update the contact to wet/dry? In that case you would not need to add a new feature, but just modify the existing feature, currently “#contact”.

Assuming you would be happy with just that (parsing the incoming message successfully should also update the “lastheardfrom” feature, so you could see when that device has last given some sign of life (although it might already do that right now, by the mere fact that a message has come in from that device, whether it’s handled or not).

I’m sure you’ve seen these notes, but here’s the link for completeness:

Do you know what it is currently doing with the heartbeat messages? Do you have the debug log switched on? By code inspection, both the 0x11 and 0x13 heartbeat should reach the OpenedOrClosedContactHandler, but the 0x13 is discarded right away, and the 0x11 will be discarded later because cmd2 = 0x04.

I would modify the OpenedOrClosedContactHandler such that it will process both 0x11 and 0x13 messages. The 0x13 messages should only be processed if cmd2 = 0x04, and should translate to “wet” (publish CLOSED). The 0x11 should be processed as before, but should also publish OPEN(dry) when cmd2 = 0x04.

Docs say it only sends that message out once ever 24h. Be prepared for a long development cycle :smile:

Great questions…

I’m currently using the exec binding to scan the log files for the most recent heartbeat message processing (running the InsteonPLM MessageDispatcher at debug level). Like you and the documentation say, it sends a heartbeat about every 24 hours. I process both the timestamp and the status from the log.

If the lastheardfrom is updated whether or not the message is dispatched then that may work for the timestamp. I hadn’t thought of that.

Yes, the following is an example log message…

2015-10-27 01:45:45 DEBUG o.o.b.i.i.d.MessageDispatcher[:72]- 36.B0.D0:LeakSensorContact->OpenedOrClosedContactHandler cmd1:0x11 group 4/-1:IN:Cmd:0x50|fromAddress:36.B0.D0|toAddress:00.00.04|messageFlags:0xCB=ALL_LINK_BROADCAST:3:2|command1:0x11|command2:0x04|

The handler is invoked but it doesn’t recognize the group 4 (cmd2).

That sounds like it would work. I’ll try it out and submit a PR if there aren’t any other issues. Thanks!

Hi guys,

I see this is an old thread, but wondering what became of this? I also have a leak sensor and would love to be able to see heartbeat to know that the sensor isn’t dead.

It is in the openhab1 binding.

@steve1 - great, thanks for pointing me to it. I must have something screwed up with my lastheardfrom item or sitemap then, I’ve had this running for a couple weeks and last heard from still is undated. I’ll check it out. Thanks!

@steve1 & @Bernd_Pfrommer,

OK, so I’ve played around with this for a few days. My leak sensor work fine showing me both wet and dry conditions (shorting leads to test for wet and pushing button to go back to dry). When I test this, it also populates the Last heard from field with the date/time of the change. I have both the sensor status and the LHF on my sitemap so I can easily see these, which makes me pretty confident that the sensor and openhab are set up correctly. I have gone more than 24 hours with the LHF not being updated so I have to assume the the heartbeat is not updating my LHF field.

Here are the lines in my PLM’s DB for the leak sensor. Do I need another special link for the heartbeat?

0000 leakSensor  3F.A0.8F  RESP  10100010 group: 01 data: 00 00 01
0000 leakSensor  3F.A0.8F  RESP  10100010 group: 02 data: 00 00 00

Can anyone give me a clue what to look for in my log to see if I’m receiving this heartbeat and not processing properly or if there is something else going wrong?

Thanks as always for your help!

We’ve had this before… not sure really what the fix was.

https://groups.google.com/forum/#!topic/openhab/chu17X9VlD4

I just looked at the docs,

I think you also need a link to group #4, no?

If you figure this one out, please update the wiki page on the leak sensor, thanks!

I checked my logs, and it works reliably for me. What is your item definition for the Leak Sensor LHF data?

If I were having problems with it, I’d adjust the logging level for the insteonplm binding message processing down to debug or trace and look for the heartbeat message being logged.

Thanks @steve1 and @Bernd_Pfrommer,

Here are my .items:

Contact basementLeak "Basement Leak Sensor [MAP(leak.map):%s]" <water>		(Leak_Chart, gSensors) {insteonplm="3F.A0.8F:F00.00.0A#contact"}
DateTime basementLeakLHF "Basement LeakLHF [%1$tm/%1$td %1$tl:%1$tM %1$tp]" <calendar> {insteonplm="3F.A0.8F:F00.00.0A#lastheardfrom"} 

and my .sitemap

Text item=basementLeak
Text item=basementLeakLHF

and my RRD4J.persist (because @Nicholas_Waterton noted that he thought he solved his issue by adding persistence [I removed all items other that this leak sensor to post here])

basementLeak, basementLeakLHF: strategy = everyChange, everyMinute, restoreOnStartup

As for logging, I added to my logback.xml as suggested in the wiki to separate my Insteon log and have the level set to debug. I’m just not really sure what to look for in it for heartbeat.

Looking through the developer notes that Bernd posted, it does mention group 4 being used for heartbeat. @steve1 Do you have a group 4 link in your PLM?

@steve1 / @Bernd_Pfrommer,

OK guys, I’ve got this working now.

Bernd, as you pointed out: from the developer’s notes, it appeared that the heartbeat signal was sent to group 4. I had thought that the logfile in debug mode would have shown the incoming group 4 message whether or not my PLM was linked to group 4 for my leak sensor and I saw no traffic to group 4. I decided to add that link anyway and a few hours later I saw an update to my LastHeardFrom without a change in state of my leak sensor, so I went and checked my log and saw this:

2017-04-09 22:06:24 DEBUG o.o.b.i.InsteonPLMActiveBinding[:581]- got msg: IN:Cmd:0x50|fromAddress:3F.A0.8F|toAddress:00.00.04|messageFlags:0xCF=ALL_LINK_BROADCAST:3:3|command1:0x11|command2:0x04|
2017-04-09 22:06:24 DEBUG o.o.b.i.i.d.MessageDispatcher[:68]- all link message: IN:Cmd:0x50|fromAddress:3F.A0.8F|toAddress:00.00.04|messageFlags:0xCF=ALL_LINK_BROADCAST:3:3|command1:0x11|command2:0x04|
2017-04-09 22:06:24 DEBUG o.o.b.i.i.d.MessageDispatcher[:70]- all link message is no duplicate: true/true
2017-04-09 22:06:24 DEBUG o.o.b.i.i.d.MessageDispatcher[:72]- 3F.A0.8F:LeakSensorContact->OpenedOrClosedContactHandler cmd1:0x11 group 4/-1:IN:Cmd:0x50|fromAddress:3F.A0.8F|toAddress:00.00.04|messageFlags:0xCF=ALL_LINK_BROADCAST:3:3|command1:0x11|command2:0x04|
2017-04-09 22:06:24 DEBUG o.o.b.i.i.device.DeviceFeature[:264]- 3F.A0.8F:LeakSensorContact publishing: OPEN
2017-04-09 22:06:24 DEBUG o.o.b.i.i.device.DeviceFeature[:264]- 3F.A0.8F:GenericLastTime publishing: 2017-04-09T22:06:24
2017-04-09 22:06:25 DEBUG o.o.b.i.InsteonPLMActiveBinding[:581]- got msg: IN:Cmd:0x50|fromAddress:3F.A0.8F|toAddress:00.00.04|messageFlags:0xCF=ALL_LINK_BROADCAST:3:3|command1:0x11|command2:0x04|
2017-04-09 22:06:25 DEBUG o.o.b.i.i.d.MessageDispatcher[:68]- all link message: IN:Cmd:0x50|fromAddress:3F.A0.8F|toAddress:00.00.04|messageFlags:0xCF=ALL_LINK_BROADCAST:3:3|command1:0x11|command2:0x04|
2017-04-09 22:06:25 DEBUG o.o.b.i.i.device.DeviceFeature[:264]- 3F.A0.8F:GenericLastTime publishing: 2017-04-09T22:06:25

I’ve added my findings to the wiki for others.

Thanks for your help!

@tommycw10 or anyone else who has leak sensors working

Would you be able to share your leak sensor db? I tried adding my modem as a responder to group 4 to get the heartbeat messages, but not sure if it is working. My leak sensor contact item does not seem to change back to Dry unless I press the button.

Here is my link table for the sensor. Do you see if I did it incorrectly?

getting db, be patient!
sent db query msg, incoming records:  1 2 3 4dbbuilder.done() is called
0fff modem                          30.DC.6C  CTRL  11100010 group: ff ON LVL:   3 RMPRT:   0 BUTTON:   0
0ff7 modem                          30.DC.6C  RESP  10100010 group: 01 ON LVL:   3 RMPRT:   0 BUTTON:   0
0fef modem                          30.DC.6C (RESP) 00100010 group: 04 ON LVL:   0 RMPRT:   0 BUTTON:   4
0fe7 00.00.00                       00.00.00 (STOP) 00000000 group: 00 ON LVL:   0 RMPRT:   0 BUTTON:   0

and for the modem:

0000 fletcherLeak                   32.1C.CF  RESP  10100010 group: 01 data: 00 00 01
0000 fletcherLeak                   32.1C.CF  RESP  10100010 group: 02 data: 10 08 43
0000 fletcherLeak                   32.1C.CF  RESP  10100010 group: 04 data: 00 00 04
0000 fletcherLeak                   32.1C.CF  CTRL  11100010 group: 01 data: 10 08 43

thanks,
Craig