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

dth_lighting
insteon
dth_misc

(Idealerror) #1

**Update 5/15/17: The 2245 hub should be working now with @kuestess modifications. Scroll down to this post: [RELEASE] Insteon Hub 2244 and 2245 Dimmer and On/Off Plugs/Switches/Bulbs **

**Update 12/29/17: Updated to use @kuestess device handler replacing mine.

I know there’s a handful of people out there still utilizing some older Insteon devices.

A few things to note in this device type:

You MUST port forward your hub’s IP (Port 25105) to the internet. You can open 25105 externally or port forward it to whatever port you want, example Source 1234 => Destination 25105

Steps to get setup:

  1. Locate your Insteon’s Hub IP
  2. Login to your router and port forward the Hub IP with port 25105 to whatever port you want, you can use 25105 if you want.
  3. Login to your Insteon App and locate your hub username and password.
  4. Edit each of your devices to locate the device ID
  5. Go to whatismyip.com to locate your public IP address

Now that you have the hub accessible by the internet…

  1. Add the device type in graph.api.smartthings.com by copying the code into the ‘My Device Types’ area
  2. Add a new device with one of the Insteon device types
  3. DeviceID could be your Insteon Device ID (Example: FF1122)
  4. Save the device
  5. After the device has been created, edit the Preferences of the device.
  6. Fill in the hub IP, hub Port, Device ID, hub Username, hub Password
  7. Save it and try turning it off and on with your SmartThings app.

This is a very simple explanation… I’ll re-write this with pictures and further details later.

Dimmer Switch/Plug/Bulb


INSTEON support - trying to start a central thread for request
(Richard G) #2

This is GREAT!

Any chance you can explain how the third-party server works, and any ability to host our own service too handle this?

Are you thinking of tackling the Insteon 6 or 8 button switches?

As i understand only the “load” button is exposed in the api, the rest only work directly on the hub.


(Idealerror) #3

This is what the 3rd party server does:

When pulling Insteon device statistics, you have to make a call out to the Hub via /sx.xml?DEVICE=1900 . This will spit back an XML output that may look like this:

<Xs>
<X D=“DEVICE250070”/>
</Xs>

SmartThings does not like this output. It does not parse it as traditional XML. The server will take that output and transform it into JSON for ST to read. The output looks like this:

{"num":0,"percent":0,"deviceid":"DEVICE","status":"off"}

I’ll upload the PHP script that does this if anyone wants to host it themselves and utilize it. They can just replace the st.idealerror.com with their own URL.

Insteon 6 or 8 button switches is not necessarily possible to duplicate because it sends a call directly to Insteon. That call is not parseable as far as I know. If you’ve ever logged into http://connect.insteon.com . Anything that can be done through that portal can be duplicated into ST.

PHP Script for 3rd party server:


(Richard G) #4

If I wanted to host this on a local server, how would I go about doing this? I have a Plex server that has a ton of unused memory and processing power


(Michael Hess) #5

I’m assuming he’s taking a web call to an apache site, then it calls the script and returns the json.

In the DHT’s code we see this:

http://st.idealerror.com/?url=http://${settings.username}:${settings.password}@${settings.host}:${settings.port}/sx.xml?${settings.deviceid}=1900

So you need apache running on your server, then this script is called when this url is requested of the server.

So @idealerror, for those of use that know enough to get in trouble…what’s the html page you have calling this script and returning the data? And can we access it locally so we don’t have to poke a hole in our firewall?


(Idealerror) #6

Check out the PHP script in my previous post. The URL data you posted is what’s sent to the script.


(Michael Hess) #7

That part I figured, but I don’t know the next step. You need to have Apache call the script to return something right?


(Idealerror) #8

Yes sir.

ST calls the PHP script with a specific URL… the PHP script calls the hub directly using that URL. That URL will query the hub and pull an xml file. The PHP will parse the XML and turn it into a JSON file. ST reads the json file and updates the switch status.

You technically could remove this part and use ST exclusively to perform the on/off/dim. You just can’t see if someone turns the switch off manually.


(Richard G) #9

I am noticing that my dimmers are returning 8% instead of off. Is this normal?


(Idealerror) #10

Are they off or at 8%? Try hitting the refresh tile on the dimmer. That will pull the value that insteon thinks it is.


(Michael Hess) #11

I’m not much of a web dev so pardon my ignorance! :slight_smile:

I did get it working:

  1. Had to put the php script in var/www/html as index.php, changed apache’s file pref to php before html. (Didn’t know I could do this, was my “missing step”)

  2. Changed the DHT code to my domain, line 165: uri: “https://www.xxxxxxxxxxxxxxx.net/?url=http://${settings.username}:${settings.password}@${settings.host}:${settings.port}/sx.xml?${settings.deviceid}=1900

  3. Forwarded the Insteon Hub port 25105 to my Insteon Hub.

  4. Configured a new device in IDE, set options and it worked. Dimming is very quick!

So my only concern is not having SSL for the actual on/off commands. Since Insteon’s URL builder doesn’t list it as an option I assume they do not support this?

Thank you @idealerror for this code, I’m hoping it will be more reliable than the API key code I’ve been using from @hypermoose. Not his codes issue, but the way the API is used with Insteon, I’d have to occasionally “Update” the SA in the IDE to get it linked back up.

I’m going to move all my lights to this and see how it goes. I like having local control (sorta) back.

One thing I noticed. Setting the light to say 20% at the wall, hitting refresh doesn’t update the ST device. Should it?


(Richard G) #12

I have manually turned them off in the app. I then hut refresh and they are at 8%.

Also tried at the switch.


(Idealerror) #13

Which device are you using exactly? Is it the wall dimmer switch? I’ve never seen that happen before.


(Idealerror) #14

Hey good job getting everything up and working :). Sorry I wasn’t more descriptive, I was writing most of my replies from mobile. Thanks for the explanation for the masses!

Unfortunately, the hub does not support SSL.

Setting the light to 20% at the wall and hitting refresh should update ST. If you setup your own PHP script on your own web server to poll the status of the device, you may want to make sure that piece is working. It sounds like you got the device type working, but I think you may have an issue with your device status piece with the PHP.


(Michael Hess) #15

Oh, so I may not be at 100%…I’ll look into it, thanks!


(Michael Hess) #16

I’m getting this:

cf8b368a-d9e9-400f-a93f-bcf8703b1b42  11:06:43 AM: error something went wrong: groovyx.net.http.HttpResponseException: Internal Server Error
cf8b368a-d9e9-400f-a93f-bcf8703b1b42  11:06:42 AM: debug Polling..

When I send a request directly like:

https://www.xxxxxxxx.net/?url=http://$xxxxxxx:$xxxxxxx@$www.xxxxxxxx.net:$25105/sx.xml?$30a0d6=1900

My server returns this:

The www.xxxxxxxx.net page isn’t working

www.xxxxxxxxxxx.net is currently unable to handle this request.
HTTP ERROR 500

Any thoughts on where to begin? Is there a simple url I can use to test the PHP?

When I go to the address the PHP script fires from with no data I get:

Error: Cannot create object


(Richard G) #17

Its a dimmer switch… it doesnt harm the functionality.

Just the visuals


(Idealerror) #18

Check your apache logs, there’s probably a PHP error.

The script replies with “Error: Cannot create object” if you do not specify a ?url=


(Idealerror) #19

Let me see if I can replicate it.


(Idealerror) #20

I did some research with @michaelahess and we figured out the hub running the latest firmware is spitting out 8% for ON and OFF.

Doing some research on this so I can get that patched.