[OBSOLETE] Insteon Hub 2244 and 2245 Dimmer and On/Off Plugs/Switches/Bulbs

SmartThings can take care of all of your Insteon devices as well as your Nest Protect all from one GUI. :slight_smile:

You can use the “Smart Lighting” app to automate your Insteon lights through SmartThings easily. If you want to get crazy, you can download CoRE (Community Rule Engine) and get super granular with your setup, including “If Nest Protect detects smoke, turn all my insteon switches on” etc.

Yah, starting to explore an this is all looking good.

One question I have is do I need the smartthings hub? I originally thought yes but the deeper I get I haven’t run into anything I need it for yet.

What might I need it for if anything?

You need a SmartThings hub to communicate with all of your devices over various protocols (Wifi, Z-Wave, Zigbee, etc.)

Typically you would have a SmartThings hub to talk to all your newer devices over the various protocols listed above, and your legacy stuff would also work with these custom device types and would be a seamless network of integrated devices.

Great, well getting back on topic, I’m getting all my devices added.

Out of curiosity, why the need to add the static hub info (address, port, user/pass) on each device? Could I modify the code in my device handler to hard code that info so I don’t need to add it for each device?

It’s just the way the app was built. Quick and dirty. If you really want to dig into the code, more power to you.

Theoretically we could build a parent device handler with child devices but it would take longer to build and I was originally just looking for a quick way to make my insteon devices work.

Got it.

So I’ve got all my devices added now and controlling them seems to work fine. (Seems to cause I’m at work but I think the lights are going on/off at home :slight_smile: )

The light status doesn’t appear to be working all the time though, as others have indicated.

Of the 5 devices I have added, when I turn them all on and the polling refreshes the status 2/5 of them report back that they’re on on the others report that they’re still off. (Turning them On in the app, reports them as ON, then back off on the next refresh.)

I know there used to be a way to query individual light status on the old hub but it appears that same method doesn’t work on the new one.

I’m not super familiar with your method of determining on and off in your code you seem to be parsing and mapping the buffstatus.xml for a light?) but is there any way I could help you figure out a fix?

@benjgott Yep, you got it - you send a command to the Hub to request the status of a device. The Hub then writes the device ID and status (along with a lot of other stuff) to buffstatus.xml. The problem is that as soon as another device requests status, the buffer (buffstatus.xml) gets overwritten. Sometimes you can even catch ‘overlapping’ buffers. So
if you have a lot of devices, it may be more difficult to reliably get status. Unfortunately, this is a limitation of the Hub and I don’t know that there’s a way around it. Maybe someone more creative can come up with a better way of getting status for multiple devices. I was lucky enough to get an API key and found another smart app on here that works pretty well, but I don’t think that Insteon is quite as generous with developer keys anymore. I would prefer to have local control anyway, and not rely on a could solution.

What’s the app you found that works?

I’m pretty sure I have API access as well from a few months back when I was toying around with some ifttt applets.

@benjgott The original smart app and DTH was done by @hypermoose (can’t find the original thread). It only supported switches, so I updated it to support dimmers. There was also a bug in the status polling that caused it to quit that I fixed. I’ve uploaded the smartapp and DTH here:

1 Like

Sweet, thanks, you’ve been a huge help!

I actually came across hypermoose’s old thread yesterday after you mentioned the other project, got it working with my switches and then spent the better part of the afternoon mucking with the code to get dimmer support added for myself but had some issue with my code that I hadn’t figured out yet.

Just added your code and everything seems to be working so you’ve saved me the time and energy to get mine working. (At some point I’ll compare your modifications to the ones I made to see where I went wrong.)

Any future modifications or additions to these apps/handlers you have in mind? I’d be happy to collaborate or help out if you’re interested.

Thanks again!

1 Like

@benjgott I haven’t had much time lately to mess with it, but you may have noticed that I started to add IOLincs into the code. I at least was able to get them discovered during the initial setup, but didn’t get much further than that. Happy to collaborate on any updates/features!

