Edward Hails (96b5954d) at 24 Aug 23:33
Edward Hails (c2482e30) at 24 Aug 23:33
Merge branch 'dripdash/device-control' into 'master'
... and 30 more commits
The goal of this branch is to add the ability to change the bed state on WaterElf devices through the DripDash interface.
To perform this, the dashboard will send a mutation requesting the state change to the server, which in turn will be stored in the database.
The next time the WaterElf connects to the server to upload stats, the response to this HTTP request will contain the command to be sent, and the command will be removed from the database as it is now completed.
Sending the command to the Elf device will probably use JSON, although a more simplistic method of encoding this data is preferable to reduce the memory requirements on the IoT device.
/collect and respond with any pending requests.Edward Hails (96b5954d) at 24 Aug 23:33
chore: Update documentation for new collector API.
Tested with changes merged from master on FakerElf, behaviour as expected. Marking as ready.
Edward Hails (4ccdf9f0) at 23 Aug 09:43
chore: Remove unneeded console statements.
Edward Hails (eb67cddc) at 23 Aug 09:40
feat: Show spinner when command saving / sending.
Edward Hails (959fd7cd) at 23 Aug 09:18
fix: Enforce uniqueness on commands.
Once states are chosen I'll refactor it into an enum but for now they're just strings.
Devices now receive a JSON list containing commands in this format:
[
{"subject": "bed 0", "action": "fill"}
]
I still need to update the docs for this. If there aren't any pending commands the status code returned is 204 (no content), if there are pending commands it's a 200.
Edward Hails (b0fdc5b3) at 19 Aug 17:12
feat: Populate /collect responses with pending commands.
... and 1 more commit
Edward Hails (626bb1a1) at 19 Aug 17:08
Add basic support for commands in responses.
I'm currently basing the commands and state codes sent back to the devices on the old firmware, as the new firmware is still somewhat in flux.
It might be needed to consolidate device states into just 'fill' and 'drain' on the frontend though in the future.
Edward Hails (985793ed) at 04 Aug 20:11
feat: Send mutations for bed controls.
Edward Hails (027cc05e) at 04 Aug 17:50
fix: update data 'from' parameter to prevent payload growth.
... and 1 more commit
The goal of this branch is to add the ability to change the bed state on WaterElf devices through the DripDash interface.
To perform this, the dashboard will send a mutation requesting the state change to the server, which in turn will be stored in the database.
The next time the WaterElf connects to the server to upload stats, the response to this HTTP request will contain the command to be sent, and the command will be removed from the database as it is now completed.
Sending the command to the Elf device will probably use JSON, although a more simplistic method of encoding this data is preferable to reduce the memory requirements on the IoT device.
/collect and respond with any pending requests.Edward Hails (c35bffa1) at 15 Jul 14:23
feat: Add bed state mutation to schema.
... and 2 more commits
Edward Hails (42a35cb1) at 12 Jul 16:43
docs: Update API and To-Dos.
JWT proves the authenticity of the source through signatures but doesn't provide security. Storing the session token in local storage is insecure since local storage can be accessed by javascript. Any compromised node package could lead to user tokens being stolen. Storing the JWT in an HttpOnly cookie with the SameSite attribute helps protect from XSS and CSRF attacks.