Lutron OH2 binding

Thanks for the reference to the discussion. I tend to agree that the action should be “activate scene” and not “push button” and perhaps a “query scene” action as well.

I looked at both the LIP and LEAP interfaces on my Smart Bridge PRO and neither reported that a “matching” scene had also been activated. (They both reported that the requested scene was activated.) As can’t see what the app queries or received over what I believe to be secure MQTT, I can only guess that it queries to update itself and its widget.

Scenes are certainly lower on my priority list than emulating the up/down action across groups, but I’ll keep thinking about it.

Ultimately what I’m trying to achieve in (2) is to activate a fan that is controlled with a contact closure on a VCRX (Visor Control Receiver). I have my RadioRA2 system set up with two toggle buttons on my GrafikEye, one for on/off (Integration ID 27, Component Number 77), the second for speed high/low (Integration ID 27, Component Number 83).

In my current automation software, I define a ‘Thing’ with Integration ID 27, Component Number 77 that sends the Button Press Command. When I press the button on my virtual remote, it sends (#DEVICE,27,3) to the Main Repeater.

It sounds from @actong88 that the current GrafikEye binding Thing doesn’t support the buttons that you need to attach an Item to. openHAB, for many bindings hides away the communication layer, so you can’t just “attach to ID 27, component 77” unless the binding already knows about that button and has crated a Channel connected to it.

If you need it immediately, you might be able to use one of the TCP bindings to directly communicate with the bridge. I’m only as familiar with the GrafikEye as reading the Lutron Integration Protocol document provided. With what looks like 150 or so DEVICE targets it might need a subtly different strategy.

Thanks for the fast reply Allan.

I’d prefer to keep my scenes on the RadioRA2 main repeater - it has gone 5 years without a crash and just works. I worry that if all of my scenes live in OpenHab on my Raspberry Pi, I will come home to dead keypads if the Pi crashes and be unable to turn my lights on. I’m also not a big fan of duplication; rebuilding all the scenes already in my RA2 repeater in OpenHab seems wasteful.

Perhaps talking about simulating a button press is the wrong way to sell this functionality - the physical button simply sends a device command. It would be nice to have a switch in OpenHab that could also send this command, no different than how a Maestro Dimmer Thing in your binding sends a output command to the main repeater.

I can provide my RR2 integration report if that would help. I’m in the process of teaching myself Java, but am very new to object oriented programming. When I get up to speed I would like to help contribute or maintain - as I know that my specific RR2 installation with a GrafikEye and a VCRX is not common.

If I may make an observation and suggestion for ‘custom’ keypads - it appears in your current keypad handler the only variable the user (or DbXmlInfo.xml used during autodiscovery) provides is the Integration ID, while

  1. the number of channels
  2. channel ID
  3. channel names
    are constants that are assumed to be Component = Button1, Component Number =1, etc. Perhaps if these were variables you could have a dynamic keypad that could cover any and all RA2 keypads?

I know the button names aren’t easily accessible if you download DbXmlInfo.xml from the main repeater, but if the user has the integration report csv, it would be easy to use this file to generate keypads and buttons in a .things and .items file with meaningful names, as @jeffsf has already done with Bash scripts.

That’s a great suggestion Jeff. I’ll give that a try.

As an aside, I can’t figure out how to send a PM - I’d like to use your Bash script to parse my integration report. Though it appears the RR2 report is a csv, vs the SmartBridgePro outputting tab-seperated values.

I wish it parsed the JSON integration report, or the LEAP version, which is even more extensive. Alas, it’s eyeball-and-finger parsing.

The whole Item vs. Thing thing is a bit confusing at first, and I still mix the two up. Where you likely want the human-readable stuff is on the Item – that’s what the rules and UI render, not the Things that represent the physical devices.

As soon as I get some things going here, I’m going to poke around with ways to trigger and query scenes on the bridge. I’m with you on having the reliability of a commercial or semi-commercial unit maintaining the presets and able to control them when something happens to openHAB or its host. I also like the ability to set and control the scenes through the app. It seems much better than having 20 Items per scene to hold the preset levels, then all the UI around setting it, and…

Binding and/or Smart Bridge PRO hangs, associated with high command rate

Anyone else seen anything like this?

I’ve got a Pico that has a pair of rules that sends one command to a group of dimmers on depress, and another when the same button is released.

If I use the dimmer_group_name.sendCommand() approach, the button-up event isn’t seen for 10-20 seconds after it physically occurs (which was likely ~250 ms after it was pressed, based on other logging). Watching the openHAB event log and using ngrep (or tcpdump) to monitor the telnet connection, they are at least all self-consistent.

If I iterate through the group members myself and put a 100-ms delay between commands (as suggested by the LIP documentation), things work as expected.

I haven’t noticed any significant delays (I have both RadioRA2 and a Smart Bridge PRO), but then again I’m not using OH groups.

I wrote a quick-and-dirty Python framework and app to talk with the Smart Bridge PRO over LIP. I’m able to enqueue the sending of

#OUTPUT,2,2
#OUTPUT,4,2
#OUTPUT,9,2
#OUTPUT,10,2

#OUTPUT,2,4
#OUTPUT,4,4
#OUTPUT,9,4
#OUTPUT,10,4

#OUTPUT,2,1,0
#OUTPUT,4,1,0
#OUTPUT,9,1,0
#OUTPUT,10,1,0

in the span of a millisecond to the telnet library, and get back the responses from the bridge, along with believable output levels and prompts starting about 25 ms later, over the span of about 230 ms. I haven’t had that kind of luck with the Lutron binding. Even with a 50 ms or 100 ms delay between sending commands to individual dimmers (not using groups), I get the dreaded “hang” from somewhere.

My next step is to set it up so that the Python code replicates, end-to-end, what openHAB is doing; getting a key-down event and then sending the “start increasing” command to the four dimmers, then getting a corresponding key-up event and then sending the “stop increasing/decreasing” event to see if it is something “inside” the hub or not.

Edit: Initial Python code running now replicating what I was doing in openHAB. Frustrating in two ways:

  • It looks like the Smart Bridge PRO is the source of the “hang”
  • I could write, from scratch, including LIP, in a couple days, what it took over a month of weekends and sporadic evenings to do with openHAB

There definitely are “interleaved” prompts and outputs with a Smart Bridge PRO over telnet and the Lutron binding.

From the “probe-everything” phase of binding start up:

T 2017/03/23 21:24:08.199522 lutron.smartbridge.pro:23 -> server.running.openhab2:45978 [AP]
  ~OUTPUT,27,1,GNET>

2017-03-23 21:24:08.206 [ERROR] [nding.lutron.handler.IPBridgeHandler] - Error processing update
java.lang.NumberFormatException
	at java.math.BigDecimal.<init>(BigDecimal.java:494)[:1.8.0_121]
	at java.math.BigDecimal.<init>(BigDecimal.java:383)[:1.8.0_121]
	at java.math.BigDecimal.<init>(BigDecimal.java:806)[:1.8.0_121]
	at org.openhab.binding.lutron.handler.DimmerHandler.handleUpdate(DimmerHandler.java:112)[214:org.openhab.binding.lutron:2.1.0.201703170534]
	[...]

T 2017/03/23 21:24:08.205307 lutron.smartbridge.pro:23 -> server.running.openhab2:45978 [AP]
  0.00.. 

T 2017/03/23 21:24:08.208480 lutron.smartbridge.pro:23 -> server.running.openhab2:45978 [AP]
  ~OUTPUT,21,1,0.00..

Not clear if this happens during “normal” operation as well. There’s a lot of commands send in the beginning for ~20 dimmers and ~10 keypads

Hi, Allan Tong,
I have the same problem with lutron connect
This is my logs, I tried to update org.openhab.binding.lutron.jar in userdata/tmp/mvn/org/openhab/binding/org.openhab.binding.lutron/ with org.openhab.binding.lutron-2.1.0-SNAPSHOT.jar of you. But I still received this error, Bridge I am using is Ra2. Can you help me to solve this problem, thanks you.

2017-03-26 03:24:21.899 [ERROR] [nding.lutron.handler.IPBridgeHandler] - Communication error, will try to reconnect
java.io.IOException: Could not write to stream
at org.openhab.binding.lutron.internal.net.TelnetSession.writeLine(TelnetSession.java:218)[212:org.openhab.binding.lutron:2.0.0]
at org.openhab.binding.lutron.handler.IPBridgeHandler.sendCommands(IPBridgeHandler.java:198)[212:org.openhab.binding.lutron:2.0.0]
at org.openhab.binding.lutron.handler.IPBridgeHandler.access$2(IPBridgeHandler.java:190)[212:org.openhab.binding.lutron:2.0.0]
at org.openhab.binding.lutron.handler.IPBridgeHandler$3.run(IPBridgeHandler.java:176)[212:org.openhab.binding.lutron:2.0.0]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)[:1.8.0_65]
at java.util.concurrent.FutureTask.run(FutureTask.java:266)[:1.8.0_65]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)[:1.8.0_65]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)[:1.8.0_65]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[:1.8.0_65]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[:1.8.0_65]
at java.lang.Thread.run(Thread.java:745)[:1.8.0_65]
2017-03-26 03:24:21.923 [ERROR] [nding.lutron.handler.IPBridgeHandler] - Error disconnecting
java.net.SocketException: Socket closed
at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:116)[:1.8.0_65]
at java.net.SocketOutputStream.write(SocketOutputStream.java:153)[:1.8.0_65]
at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:82)[:1.8.0_65]
at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:140)[:1.8.0_65]
at java.io.FilterOutputStream.close(FilterOutputStream.java:158)[:1.8.0_65]
at org.apache.commons.net.telnet.TelnetClient._closeOutputStream(TelnetClient.java:86)[175:org.apache.commons.net:3.2.0]
at org.apache.commons.net.telnet.TelnetOutputStream.close(TelnetOutputStream.java:155)[175:org.apache.commons.net:3.2.0]
at org.apache.commons.net.telnet.TelnetClient.disconnect(TelnetClient.java:127)[175:org.apache.commons.net:3.2.0]
at org.openhab.binding.lutron.internal.net.TelnetSession.close(TelnetSession.java:116)[212:org.openhab.binding.lutron:2.0.0]
at org.openhab.binding.lutron.handler.IPBridgeHandler.disconnect(IPBridgeHandler.java:235)[212:org.openhab.binding.lutron:2.0.0]
at org.openhab.binding.lutron.handler.IPBridgeHandler.reconnect(IPBridgeHandler.java:245)[212:org.openhab.binding.lutron:2.0.0]
at org.openhab.binding.lutron.handler.IPBridgeHandler.sendCommands(IPBridgeHandler.java:206)[212:org.openhab.binding.lutron:2.0.0]
at org.openhab.binding.lutron.handler.IPBridgeHandler.access$2(IPBridgeHandler.java:190)[212:org.openhab.binding.lutron:2.0.0]
at org.openhab.binding.lutron.handler.IPBridgeHandler$3.run(IPBridgeHandler.java:176)[212:org.openhab.binding.lutron:2.0.0]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)[:1.8.0_65]
at java.util.concurrent.FutureTask.run(FutureTask.java:266)[:1.8.0_65]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)[:1.8.0_65]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)[:1.8.0_65]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[:1.8.0_65]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[:1.8.0_65]