I finally got around to updating the Hypermoose dht and sa to your modified versions. They work, but when I set to “runEvery1Minute” it stops updating. Is there something in the Insteon API that prevents more often updates? Line 338 was all that I changed. Manual refresh works great though.

@michaelahess Status updates using the Insteon API are a two-step process. First, you request a link ID for the specific device that you want to get the status of. You make a second request using the link ID to get the actual device status. The link ID (from the first request) also has an associated status, either ‘pending’ or ‘succeeded’. By default the initial link status is pending and you need to make requests until the status is succeeded, at which point the returned message contains the actual device status. The ‘pollChildren’ function requests the link ID and then 60 seconds later checks the status of the link ID (via ‘checkPendingRequests’). Without actually trying it myself, my guess is that because you are running ‘pollChildren’ every minute you are never getting the actual device status back before you run another poll. You might try increasing the time between polls (line 338) or decreasing the delay before it requests the link status (lines 403 and 474). In reality, it doesn’t take 60 seconds for the link status to change to ‘succeeded’ so you should be ok with something shorter.

1 Like

I edited that, but now manual refreshes don’t work at all. I’ve published the original SA you posted and it’s acting fine, but the device’s keep erroring like this when a poll or refresh takes place:

8c9cdc2b-831b-4437-9969-6e49460b4487  9:08:17 PM: error groovy.lang.MissingMethodException: No signature of method: script14963507835551845807638.generateEvent() is applicable for argument types: (java.lang.String) values: [{level: 0}]
Possible solutions: generateEvent(java.util.Map), createEvent(java.util.Map) @ line 496

I see that line is what receives the status from the parent app, I think. My networkid matches, nothing seems to have changed there. Any thoughts on what I broke?

Hi there. Great that you fixed the bugs. What was the core issue if you dont mind my asking I saw you changed one of the retry variables to create a new scope and commented out an if, but wasnt sure where it went wrong. thanks

@hypermoose First, let me say thanks for putting together the smart app - works very well and certainly not something that I could have done myself! I think that the key change to the smart app was commenting out the test to see if pollData was null. Its been a while since I debugged it, but after the first poll, pollData was never null so it never requested status from Insteon beyond the first update. Removing that test seemed to make everything work. The only other changes were to add dimming capability and reporting of level. I attempted to add IOLinc support as well, but couldn’t get the discovery to work properly.

I have edited the DTH the Skuestess posted to create a Fan-Linc controller.

The fan state is often slow to update, but it works.

Please feel free to clean it up and modify to suit your needs. If there are improvements, I would love to hear about them.

https://github.com/trussmky/My_S-Things/blob/master/devicetypes/superuser/insteon-fan-linc-fan-hub-2254.src/insteon-fan-linc-fan-hub-2254.groovy

Hi all, I’ve updated the Insteon Connect smartapp to support IOLinc devices as well as scenes. In addition, I reworked the status polling code so that its a little more robust. One thing to note with this release is that the code no longer assumes that the device went to the commanded state. It will now update the status on the next poll. The mechanism for status update was probably just fine for lights, but adding IOLincs (used with a garage door) requires positive confirmation that the door went to the commanded state. If you want immediate updates to the commanded state, you can just uncomment lines within the ‘switchOn’ or ‘switchOff’ commands (I didn’t change the level command as it isn’t used by IOLincs). Scenes are on/off only, and the API doesn’t provide any way of getting status, so for now its simply a toggle. Dimming of scenes doesn’t work (yet). @michaelahess this update should solve the problem you had with polling every minute. Took a bit to figure out, but I think its fixed now.

2 Likes

I have the 2245-222 hub and have tried installing the smartapp. I pushed the smartapp to my device and the three device handlers. When I added the smartapp to my SmartThings app, the app just shows a spinning progress bar that spins endlessly. I let it spin once for over 20 minutes and it never did anything. Eventually I quit the SmartThings app itself and when I reopen, it shows that the Insteon (Connect) app is installed, but when I click on it, it spins for a second and then goes back to the main smartapps page
 Has anyone else had any issues installing this?

What errors are you seeing in the log? Did you enable Oauth?