InsteonPLM binding support for FAST ON and FAST OFF

Off-topic: I just managed to set the time for my insteon thermostat via a python command line tool.

Very nice! I ended up ditching (anyone need a bunch of stats?) Insteon stats and went with Z-Wave CT100s. The clock thing was on the list, but also had issues with Off state, temp / humidity accuracy, and bad data.

Double tap the switch in my bedroom to trigger all lights off for my apartment. Also, if you create a scene where the responder is OFF, when you single tap on, only the controller will turn on. Double tap on and both the controller and responder will turn on, as the stored level is ignored for fast on. It’s an easy way to get two different light scenes from a standard switch.

Good news everybody! The 1.8.0-SNAPSHOT jar worked perfectly in my 1.7.1 environment (once I switched the build tree over to insteonplm from master). Fast on and off behaved exactly as expected. There was a few second delay between the button press and the action, but I think this is unavoidable given the way Insteon works. I didn’t have a change to try out the manual dim feature though. Hopefully tonight.

@Bernd_Pfrommer rocks!!!

I tested out the new changes to the binding. I’m seeing some unexpected behavior. Maybe bugs?

21741 2015-09-16 12:52:07 - masterBedLights state updated to ON
21742 2015-09-16 12:52:08 - masterBedLights state updated to 58
21743 2015-09-16 12:52:13 - masterBedLights state updated to OFF
21744 2015-09-16 12:52:18 - masterBedLightsFastOnOff state updated to ON
21745 2015-09-16 12:52:22 - masterBedLightsFastOnOff state updated to OFF
21746 2015-09-16 12:52:26 - masterBedLightsFastOnOff state updated to ON
21747 2015-09-16 12:52:33 - masterBedLights state updated to OFF
21765 2015-09-16 12:54:14 - masterBedLightsFastOnOff state updated to ON
21766 2015-09-16 12:54:24 - masterBedLights received command 42
21767 2015-09-16 12:54:25 - masterBedLights state updated to 42
21768 2015-09-16 12:54:28 - masterBedLights state updated to OFF
21769 2015-09-16 12:54:34 - masterBedLightsFastOnOff state updated to ON
21770 2015-09-16 12:54:36 - masterBedLights state updated to ON

I added the masterBedLightsFastOnOff item as a Switch with #fastonoff. masterBedLights was already a Dimmer item with #dimmer. I tried setting masterBedLightsFastOnOff as Dimmer item and the behavior seems to be the same.

When I double tap the switch, you can see in the log lines that the FastOnOff state is updated to ON or OFF. The physical light goes on or off immediately when I do that. However, the state of the masterBedLights item does not receive an update.

I’m wondering if this should be implemented in a different way. Would it make more sense not to have an additional Item in the insteon.items file, but instead reuse the existing one with feature #dimmer,fastonoff? That way, a rule file could do something like this:

Rule “Rule Name”
when
Item masterBedLights received command FAST_ON
then

Any thoughts?

Oh, and I had to add FastOnOff to F00.00.01 to make it work. Would you mind adding that in the device_types.xml?

 <device productKey="F00.00.01">
     <model>2477D</model>
     <description>SwitchLinc Dimmer</description>
     <feature name="dimmer">GenericDimmer</feature>
     <feature name="manualchange">ManualChange</feature>
     <feature name="fastonoff">FastOnOff</feature>
     <feature name="lastheardfrom">GenericLastTime</feature>
 </device>

However, the state of the masterBedLights item does not receive an update.

I checked last night on my F00.00.02, and my behavior was as expected, openHAB was properly tracking the light switch itself with no delay.

That’s interesting. So there may be something wrong in my configuration. Here are my items. Would you mind posting yours?

Dimmer masterBedLights                   "Master Bedroom Lights"  <bedroom>   (gMaster_Bedroom) {insteonplm="xx.xx.xx:F00.00.01#dimmer"}
Switch masterBedLightsFastOnOff          "Master Bedroom Lights FastOnOff" <bedroom>(gMaster_Bedroom) {insteonplm="xx.xx.xx:F00.00.01#fastonoff"}

What version of openHAB runtime are you using? I’m using 1.7.1 and I dropped the 1.8.0 snapshot of insteonplm into that deployment. Maybe I’ll need to try updating the whole thing…

1.7.1 with the 1.8.0-SNAPSHOT insteonplm binding. Here is the configuration I’m using:

