Add support for requesting device state change
|Status:||Closed||Start date:||02 Sep 2018|
|Target version:||Iron Man - 002 - MVP|
|Severity:||01 - Critical|
This is the monitor->iot comm issue.
The monitor must query the deviceSet() function in the iot device.
The iot device must return new state data.
The monitor must update the iot's state data.
RM #674: Add generalized genConfig() so it can be called from multiple locations to get current configuration as return data.
RM #674: Implement support for accepting a device state change and issuing it to the specified device.
- Status changed from New to In Progress
- % Done changed from 0 to 10
- Severity changed from 03 - Medium to 01 - Critical
This is the /set API for the sensor. It will work similar to /query in the IoT device. But it also sets the device state. The API returns 200 on success or 401 if the request can't be verified. On success the sensor sends back it's updated configuration data which the monitor will use to replace the old data (just like with getDevices).
The monitor does not iterate over all paired devices. It must know which one it wants to contact. This is handled by having the API use POST /set/device with the uuid encrypted in the JSON body.
- Status changed from In Progress to Closed
- % Done changed from 30 to 100
Wow. That was surprisingly close to perfect on the first try. After minor adjustments, the code in imrest and in the IoT device code (imlightsw) now properly handles the device state change requests. All over AES encrypted channels. Very cool.
All updates to Jarvis, imrest and imlightsw have been tested on real hardware (the LED goes on and off now on voice command!), committed and pushed upstream.