You’ll need to put the binding jar in the addons/ directory.

Because I am newbie, I thanks you very much.

Looks like a Lutron Smart Bridge PRO is “very unhappy” with commands being sent while a button is down. I’ve seen “hangs” of a fraction of a second up to tens of seconds when either a set-level of begin-fade command is sent. It doesn’t look like an openHAB issue as I’m seeing the same thing with my Python code.

As a related observation, it appears that the Smart Bridge generally takes action on key-up, not key-down.

Hi Allan Tong,
I tried to use binding lutron HomeWorks QS v2( org.openhab.binding.lutron-2.1.0-SNAPSHOT.jar), I saw in log, it get error with reconnect, and 5 minutes it still not reconnect again.
My version openHab of me is 2.0.0. Can you help me to solve this problem.
This is my log:

2017-03-30 01:33:11.351 [ERROR] [nding.lutron.handler.IPBridgeHandler] - Communication error, will try to reconnect
java.io.IOException: Could not write to stream
at org.openhab.binding.lutron.internal.net.TelnetSession.writeLine(TelnetSession.java:234)[283:org.openhab.binding.lutron:2.1.0.201702112004]
at org.openhab.binding.lutron.handler.IPBridgeHandler.sendCommands(IPBridgeHandler.java:206)[283:org.openhab.binding.lutron:2.1.0.201702112004]
at org.openhab.binding.lutron.handler.IPBridgeHandler.access$2(IPBridgeHandler.java:198)[283:org.openhab.binding.lutron:2.1.0.201702112004]
at org.openhab.binding.lutron.handler.IPBridgeHandler$4.run(IPBridgeHandler.java:184)[283:org.openhab.binding.lutron:2.1.0.201702112004]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)[:1.8.0_65]
at java.util.concurrent.FutureTask.run(FutureTask.java:266)[:1.8.0_65]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)[:1.8.0_65]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)[:1.8.0_65]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[:1.8.0_65]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[:1.8.0_65]
at java.lang.Thread.run(Thread.java:745)[:1.8.0_65]
2017-03-30 01:33:11.373 [ERROR] [nding.lutron.handler.IPBridgeHandler] - Error disconnecting
java.net.SocketException: Socket closed
at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:116)[:1.8.0_65]
at java.net.SocketOutputStream.write(SocketOutputStream.java:153)[:1.8.0_65]
at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:82)[:1.8.0_65]
at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:140)[:1.8.0_65]
at java.io.FilterOutputStream.close(FilterOutputStream.java:158)[:1.8.0_65]
at org.apache.commons.net.telnet.TelnetClient._closeOutputStream(TelnetClient.java:86)[175:org.apache.commons.net:3.2.0]
at org.apache.commons.net.telnet.TelnetOutputStream.close(TelnetOutputStream.java:155)[175:org.apache.commons.net:3.2.0]
at org.apache.commons.net.telnet.TelnetClient.disconnect(TelnetClient.java:127)[175:org.apache.commons.net:3.2.0]
at org.openhab.binding.lutron.internal.net.TelnetSession.close(TelnetSession.java:118)[283:org.openhab.binding.lutron:2.1.0.201702112004]
at org.openhab.binding.lutron.handler.IPBridgeHandler.disconnect(IPBridgeHandler.java:243)[283:org.openhab.binding.lutron:2.1.0.201702112004]
at org.openhab.binding.lutron.handler.IPBridgeHandler.reconnect(IPBridgeHandler.java:253)[283:org.openhab.binding.lutron:2.1.0.201702112004]
at org.openhab.binding.lutron.handler.IPBridgeHandler.sendCommands(IPBridgeHandler.java:214)[283:org.openhab.binding.lutron:2.1.0.201702112004]
at org.openhab.binding.lutron.handler.IPBridgeHandler.access$2(IPBridgeHandler.java:198)[283:org.openhab.binding.lutron:2.1.0.201702112004]
at org.openhab.binding.lutron.handler.IPBridgeHandler$4.run(IPBridgeHandler.java:184)[283:org.openhab.binding.lutron:2.1.0.201702112004]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)[:1.8.0_65]
at java.util.concurrent.FutureTask.run(FutureTask.java:266)[:1.8.0_65]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)[:1.8.0_65]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)[:1.8.0_65]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[:1.8.0_65]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[:1.8.0_65]
at java.lang.Thread.run(Thread.java:745)[:1.8.0_65]

