Insteon Local Control!

Patrick:

I had a thought about a quik polling hack that might that I might try out when I have some time.

In the poll method:

  1. Temporarily set the deviceNetworkID to the hosthex:porthex
  2. Poll the device
  3. Parse the response
  4. Set the deviceNetworkID back to the IntesonID

If polls run synchronously then I should be able to poll each Insteon switch.

This sounds pretty interesting. Sounds more like proper integration of insteon into the smartthings network. Do you have any more information on how this is working?

HI -

Long time lurker, first time poster.

I am one of those still on the Revolv and am wanting to move on.

I have been following the various Insteon threads. I am ready to take the plunge (I think).

As someone with ZERO coding experience how difficult would you rate integrating an insteon hub or PLM into ST?

Is there a benefit of using one over the other?

Lastly… the WAF, have we seen any issues where a ST update breaks the work you all have done.

I am a pilot and I fear calls like “it stopped working”

Sometimes I wonder if it would just be less headache to replace the 6 switches I have but the Zwave switches don’t pass wife approval or are so much more expensive.

I have modified the original code. I need some help. X-10 takes two commands. One to say what unit you want to control (a5) and a second to tell it on/off. I have it coded but it does not work. I am not a coder, and would like to know how to make smartthings wait one second between sending the two commands. How can I upload what I have done or can anyone just give me a line of code to copy and paste for a one second delay.

def path = "http://" + "${InsteonIP}" + "/3?0263" + "${HouseCode}" + "${InsteonID}"  + "=I=3" +(NEED A ONE SEC PAUSE HERE) + " http://" + "${InsteonIP}" + "/3?0263" + "${HouseCode}" + "380" + "=I=3"

might check here

thanks, but honestly have no idea what I am looking at or for… still need groovy code for 1 sec pause

there really isn’t a good reliable method for pausing for exactly one second. The nature of local hub actions are async and typically have a request and response.

You really want raw tcp socket connection if you want to do what you are trying to do. No good solution with ST on the horizon.

1 Like

I have just ordered my ST Hub and it’s in transit. I am really happy that you guys have taken all the time to get this together because I have an Insteon Hub, 2 Insteon switches and 10 X10 switches.

With regards to the need to have a delay in the X10 code, I wanted to suggest that a way to pause may be to put in dummy commands to the Insteon Hub, or even to a dummy Insteon Hub. Those requests would take up time. Would need to be tested for sure. Who knows what would happen to the last command with those dummy requests in the middle.

I plan to replace all of my X10 controllers but I need to do it slowly due cost.

A question - how does the X10 dimming seem to work. I know that even with my Insteon to X10 setup now it’s almost non-existent. It seems that every DIM command on X10 only dims by 1%. I did try this long enough one time to see a change in the output but it’s not usable.

Thanks again for the work. I will be able to test and help once my device arrives this week.

ST Hub has arrived. I am going to concentrate on getting it setup with my one compatible bulb tonight, then move into Insteon and then X10.

Excited to get going on this project.

Patrick, it does not need to be exactly 1 sec, it could be 1/2 a sec or even .94875 of a second. Just pause between commands.

Hi creed, you sound like me, zwave, insteon and x-10. I can not answer your question on x10 dimming, do not use it. I use x10 for 2 things. One turn on whole house fan, soon to be zwave. the second is to turn on high power amps for home theater. I use commercial amps not consumer amps so they do not have a “sense” like consumer stuff does, they are either on or off. So i leave the switch on and use an x10 appliance controller.
Here is a copy of the code so far for the x-10 control, remember does not work… just yet!

