Add support for requesting a device list from Jarvis.
|Status:||Closed||Start date:||08 May 2018|
|Target version:||Iron Man - 002 - MVP|
|Severity:||01 - Critical|
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.
RM #624: Fix write of JSON registration data to be proper JSON and use it as JSON when reading it back in.
RM #624: Make sure we're using stored data correctly when retrieving keys. Change the API for GET /device to POST /devices so we can use the encryption key for validating the sender.
RM #624: Cleanup to provide device list support in imrest.
Changed crypto.encrypt() to return json object instead of parseable string.
Moved retrieval of UUIDs to function in new utils class.
Moved retrieval of monitor descriptor to function in new utils class.
Implemented retrieval of device configurations in device list API.
Simplified the monitor get API code considerably.
RM #624: Cleanup to provide device list support in Jarvis.
Allow Imwww:send() to collect responses from all monitors it sends to.
Fix JarvisCmd:getDevices() to properly retrieve and hold responses from monitors (still encoded/encrypted, however).
Add support for returning the number of messages a Message object is holding.
Fix register to work with changed context where Imwww:send() now returns a Message object even if no messages were
returned and each message is hashed by the monitors IP address.
RM #624: Add decrypt() method to Message and use it with registration (to get monitor description) and in getDevices() (to view device list JSON returned from each monitor).
- 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.
#3 Updated by Hammel about 1 month ago
- % 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.
#4 Updated by Hammel about 1 month ago
- % Done changed from 20 to 50
- 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.
#5 Updated by Hammel about 1 month ago
- % 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.)
#6 Updated by Hammel about 1 month ago
- 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.