Thanks you !

Could someone just post a clear straightforward walk through on getting the Caseta lights to work with this binding? A very clear, concise example?

First, for openHAB, you need a Smart Bridge Pro and not the Smart Bridge that you can pick up at your local big box store. The Pro model is an “installer” version that you’ll need to obtain elsewhere. They are available through other sellers.

There are three protocols that the Smart Bridge Pro “talks”:

The first is the only one available without a reverse-engineered or NDA-encumbered “secure” key as well as with a Lutron-published, public protocol spec. I don’t think anyone would sign-off on allowing that into openHAB.

Only LIP over telnet is fast enough to be considered “real time”. If you have a Smart Bridge Pro, you will need to enable it using the Advanced settings in your smart-phone app.

The following appear to be limitations of the Smart Bridge Pro itself:

  • Events or actions while a button is down can slow response to the 10-15 second range
    • Makes use of the increase/decrease function “impossible” through external control
    • Can result in, for example, a two-second physical press being reported as 1.5 seconds
  • Scenes are not reported as “matching” the way that they are in the smart-phone app
  • The buttons on the dimmers are not reported at all
  • The Pico remotes don’t (natively) report multi-tap, long-press, or multiple press actions
  • Access to the integration report is not possible through LIP

The following are limitations of openHAB that you should be aware of:

  • The scenes are not available
  • The increase/decrease functions are not available
  • You can’t, from what I can tell, change the fade time on an event-by-event basis
  • You can’t, from what I can tell, set the fade delay at all

