Feature #624
closed
Add support for requesting a device list from Jarvis.
Added by Hammel over 6 years ago.
Updated about 6 years ago.
Description
This is partially implemented and should happen on a repeating basis so that Jarvis always has an up to date list of IoT devices for each registered monitor.
- Project changed from Iron Man to Jarvis
- Category deleted (
Jarvis)
- Status changed from New to In Progress
- Priority changed from Urgent to Immediate
- % Done changed from 0 to 10
- Severity changed from 03 - Medium to 01 - Critical
This needs to be done before state can be retrieved. Jarvis needs to poll for registered devices so when a request comes for "office" it will know which monitor to query.
Jarvis must run this poll in a thread so that it has an up to date list of devices all the time.
- % Done changed from 10 to 20
There are a number of updates required for this. I've started with a TimerTask() to poll monitors for device lists. There were some minor bugs in the handling of the keys for encryption that needed to be fixed, but that's done now. The poll properly triggers the correct method in imrest.
The next problem is also a side-bar: the Imwww:send() method is iterating over all monitors but sending back individual responses for each one. These need to be collected into a list and the list needs to be returned. The caller will have to iterate over the list to get the data it wants.
Once I've fixed that (there are existing calls to send() that need to be fixed first) I can then work on the code in imrest:device.js:list() that returns the list of registered nodes. This is just a matter of iterating all sensor registration files stored and grabbing their JSON content which should include all device names and states. These have to be placed into a JSON array in order to be properly managed on both ends.
I also need to associate the list data with the monitor so I need to include the monitor descriptor with the array of sensor registration/state data before returning it to Jarvis.
- % Done changed from 20 to 50
All of the previous work is now done but there is more to do.
- Data returned from the monitor is encoded/encrypted. It's needs to be decoded/decrypted when it's used (re: displayed).
- The list of devices is not displayed anywhere yet. It doesn't actually need to be in Jarvis but it does for debugging purposes.
- % Done changed from 50 to 80
Decryption is now implemented as a method in Message which makes it easy to process them. Tested in test environment.
Now I need to deploy the updated imrest to real hardware. Then I need to register a lightsw device with it and then run Jarvis to see if it retrieves it. Just powering on Jarvis should do that.
If that works, I'm one step closer to making the request to "turn on the light"! (But that's a different issue to track.)
- Status changed from In Progress to Closed
- % Done changed from 80 to 100
Verified working on hardware. There are other problems, like phantom registrations from devices that are no longer around. I'll make issues to track fixing those separately.
All code has been pushed.
This issue can be closed.
Also available in: Atom
PDF