nightscout / Trio

Trio - an automated insulin delivery system for iOS based on the OpenAPS algorithm with adaptations.
https://docs.diy-trio.org/en/latest/
MIT License
95 stars 485 forks source link

NightscoutManager.swift: Upload both suggested and enacted to NS #14

Closed bjornoleh closed 6 months ago

bjornoleh commented 7 months ago

in closed loop mode. Partially reverts 55e9ede "Reduce NS data trafic", which uploaded only enacted in closed loop mode.

mountrcg commented 7 months ago

I do not think I have this reverted. I remember switching my grafana board to use enacted instead of suggested in NS. What is your reasoning to upload suggested as well @bjornoleh ?

bjornoleh commented 7 months ago

To follow up this one: As a caregiver, I do find myself looking at “suggested” entries in the OpenAPS pill sometimes. They have tags such as “Waiting” and a couple of other ones, and are displayed with a warning ⚠️ icon on the OpenAPS devicestatus pill. Without uploading the “suggested” entries, there would simply be less information available.

dnzxy commented 7 months ago

@mountrcg maybe an answer @scottleibrand gave to a similar question of mine on Discord can make the intent of this PR clearer:

Scott wrote

In short, pump comms are unreliable, and not to be trusted. OpenAPS / oref0 assumes that suggestions are worth producing, and uploading to Nightscout, every time the loop runs, but that not all of those will be successfully enacted on the pump, and just as importantly, not all of them need to be enacted on the pump. For example, if you have a 1U/hr basal, and need 0.5U of additional insulin, it might set a 2U/hr temp basal for 30m to deliver that. If 15m later you now need 0.2U of additional insulin, it would be counterproductive to cancel the 2U/hr high temp that has 15m left to run and replace it with a 1.4U/hr high temp with a duration of 30m. So instead, the suggestion is to do nothing, and there is no temp basal enacted. The Nightscout pill then shows both the most recently enacted suggestion, as well as the more recent do-nothing suggestion.

I think NS should show both and we should upload both.

+1 for this.