Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Night mode #2840

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from
Open

[WIP] Night mode #2840

wants to merge 3 commits into from

Conversation

justmara
Copy link

@justmara justmara commented Sep 26, 2023

This PR adds overnight SMB restriction mode (inspired by Eating Now @dicko72).

  • You set up the time interval for 'Night mode' to be active
  • Set the BG offset (from profile target) in which Night mode will be active during time from step 1

So during night while your BG is below profileTarget + BG offset - SMB will be disabled and only TBR will be active for plugins.
When BG escalates higher than profileTarget + BG offset - SMB overnight restriction falls off.

You can also set up Night mode to be disabled if COB > 0.
Or when Temp Target is set lower than profile target.

telegram-cloud-photo-size-2-5228906977193741105-y

07..15:00 time is set here because I were testing it during a day now :)

telegram-cloud-photo-size-2-5228906977193741106-y
telegram-cloud-photo-size-2-5228906977193741104-x

The idea of this mode itself is to add some security mode against overnight sensor pressures. Here is my daughter's BG this night - these fast drops are sensor pressures, and quick rises - BG comes back to real after pressure released.
telegram-cloud-photo-size-2-5228833984224546746-y

Usually AAPS acts like this for these quick rises (see many SMBs here)
telegram-cloud-photo-size-2-5228833984224546748-y

But frankly thats a graph from my test phone connected to virtual pump, because in reality MUCH lower amount of insulin were required to deal with that:
telegram-cloud-photo-size-2-5228833984224546747-y

TBS is way more safe for such beaviour

@olorinmaia
Copy link
Contributor

olorinmaia commented Sep 26, 2023

A welcome change. I've solved exactly this myself with automations. But this will make it easier to keep nights steady for users having trouble configuring automations.

@justmara justmara changed the title Night mode [WIP] Night mode Sep 26, 2023
@justmara
Copy link
Author

A welcome change. I've solved exactly this myself with automations. But this will probably make it easier to keep nights steady for users having trouble configuring automations.

Making the same with automations not only is WAY more complex and lies beyond most user's expertise, but also depends on other settings that can be unwanted during the rest of the day, but cannot be changed with automations.

@sonarcloud
Copy link

sonarcloud bot commented Sep 27, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 2967 Code Smells

No Coverage information No Coverage information
2.6% 2.6% Duplication

@jbr7rr
Copy link

jbr7rr commented Sep 28, 2023

I love the idea of being able to disable SMB at night.

However I think this adds too much settings, and also the placement of the settings is not logical to me.

I suggest the following:
Add two settings to openAPS SMB:

  • Enable SMB in timewindow (This setting only shows if "SMB always" is not selected)
  • Start time and End time of SMB enabled (This only shows when Enable SMB in timewindow is selected)

Make "enable SMB with COB" and "SMB with TT" also work outside the timewindow. do not add a setting for this, but maybe clarify that it will override the timewindow

This will make it more in line with the current settings for SMB we have. Additionally you could group all SMB related settings in a sub menu of openAPS SMB

Also a setting like BG offset is not obvious to many users.. With what I propose the same can be achieved by an automation (setting a low TT when BG is above a certain offset)

@justmara
Copy link
Author

justmara commented Sep 28, 2023

the placement of the settings is not logical to me.
Add two settings to openAPS SMB:

These settings apply to SMB and Dynamic ISF SMB (and also to other plugins like EN/Boost/AutoISF/AIMI...) - thats why I placed these to Treatments protection section instead of copy-pasting same settings to all the SMB-related plugins.
So it does not add anything new, it RESTRICTS SMBs during specific timewindow AND BG range.

Also a setting like BG offset is not obvious to many users..

Automations are much less obvious - this is an attempt to keep this as a restriction policy, confgured in one place for all of the plugins. The safety one. Without automations, tricky SMB plugin combinations etc.

@szantos
Copy link

szantos commented Oct 2, 2023

Basically a very good point, IMHO many would need an SMB_off option - maybe not only at night.

There is another existing solution in autoISF based on even/odd temptarget (odd means SMB_off).

But the most straightforward and versatile would be an additional automation action to disable SMB.

@justmara
Copy link
Author

justmara commented Oct 2, 2023

There is another existing solution in autoISF based on even/odd temptarget (odd means SMB_off).

Totally unusable for mmol users :)

@szantos
Copy link

szantos commented Oct 2, 2023

If using mmol/L the decimal is considered by autoISF.
Why do you think, this to be unusable?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants