Open rstrazz opened 8 years ago
I'm transitioning away from Insteon so I hadn't tried it before, but I got a chance to try it this morning and the same thing happens here. The SmartThings API doesn't handle single network addresses (the ISY-994i's) with multiple devices behind them very well, and unfortunately the workarounds mean you have to reinstall everything to add devices.
Oh man I'm bummed that you are going away from Insteon! This open source project you wrote is saving me $1k+ in replacing fans, lights etc throughout my house. Do you think with some coding love it's at least possible to re-pull up that screen in Smartthings and have it refresh the device list and checkmark the lights, etc? As long as you think it's in the cards I can either try to find someone to code it or take a swing myself. If you think it's totally impossible then maybe I won't try...
The shortcoming in the SmartThings API was that traffic from a particular network address (e.g. the ISY's) would always go to a single device, even if there were multiple devices behind that address. The device list screen only works when the ISY's address is not registered to any devices. So, you could try temporarily renaming the device that has the ISY's address to something else.
If you go to https://graph.api.smartthings.com/device/list, you'll see all your Insteon devices that have been configured, and most will have a device network ID consisting of 12 hex characters, a colon, and then the Insteon address. For instance:
0123456789ab:cd ef 01 1
One of them won't have the colon or the Insteon address after it. This receives all the traffic from the ISY. If you edit that device and change the device network ID to something else, you should at least be able to see the complete device list from the ISY-994i again (go to My Home => SmartApps => ISY Connect - don't try to install a second copy of ISY Connect otherwise querying on/off status won't work).
This might let you install more devices, but I haven't tried it, so it may also mess things up and you'll have to remove ISY and reinstall it again. If you decide to edit the code and have any questions, let me know and I can try to answer them.
What I did to get around the issue of getting all the devices back to the SmartApp to add additional devices was to add a state variable to the "primary device" (address w/o insteon address) then in the smart app rather than picking up the devices in the location handler I pickup the devices from the "primary app".
@bytemaster-0xff I like your approach - sounds like an elegant solution. So did you have the parse function in the device type call the parent's locationHandler when the state variable was set, and then clear the state variable when configuration was complete?
@rllynch Here is the chunk of code I use to populate the lists on the primary page, if there isn't a primary devices as a child (deviceNetworkId == dni) then I assume the location handler in the smart app just parses and populates the current and allNodes. This code is in the SmartApp, all the different device handlers need to know that when they receive a list of nodes to parse and set a state variable that the Smart App can pickup
def d
d = getChildDevices()?.find {
it.device.deviceNetworkId == dni
}
if(d == null){
log.debug "No matching children"
}
else {
log.debug "CURRENT NODES: " + d.state.currentNodes;
state.currentNodes = d.state.currentNodes;
state.allNodes = d.state.allNodes
}
Thanks for the elegant solution @bytemaster-0xff
Could you give a little more context on how to add this to my custom app? I'm not familiar with Groovy and am having a hard time understanding where I should insert your code snippet.
I would like some additional info on this change as well if that isnt to much trouble. I have the same issue where I am unable to edit the devices after the fact and deleting and recreating each time is painful. Also would this same change also fix the Smattthings App status? If I use the switch paddle to change the state it takes a really long time for the update to be reflected I the app if at all?
I can't help with the code as I haven't tried it. I don't add insteon devices anymore but the one time I did rebuild it was quite painful so I would love to see this fixed.
As for the state changes you have to rememeber there is no way to push that update. You have to setup an app like pollster or use CORE to "refresh" the devices. You just need to refresh one and it will go out and poll all the devices and the status is updated. I am using pollster with an external call from google code that refreshes it ever 3 minutes.
I was having trouble getting it to refresh the list of light switches in the ISY and ended up having to remove the ISY completely from Smartthings and re-add the ISY as a new device. It could just be me.... what steps do you take when you want to re-update the list of light switches?
Example: After adding the ISY to Smartthings, I installed new light switches in the ISY and I want the new switches to show up in Smartthings.