/**

  • Insteon Switch X-10 edit (LOCAL)
  • Copyright 2014 patrick@patrickstuart.com
  • Updated 1/4/15 by goldmichael@gmail.com
  • X-10 edit 1/20/2015 by brianjhagopian@gmail.com
  • Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except
  • in compliance with the License. You may obtain a copy of the License at:
  •  http://www.apache.org/licenses/LICENSE-2.0
    
  • Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
  • on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License
  • for the specific language governing permissions and limitations under the License.

*Insteon Switch X-10 edit (LOCAL) Added line 51(29), changed line 50(28), changed line 84(61), changed line 113(90). editnewline(oldlineoriginalcode)
*

  • Unit Code Value House Code Value Command Value
  •     	1	600					A			6				On			280
    
  •  	2	E00					B			E				Off			380
    
  •  	3	200					C			2				Bright		580
    
  •  	4	A00					D			A				Dim			480
    
  •  	5	100					E			1				All On		180
    
  •  	6	900					F			9				All Off		680
    
  •  	7	500					G			5
    
  •  	8	D00					H			D
    
  •  	9	700					I			7
    
  •  	10	F00					J			F
    
  •  	11	300					K			3
    
  •  	12	B00					L			B
    
  •  	13	000					M			0
    
  •  	14	800					N			8
    
  •  	15	400					O			4
    
  •  	16	C00					P			C
    
  • Source:http://www.leftovercode.info/smartlinc_x10.html

*/
metadata {
definition (name: “Insteon Switch X-10 edit(LOCAL)”, namespace: “michaelgold”, author: "patrick@patrickstuart.com/tslagle13@gmail.com/goldmichael@gmail.com") {
capability "Switch"
capability "Sensor"
capability “Actuator”

}

preferences {
input("InsteonIP", "string", title:"Insteon IP Address", description: "Please enter your Insteon Hub IP Address", defaultValue: "192.168.1.2", required: true, displayDuringSetup: true)
input("InsteonPort", "string", title:"Insteon Port", description: "Please enter your Insteon Hub Port", defaultValue: 25105, required: true, displayDuringSetup: true)
input("InsteonID", "string", title:"Device Insteon ID", description: "Please enter the devices X-10 - numbers only", defaultValue: "660", required: true, displayDuringSetup: true)
input("HouseCode", "string", title:"X-10 House Code", description: "Please enter X-10 house code- numbers only", defaultValue: "6", required: true, displayDuringSetup: true)
input("InsteonHubUsername", "string", title:"Insteon Hub Username", description: "Please enter your Insteon Hub Username", defaultValue: "michael" , required: true, displayDuringSetup: true)
input("InsteonHubPassword", "string", title:"Insteon Hub Password", description: "Please enter your Insteon Hub Password", defaultValue: "password" , required: true, displayDuringSetup: true)

}

simulator {
	// status messages
	status "on": "on/off: 1"
	status "off": "on/off: 0"

	// reply messages
	reply "zcl on-off on": "on/off: 1"
	reply "zcl on-off off": "on/off: 0"
}

// UI tile definitions
tiles {
	standardTile("switch", "device.switch", width: 2, height: 2, canChangeIcon: true) {
		state "off", label: '${name}', action: "switch.on", icon: "st.switches.switch.off", backgroundColor: "#ffffff"
		state "on", label: '${name}', action: "switch.off", icon: "st.switches.switch.on", backgroundColor: "#79b821"
	}

	main "switch"
	details "switch"
}

}

// handle commands
def on() {
//log.debug "Executing ‘take’"
sendEvent(name: “switch”, value: “on”)
def host = InsteonIP

def path = "http://" + "${InsteonIP}" + "/3?0263" + "${HouseCode}" + "${InsteonID}" + "=I=3" + " http://" + "${InsteonIP}" + "/3?0263" + "${HouseCode}" + "280" + "=I=3"
log.debug "path is: $path"

	
def userpassascii = "${InsteonHubUsername}:${InsteonHubPassword}"
def userpass = "Basic " + userpassascii.encodeAsBase64().toString()
def headers = [:] //"HOST:" 
headers.put("HOST", "$host:$InsteonPort")
headers.put("Authorization", userpass)


try {
def hubAction = new physicalgraph.device.HubAction(
	method: method,
	path: path,
	headers: headers
    )  
}
catch (Exception e) {
log.debug "Hit Exception on $hubAction"
log.debug e
}

}