Once enabled, you’ll need a Thing for the bridge, each dimmer, and each keypad.

Get the integration IDs by generating an “integration report” using the smart-phone app.

Bridge (the angle brackets are notation, not part of the Thing declaration):

lutron:ipbridge:SmartBridgePro "Smart Bridge Pro" @ "Home" [ ipAddress="<IP or hostname>", user="lutron", password="integration" ]

Dimmer:

lutron:dimmer:Bedroom_East_Cans "Bedroom East Cans" (lutron:ipbridge:SmartBridgePro) @ "Bedroom" [ integrationId=2 ]

Pico:

lutron:keypad:Bedroom_One "Bedroom One" (lutron:ipbridge:SmartBridgePro) @ "Bedroom" [ integrationId=3 ]

Each dimmer will need an Item for the level. I’ve included the notation for assigning the dimmer to a couple groups here. The group assignment is optional, but very useful since you can’t control the scenes with openHAB at this time. The notation for creating groups is documented beneath the dimmer.

Dimmer caseta_dimmer_Bedroom_East_Cans
"Dimmer Bedroom East Cans [%.0f]" <dimmablelight>
(
    group_all_dimmers,
    group_Bedroom_dimmers
)
{ channel="lutron:dimmer:Bedroom_East_Cans:lightlevel" }

