Edward Hails activity https://gitlab.com/Onfe 2022-02-11T00:10:08Z tag:gitlab.com,2021-08-24:1430649691 Edward Hails deleted project branch dripdash/device-control at Hamish Cunningham / unPhone 2021-08-24T23:33:50Z Onfe Edward Hails

Edward Hails (96b5954d) at 24 Aug 23:33

tag:gitlab.com,2021-08-24:1430649684 Edward Hails pushed to project branch master at Hamish Cunningham / unPhone 2021-08-24T23:33:49Z Onfe Edward Hails

Edward Hails (c2482e30) at 24 Aug 23:33

Merge branch 'dripdash/device-control' into 'master'

... and 30 more commits

tag:gitlab.com,2021-08-24:1430649683 Edward Hails accepted merge request !18: Add device bed control. at Hamish Cunningham / unPhone 2021-08-24T23:33:49Z Onfe Edward Hails

Overview

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.

Steps

  • Add an interface on the device dashboard to send requests to fill and drain specific beds.
  • Add the ability to switch between 'automatic' (default) and manual bed control. Should auto be re-enabled after some time?
  • Save bed state change requests in a database table linked to a given device. These state changes should have a reasonable TTL, so in the case where the device goes offline for a long time, the command will not unexpectedly be carried out hours or days later.
  • Check for pending commands when a device sends data to /collect and respond with any pending requests.
  • De-duplicate bed change requests (e.g. if two users request a device to drain a bed, make that just one request with the TTL of the later request).
  • See if it's possible to give some indication of when the command has been executed, otherwise just indicate when the command has been saved on the server.
  • Fiddle with the WaterElf firmware to check the full thing works.
  • Update FakerElf to understand these responses.
tag:gitlab.com,2021-08-24:1430649078 Edward Hails pushed to project branch dripdash/device-control at Hamish Cunningham / unPhone 2021-08-24T23:33:01Z Onfe Edward Hails

Edward Hails (96b5954d) at 24 Aug 23:33

chore: Update documentation for new collector API.

tag:gitlab.com,2021-08-23:1427233848 Edward Hails commented on merge request !18 at Hamish Cunningham / unPhone 2021-08-23T09:47:22Z Onfe Edward Hails

Tested with changes merged from master on FakerElf, behaviour as expected. Marking as ready.

tag:gitlab.com,2021-08-23:1427232546 Edward Hails pushed to project branch dripdash/device-control at Hamish Cunningham / unPhone 2021-08-23T09:46:46Z Onfe Edward Hails

Edward Hails (2d233de7) at 23 Aug 09:46

notes

... and 17 more commits

tag:gitlab.com,2021-08-23:1427225838 Edward Hails pushed to project branch dripdash/device-control at Hamish Cunningham / unPhone 2021-08-23T09:43:23Z Onfe Edward Hails

Edward Hails (4ccdf9f0) at 23 Aug 09:43

chore: Remove unneeded console statements.

tag:gitlab.com,2021-08-23:1427220174 Edward Hails pushed to project branch dripdash/device-control at Hamish Cunningham / unPhone 2021-08-23T09:40:47Z Onfe Edward Hails

Edward Hails (eb67cddc) at 23 Aug 09:40

feat: Show spinner when command saving / sending.

tag:gitlab.com,2021-08-23:1427173802 Edward Hails pushed to project branch dripdash/device-control at Hamish Cunningham / unPhone 2021-08-23T09:18:28Z Onfe Edward Hails

Edward Hails (959fd7cd) at 23 Aug 09:18

fix: Enforce uniqueness on commands.

tag:gitlab.com,2021-08-19:1423031485 Edward Hails commented on merge request !18 at Hamish Cunningham / unPhone 2021-08-19T17:15:31Z Onfe Edward Hails

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.

tag:gitlab.com,2021-08-19:1423026769 Edward Hails pushed to project branch dripdash/device-control at Hamish Cunningham / unPhone 2021-08-19T17:12:04Z Onfe Edward Hails

Edward Hails (b0fdc5b3) at 19 Aug 17:12

feat: Populate /collect responses with pending commands.

... and 1 more commit

tag:gitlab.com,2021-08-19:1423021960 Edward Hails pushed to project branch master at Edward Hails / FakerElf 2021-08-19T17:08:33Z Onfe Edward Hails

Edward Hails (626bb1a1) at 19 Aug 17:08

Add basic support for commands in responses.

tag:gitlab.com,2021-08-04:1398445388 Edward Hails commented on merge request !18 at Hamish Cunningham / unPhone 2021-08-04T20:20:31Z Onfe Edward Hails

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.

tag:gitlab.com,2021-08-04:1398434364 Edward Hails pushed to project branch dripdash/device-control at Hamish Cunningham / unPhone 2021-08-04T20:11:08Z Onfe Edward Hails

Edward Hails (985793ed) at 04 Aug 20:11

feat: Send mutations for bed controls.

tag:gitlab.com,2021-08-04:1398257470 Edward Hails pushed to project branch dripdash/device-control at Hamish Cunningham / unPhone 2021-08-04T17:50:23Z Onfe Edward Hails

Edward Hails (027cc05e) at 04 Aug 17:50

fix: update data 'from' parameter to prevent payload growth.

... and 1 more commit

tag:gitlab.com,2021-07-15:1366103048 Edward Hails opened merge request !18: Add device bed control. at Hamish Cunningham / unPhone 2021-07-15T14:34:35Z Onfe Edward Hails

Overview

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.

Steps

  • Add an interface on the device dashboard to send requests to fill and drain specific beds.
  • Add the ability to switch between 'automatic' (default) and manual bed control. Should auto be re-enabled after some time?
  • Save bed state change requests in a database table linked to a given device. These state changes should have a reasonable TTL, so in the case where the device goes offline for a long time, the command will not unexpectedly be carried out hours or days later.
  • Check for pending commands when a device sends data to /collect and respond with any pending requests.
  • De-duplicate bed change requests (e.g. if two users request a device to drain a bed, make that just one request with the TTL of the later request).
  • See if it's possible to give some indication of when the command has been executed, otherwise just indicate when the command has been saved on the server.
  • Fiddle with the WaterElf firmware to check the full thing works.
  • Update FakerElf to understand these responses.
tag:gitlab.com,2021-07-15:1366076962 Edward Hails pushed new project branch dripdash/device-control at Hamish Cunningham / unPhone 2021-07-15T14:23:21Z Onfe Edward Hails

Edward Hails (c35bffa1) at 15 Jul 14:23

feat: Add bed state mutation to schema.

... and 2 more commits

tag:gitlab.com,2021-07-12:1359935627 Edward Hails pushed to project branch master at Hamish Cunningham / unPhone 2021-07-12T16:43:28Z Onfe Edward Hails

Edward Hails (42a35cb1) at 12 Jul 16:43

docs: Update API and To-Dos.

tag:gitlab.com,2021-07-07:1352204006 Edward Hails closed issue #3: Potentially vulnerable to XSS attacks in DripDash at Hamish Cunningham / unPhone 2021-07-07T12:42:11Z Onfe Edward Hails

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.