def off() {
//log.debug "Executing ‘take’"
sendEvent(name: “switch”, value: “off”)
def host = InsteonIP

def path = "http://" + "${InsteonIP}" + "/3?0263" + "${HouseCode}" + "${InsteonID}"  + "=I=3" + " http://" + "${InsteonIP}" + "/3?0263" + "${HouseCode}" + "380" + "=I=3"
log.debug "path is: $path"


def userpassascii = "${InsteonHubUsername}:${InsteonHubPassword}"
def userpass = "Basic " + userpassascii.encodeAsBase64().toString()
def headers = [:] //"HOST:" 
headers.put("HOST", "$host:$InsteonPort")
headers.put("Authorization", userpass)

try {
def hubAction = new physicalgraph.device.HubAction(
	method: method,
	path: path,
	headers: headers
    )
}
catch (Exception e) {
	log.debug "Hit Exception on $hubAction"
	log.debug e
}

}

Okay - this looks really good. I am not sure that you need a delay in between the HTTP calls as much as you need to separate them. This is what I am not sure how to do with this code. I am just going from basic logic here.

I look at line 84 and I see that the 2 calls are being defined on the same line. It would seem to me that when executed they are being done at the exact same time in that case.

If you were to make a separate def and then a separate line to execute the command, would that work?

I wish I had more groovy programming knowledge. I think we can get this working!

-Marcus

Does this work with the insteon hub 2245-222 ?
It’s on sale now for $39.99

That is the insteon hub I have and the insteon control works perfect, the x-10 through that hub does not.

So I was also able to get Insteon to work quite well through the hub. I have seen a few issues with it ‘missing’ the command but I doubt I am going to keep my 2 Insteon devices for much longer.

All my X10’s came out of the house last weekend. I decided to go that route because they weren’t 100% with just the Insteon Hub -> X10 so rather than jam a triangular peg in a round hole that had a square peg in it… they are gone.

Thanks for the great work guys., Having switch from Insteon to the SmartThings hub I was excited to see the insteon integration , Is there a tutorial on how the add these to my SmartThings menu, I did go in and add the code with the My Device types successfully but still fuzzy on how to get it to my menu on the android app…

Thanks for the help Really liking the SmartThings so far…

I’m not able to get it to control one switch I configured. I fixed my IP address on the insteon hub and checked the user name and password on the mobile app. Still no control. I can control with App.
Help appreciated.

Hi Brian.
Did you ever get x10 code working with Insteon Hub ? I have the standard Insteon integration functioning without issues, but the X10 is not working via ST. (X10 works without issue through Insteon App direct)

No, I did not. I kept trying and I am no programmer. Here is the code with notes that I edited and that does not work. If someone want to mess with, go ahead!