Creating groups (MAX or another “combinator” is required, contrary to documentation. Issue filed):

Group:Dimmer:MAX group_all_dimmers
Group:Dimmer:MAX group_Bedroom_dimmers

For each Pico you need an Item for each of the five buttons available. Again, I group these for convenience.

Group:Switch:AND(OFF, ON) group_all_picos
Group:Switch:AND(OFF, ON) group_pico_Bedroom_One

Switch pico_Bedroom_One_on
"Pico Bedroom One On" <switch>
(
    group_all_picos,
    group_pico_Bedroom_One
)
{ channel="lutron:keypad:Bedroom_One:button2" }


Switch pico_Bedroom_One_preset
"Pico Bedroom One Preset" <switch>
(
    group_all_picos,
    group_pico_Bedroom_One
)
{ channel="lutron:keypad:Bedroom_One:button3" }


Switch pico_Bedroom_One_off
"Pico Bedroom One Off" <switch>
(
    group_all_picos,
    group_pico_Bedroom_One
)
{ channel="lutron:keypad:Bedroom_One:button4" }


Switch pico_Bedroom_One_up
"Pico Bedroom One Up" <switch>
(
    group_all_picos,
    group_pico_Bedroom_One
)
{ channel="lutron:keypad:Bedroom_One:button5" }


Switch pico_Bedroom_One_down
"Pico Bedroom One Down" <switch>
(
    group_all_picos,
    group_pico_Bedroom_One
)
{ channel="lutron:keypad:Bedroom_One:button6" }

I’ve gotten to the point where the limitations and bugs of openHAB have driven me to manage my Lutron through Python. If openHAB provides access to the scenes, I might come back once the JSR233 rule extension lets me write rules in a meaningful, documented, stable, language. Managing scenes through a set of 20+ Items with both a level and a Boolean for if the dimmer is in the scene, for each scene, isn’t a “design pattern”, it’s a design flaw. My approach, in general is:

  • Use the Lutron app to assign the Picos to the devices they “directly” control for dim-up/down
  • Use scripts to add additional dimmers that should be controlled beyond those groupings, typically by activating a scene
  • Use scripts to detect and take action on long-press and multi-tap events
3 Likes

Thanks for consolidating this information to one place. Really helpful!

@jeffsf

Thanks for putting this together. Really helped me out!

So today I picked up a hub pro with a dimmer and one Pico remote.

What’s great and unexpected is that I now can use feedback from the buttons on Pico remote to control the volume of my Marantz receiver over the gc-100.

This has become a pleasant surprise, as now I have an option for customizable tactile remote control for my integrated equipment around the house. Not just an app on the smartphone.

Looking to start a smarthome from scratch, but everything is either expensive or doesn’t work [well] with OH(2). My father works for a building automation firm that now has a partnership with Lutron, so we’re thinking he should be able to pick up Lutron modules as needed through work, and we can use openHAB to control them somehow since there’s a Lutron binding listed… So I told him to order the Lutron starter kit, which comes with the latest hub.

Obviously I jumped the gun. Reading this tread has made me realize I probably should NOT order that kit, as it doesn’t say “Pro” for the bridge. Further, I’m confused over this whole Caseta and “Ra” thing, which is looking like I should be getting a different bridge entirely if I want to support all/more Lutron devices (who knows what version/protocol they’ll be when he orders them through work)? And even then, it sounds like the pico switches aren’t fully supported, and other basic features are still missing at this point (which is fine, of course, thanks for your work!) so maybe I should not dive into full Lutron mode after all.

Do I have any of this wrong? More importantly, can I control this stuff with some other hub? It looks like, for example, the Wink hub, which has a binding now, “Supports Lutron Clear Connect”. Does this mean I can just use Lutron gear with that for now, and have it all Just Work on openHAB through the hub?

Thanks in advance!