Author
Topic: Question about GSD... (Read 1478 times)

I'm working on a device template using GSD for an IP enabled device, and I was wondering if it's possible to obtain the IP address of the device from device data? I'm building various URL's for device control, and it would be cleaner to be able to retrieve the IP address from the device's data...

why? If your TCP port device data is set correctly in your Device Template, and the IP address is properly set in the device instance, then GSD will open up a socket to it, and give you the conn_ object to communicate with it.

Seriously, though, the device in question has a SOAP interface used to subscribe to events emitted by the device, and a REST interface to control it. I have a basic set of commands working to control it via REST, using a hard-coded variable for the IP. Before I go writing code to query the device table directly, I'm asking for a less ugly, more Thom-approved method.

I plan on getting to the subscription stuff next using the conn_object. It's slow-going teaching myself SOAP, XML parsing, and ruby all at once, plus figuring out the relevant LMCE infrastructure.

I'm not that IRC saavy/equipped; I should probably add that to my list of things to learn. I'm also not sure how well it'd work via my iPad since I bounce between Safari, Textastic, and iSSH. Long story...

Anyway, based on my understanding of the devices' SDK, it needs a channel for the subscription for the SOAP events with a periodic heartbeat response, and commands are sent via the REST interface (so, two connections). Based on my understanding of the conn_object, it's a single channel implementation, but bi-directional. This all is with the caveat/disclaimer that I don't play a programmer on TV or the Internet; I'm a sysadmin who's managed to learn enough about programming to be able to glue various bits and pieces together.

So, I have this little private method which works beautifully, and I can control manually-defined children lights of the device quite nicely.