indent preformatted text by 4 spaces
/**
  • Insteon Switch X-10 edit (LOCAL)
  • Copyright 2014 patrick@patrickstuart.com
  • Updated 1/4/15 by goldmichael@gmail.com
  • Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except
  • in compliance with the License. You may obtain a copy of the License at:
  •  http://www.apache.org/licenses/LICENSE-2.0
    
  • Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
  • on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License
  • for the specific language governing permissions and limitations under the License.

*Insteon Switch X-10 edit (LOCAL) Added line 51(29), changed line 50(28), changed line 84(61), changed line 113(90). editnewline(oldlineoriginalcode)
*

  • Unit Code Value House Code Value Command Value
  •     	1	600					A			6				On			280
    
  •  	2	E00					B			E				Off			380
    
  •  	3	200					C			2				Bright		580
    
  •  	4	A00					D			A				Dim			480
    
  •  	5	100					E			1				All On		180
    
  •  	6	900					F			9				All Off		680
    
  •  	7	500					G			5
    
  •  	8	D00					H			D
    
  •  	9	700					I			7
    
  •  	10	F00					J			F
    
  •  	11	300					K			3
    
  •  	12	B00					L			B
    
  •  	13	000					M			0
    
  •  	14	800					N			8
    
  •  	15	400					O			4
    
  •  	16	C00					P			C
    
  • Source:http://www.leftovercode.info/smartlinc_x10.html

*/
metadata {
definition (name: “Insteon Switch X-10 edit(LOCAL)”, namespace: “michaelgold”, author: "patrick@patrickstuart.com/tslagle13@gmail.com/goldmichael@gmail.com") {
capability "Switch"
capability "Sensor"
capability “Actuator”

}

preferences {
input("InsteonIP", "string", title:"Insteon IP Address", description: "Please enter your Insteon Hub IP Address", defaultValue: "192.168.1.2", required: true, displayDuringSetup: true)
input("InsteonPort", "string", title:"Insteon Port", description: "Please enter your Insteon Hub Port", defaultValue: 25105, required: true, displayDuringSetup: true)
input("InsteonID", "string", title:"Device Insteon ID", description: "Please enter the devices X-10 - numbers only", defaultValue: "660", required: true, displayDuringSetup: true)
input("HouseCode", "string", title:"X-10 House Code", description: "Please enter X-10 house code- numbers only", defaultValue: "6", required: true, displayDuringSetup: true)
input("InsteonHubUsername", "string", title:"Insteon Hub Username", description: "Please enter your Insteon Hub Username", defaultValue: "michael" , required: true, displayDuringSetup: true)
input("InsteonHubPassword", "string", title:"Insteon Hub Password", description: "Please enter your Insteon Hub Password", defaultValue: "password" , required: true, displayDuringSetup: true)

}

simulator {
	// status messages
	status "on": "on/off: 1"
	status "off": "on/off: 0"

	// reply messages
	reply "zcl on-off on": "on/off: 1"
	reply "zcl on-off off": "on/off: 0"
}

// UI tile definitions
tiles {
	standardTile("switch", "device.switch", width: 2, height: 2, canChangeIcon: true) {
		state "off", label: '${name}', action: "switch.on", icon: "st.switches.switch.off", backgroundColor: "#ffffff"
		state "on", label: '${name}', action: "switch.off", icon: "st.switches.switch.on", backgroundColor: "#79b821"
	}

	main "switch"
	details "switch"
}

}

// handle commands
def on() {
//log.debug "Executing ‘take’"
sendEvent(name: “switch”, value: “on”)
def host = InsteonIP

def path = "http://" + "${InsteonIP}" + "/3?0263" + "${HouseCode}" + "${InsteonID}" + "=I=3" + " http://" + "${InsteonIP}" + "/3?0263" + "${HouseCode}" + "280" + "=I=3"
log.debug "path is: $path"

	
def userpassascii = "${InsteonHubUsername}:${InsteonHubPassword}"
def userpass = "Basic " + userpassascii.encodeAsBase64().toString()
def headers = [:] //"HOST:" 
headers.put("HOST", "$host:$InsteonPort")
headers.put("Authorization", userpass)


try {
def hubAction = new physicalgraph.device.HubAction(
	method: method,
	path: path,
	headers: headers
    )  
}
catch (Exception e) {
log.debug "Hit Exception on $hubAction"
log.debug e
}

}

def off() {
//log.debug "Executing ‘take’"
sendEvent(name: “switch”, value: “off”)
def host = InsteonIP

def path = "http://" + "${InsteonIP}" + "/3?0263" + "${HouseCode}" + "${InsteonID}"  + "=I=3" + " http://" + "${InsteonIP}" + "/3?0263" + "${HouseCode}" + "380" + "=I=3"
log.debug "path is: $path"


def userpassascii = "${InsteonHubUsername}:${InsteonHubPassword}"
def userpass = "Basic " + userpassascii.encodeAsBase64().toString()
def headers = [:] //"HOST:" 
headers.put("HOST", "$host:$InsteonPort")
headers.put("Authorization", userpass)

try {
def hubAction = new physicalgraph.device.HubAction(
	method: method,
	path: path,
	headers: headers
    )
}
catch (Exception e) {
	log.debug "Hit Exception on $hubAction"
	log.debug e
}

}

Is there anything that can be done to change the code from a standard on off switch to a dimmable switch?

It’s not possible without some sort of intermediate bridge - ie a webservice that’s hosted on a device that can talk to usb. I’ve got demos working but no time yet to complete. Basically I have a webservice running on a pi that’s connected to the PLC. I have smartthings app that can talk to the webservice api and the api can talk back to ST. It’s not ideal, but proof of concept is promising.

1 Like