Are you sure that ‘home’ is in the Hub field and not the location field? My biggest trouble was solved by getting the device fields filled in properly.
[quote=“JamesH, post:20, topic:4969”]
do you expect it to be set by the device code?[/quote]
The device code does set it, but I just wanted to make sure it was setting it correctly.
Both the location and hub field say ‘home’ – my hub is called ‘home’. The forum won’t let me post a picture, so here’s the device info from the ‘my devices’ page:
Raspberry Pi Device Raspberry Pi
Name Raspberry Pi
Label Raspberry Pi
Type Raspberry Pi
Version Published
Device Network Id 0A0001E1:1F40
Status INACTIVE
Hub Home
Last Activity At 2014-11-12 3:45 PM UTC
Date Created 2014-11-12 5:57 AM UTC
Last Updated 2014-11-12 6:19 AM UTC
Data No data found for device
Current States switch: off
Preferences (edit) IP Address: 10.0.1.225
Port: 8000
Username: webiopi
Password: webiopi
Events List Events
In Use By SmartApps SM for RPi
Thanks.
Ah, OK – then I guess I should unset it, and see if the code will actually set it.
So I removed the device, and re-installed it. After running the code (pressing ‘refresh’), the deviceNetworkId doesn’t show up in the Devices page on the IDE.
And just to be extra-sure…
private setDeviceNetworkId(ip,port){
def iphex = convertIPtoHex(ip)
def porthex = convertPortToHex(port)
def dni = "${iphex}:${porthex}"
device.deviceNetworkId = dni
log.debug "Device Network Id set to $dni"
}
And the code gets run:
12:45:16 PM PST: debug Device Network Id set to 0a0001e1:1f40
12:45:16 PM PST: debug Executing ‘refresh’
I’m not sure what else it could be. I know that @scottinpollock had issues encoding his port number in order to send the command correctly. Other than that, I don’t know what else to try.
I’ve seen a few other posts about problems with leading zeroes, but that doesn’t seem to be the problem here. Since I can use wireshark to monitor the traffic to/from the hub, I changed the IP to a 192.168.x.x address, but still no packets.
@RobM – yes, the service is running on the Pi, I can verify that it responds by sending the POST request with telnet from a mac (see higher up in the thread).
@JamesH - I have Firmware Version 000.011.00603 which appears to be the same @NickW.
Maybe that is the issue, and doesn’t seem like a risk to try. Good Luck and let us know.
The hub had not updated from 000.010.00246, as shown in the ‘My Hubs’ page of the IDE.
When I attempted to update from the iOS app, it said 'your hub is up to date’
After turning on the extra logging events under Support->Help Us Debug, I saw at least one failed firmware update
Contacted support, they pushed an update to:
Firmware Version 000.011.00705
They also asked me to power cycle the hub, and force-quit iOS app
Deleted the existing Device and Device Type, went through the setup again
BTW, it seems that the device loses the config input via the app on the initial setup (install)
so you have to re-do it via preferences (update)
but setting the preferences directly from the IDE works
Refresh -> ‘an unexpected error occurred’
Set Device Network Id manually via the IDE, to 0a0001e2:1f40
Refresh -> worked … success!
So now, being such an engineer, I decided to do it all over again to get the exact steps to post. And now it doesn’t work any more.
The POST request gets sent to the Pi, the Pi responds, but the ‘parse’ function is never called in the device handler.
OK – back working again. I deleted the ‘Device’ and ‘Device Type’ entries again, and re-created. This time however, I moved the Pi to a different static IP, and now it works, hooray!
So, I suspect a problem routing the response message via the SmartThings cloud to the handler:
maybe they linked the old device instance to responses from the original static IP
so the new responses don’t get routed to my new device
maybe related to the need to set the Device Network Id manually
Well this is entertaining – it seems that there’s a problem with re-use of Device Network Ids.
As I mentioned above, after deleting everything and starting from scratch, I had problems until I moved the static IP.
Next, I kept the ‘Device Type’ in place and deleted the ‘Device’. After re-installing, the app wasn’t working any more. But this time, I saw logs from two devices … the old (zombie) one and the new one!
Note that there are two ‘Raspberry Pi’ instances, and the request and response messages have different values for the key on the left.
Clicking the first ‘Raspberry Pi’ shows the sender (new Device):
Clicking the second ‘Raspberry Pi’ shows the responses being processed by the old (zombie) Device:
So… I have to conclude that the response message received by the TCP/IP stack on the hub is being routed to the first Device that registered the DNI, and the routing doesn’t get updated when that device is deleted. And it doesn’t get updated when the new Device runs (perhaps related to the need to set the DNI manually in the IDE).
When I changed the port from 8000 to 8001, it still sends the responses to the zombie, until I manually changed the DNI in the IDE. Then it all works again, because the DNI is different, never used before:
I wonder if we need to implicitly delete the old device during the uninstall. See the bottom of this page under “Implicit Removal of Child Devices”. Maybe we need to make the Raspberry Pi app as a device manager app instead similar to the Sonos (connect) SmartApp.