Switch Light_Bedroom_Nightstand                 "Night Stand"   (Bedroom, Lights) {insteonplm="AA.BB.CC:F00.00.02#switch,related=DD.EE.FF"}
Switch Light_Bedroom_Nightstand_DoubleClick     "Night Stand (Double Click)"    {insteonplm="AA.BB.CC:F00.00.02#fastonoff"}

Here is the events.log from last night when I turned everything off:

2015-09-16 21:51:25 - Light_Bedroom_Nightstand_DoubleClick state updated to OFF
2015-09-16 21:51:25 - Light_Bedroom_Nightstand state updated to OFF
2015-09-16 21:51:25 - Lights received command OFF
2015-09-16 21:51:25 - Light_Living_Shelf received command OFF
2015-09-16 21:51:25 - Light_Bedroom_Dresser received command OFF
2015-09-16 21:51:25 - Light_Bedroom_Nightstand received command OFF
2015-09-16 21:51:26 - Light_Living_Shelf_Level state updated to OFF
2015-09-16 21:51:26 - Light_Living_Shelf state updated to OFF

Now that I think about it though, I’m also explicitly setting everything off in my rules. If I have time tonight, I’ll disable the rule and test again.

Added fastonoff feature now for all devices where it makes sense (lights, dimmers).

Only the switches will update their state properly when faston and fastoff are clicked.
The dimmers do not handle it correctly (they don’t have a handler installed). Bug.
Fixing it.

Fixed with PR 3205:

The pull request has a link to a pre-compiled jar file.

Ok, this is working better for me. With these bindings:

Dimmer masterBedLights                   "Master Bedroom Lights"  <bedroom>   (gMaster_Bedroom) {insteonplm="30.AE.72:F00.00.01#dimmer"}
Dimmer masterBedLightsFastOnOff          "Master Bedroom Lights FastOnOff" <bedroom>(gMaster_Bedroom) {insteonplm="30.AE.72:F00.00.01#fastonoff"}

I now get the following in the events log, which is just as I would expect:

6335 2015-10-02 12:11:28 - masterBedLightsFastOnOff state updated to ON
6336 2015-10-02 12:11:28 - masterBedLights state updated to ON
6337 2015-10-02 12:11:34 - masterBedLightsFastOnOff state updated to OFF
6338 2015-10-02 12:11:34 - masterBedLights state updated to OFF

My problem now is that I can’t seem to get the fastonoff feature to trigger any rules. I have the following rules for the above items. When I trigger the fast on or fast off, I never see any of the log statements in the rules and the loft light doesn’t change. Am I doing something wrong in these rules?


rule "Turn off loft light when master bedroom light double tapped"
	when Item masterBedLightsFastOnOff received update OFF
then
	logInfo("masterBedLights FastOnOff", "received update OFF")
	sendCommand(loftLight, OFF)
end
 

rule "Turn off loft light when master bedroom light double tapped 2"
	when Item masterBedLightsFastOnOff received update ON
then
	logInfo("masterBedLights FastOnOff", "received update ON")
	sendCommand(loftLight, ON)
end

rule "Turn off loft light when master bedroom light double tapped 3" 
	when Item masterBedLightsFastOnOff received command
then
	logInfo("masterBedLights FastOnOff", "masterBedLightsFastOnOff Received command [{}], state=[{}]", receivedCommand.toString(), masterBedLightsFastOnOff.state.toString())
end

Xtend scripting sucks big time, every which way. What do you expect, error messages? That’s for whimps!!!
Real men debug by trial and error!

Here’s my advice:

  1. Switch to python scripting. I just wasted a full day or more to debug some problems with that, fun, fun. But it’s worth it. You get error messages and a well documented language without some screwy syntax like “Item changed” etc. Look for “jsr223” keyword to get started.
  2. If you want to bang your head against this, use the Designer, that at least tells you about the worst syntax errors etc. If (if!) you can even run the bloated thing on whatever hardware you have openhab running.

End of rant.

1 Like

Haha, I feel ya!

I do use the designer, which did not show any errors on the above rules. I definitely have not loved Xtend either, and trying to understand its relationship with Java and when certain classes and commands are allowed vs when they are not.

The jsr223 scripting has definitely been on my radar with an api that seems more complete. I would probably use javascript since I do a lot of that in my day job, but the advice is good either way. Thanks for the tip.

How did you do this? I’m looking to do the same thing

NVM, I had to keep reading

@Bernd_Pfrommer can you please have a look at this question? Insteon Dimmer LamLinc doesn't turn off the light

What did you write in your sitemap for Light_Bedroom_Nightstand_DoubleClick (or basically for items with feature fastonoff)?