chiefwigms / picobrew_pico

MIT License
149 stars 63 forks source link

fix z series clean logic (file glob match) add add/port logic for pico series device #241

Closed tmack8001 closed 3 years ago

tmack8001 commented 3 years ago

The file glob match used to detect sessions of a machine was not matching filenames appropriately anymore. Ported similar "num_sessions_since_clean" from z into the pico series devices (using comment to decide response format... I don't have a working pico device so can't test).

Tested both z and pico via manually adding files locally and curling the API.

curl "localhost/API/pico/getActionsNeeded?uid=pico-needs-cleaning"
#7#%
curl --location --request PUT 'localhost/Vendors/input.cshtml?type=ZState&token=z-needs-cleaning' \
--header 'Content-Type: application/json' \
--data-raw '{
    "BoilerType": 1,
    "CurrentFirmware": "0.0.119"
}'
{
  "Alias": "ZSeries",
  "BoilerType": 1,
  "IsRegistered": true,
  "IsUpdated": true,
  "ProgramUri": null,
  "RegistrationToken": -1,
  "SessionStats": {
    "DirtySessionsSinceClean": 3,
    "LastSessionType": 0,
    "ResumableSessionID": -1
  },
  "UpdateAddress": "-1",
  "UpdateToFirmware": null,
  "ZBackendError": 0
}