WIP: State DB
Initial thoughts after testing with AAPS and AAPSClient app on phone only.
I like the idea to display loop states / pump disconnects with the bar at top of graph. This also seem to sync well to AAPSClient. Could the icon for loop state (top right corner) also be synced to AAPSClient? And if you tap it in AAPSClient, you get info about the current state (name, duration).
I would prefer, if the most common used state, "closed loop", won't generate a green bar at the top. The normal state should not disturb the graph. It will look more clean this way, and also make user more aware if some other state is activated.
Edit: After running this build and AAPS and AAPSClient being running idle with closed loop for a few hours the green bar at the top disappear, not sure if it is intended? I will test now setting open loop and leaving it on that mode.
Just installed. AAPS seems happy, no issues so far.
- On update loop defaulted to "Disabled". Is that intented?
- Like the status bar, but agree with @olorinmaia, better not show this unless getting user attention has value (will see if the green bar also disappears in time for)
Problem: At 1.44 AM automation fired setting temp profile. Then Loop got suspended. No way to close loop again. Had te revert to current dev and database was reset and all well. Updating again to this PR: came up with same problem state: Loop suspended and unable to unsuspend.
@MilosKozak Do you want me to create an issue for this?
Problems at 1.44AM (see AndroidAPS.2025-05-08_02-17-24.4) AndroidAPS_LOG_1746664503738.log.zip
Still problems after reverting to current dev, manually resetting database and then updating to PR again at approx 10:15AM Update ended up with loop still suspended. No way to unsuspend. So database resets did not clear the problem:
AndroidAPS_LOG_1746692421329.log.zip
(Edit: logfiles upload issue fixed) (Remark: .onOlderVersionDetected():103]: Version newer than master. Ignore: have been building with a 1-line patch for max_carbs_absorbsion maxlimit setting limit)
When I select User Entry icon, I enter in a searching loop, but no entries are shown, even after a long while...
UI consistency? If I select Suspend loop during one hour, loop icon is red but status line is yellow...
And within treatment, status is "Unkown"
Just installed. AAPS seems happy, no issues so far.
- On update loop defaulted to "Disabled". Is that intented?
- Like the status bar, but agree with @olorinmaia, better not show this unless getting user attention has value (will see if the green bar also disappears in time for)
can you check Treatments - User actions? Migration should be mentioned there ....
can you check Treatments - User actions? Migration should be mentioned there ....
Will do. Need to redo repro on my main AAPS phone. Will need a good time for that. Likely on in 2 days.
can you check Treatments - User actions? Migration should be mentioned there ....
@MilosKozak Tried new build, merging PR with yesterdays commit (current has merge conflict?): Still same result as describe above: After updating loop has state suspended. And I can't find a way to unsuspend loop. Running mode in treatments says: "Pump suspended Until change"?
Can not find anything on Migration under treatments...
Strangely enough I was unable to repro this behavior on my other 2 test phones. Somehow this phone is locked into an unrecoverable state resulting in loop unsuspended that can not be changed through the UI?
User entry
-
Running mode *
-
Pressing "Loop suspended Icon"
@MilosKozak Could have a look with logcat and/or debugger.
As far as I can see?; the (my?) problem occurred when automation tried to set a temporary profile percentage. It suspended the loop but then somehow was unable to close the loop again. Leaving AAPS is a state when the mop-up menu does not show the usual UI buttons (see screenprint) to repair to the correct state.
Unfortunately, I was unable to reproduce the occurrence. So no other option then to read the code logic with some help from the debugger?
Any hints on where in the code to look for the problem?
In latest commit I addressed reported issues and improved UI. Loop dialog not reports limitations forced by constraints plugins
In latest commit I addressed reported issues edit: this was about other issues on main channel?
PR merges ok with current dev now (= no build errors). After updating, AAPS crashes on start: Tried stopping + delete cache, restart. Still crashing.
(Reverted to current build (update install) successfully.)
Tried stopping + delete cache, restart. Still crashing. Logs: AndroidAPS_LOG_1747427812473.log.zip
Could you try switching to virtual pump before updating?
@MilosKozak Tested abit more and I think the sync between AAPS and AAPSClient is working, but a bit unstable. Very good job on adding the possibility to view/change running mode in AAPSClient :) Some times it doesn't sync to AAPSClient or from. Seems like it stops and I need to toogle the new ACv3 setting for RunningMode.
I noticed an issue with virtual pump, not tested with Dash. On AAPSClient you are not able to disconnect pump. (Is that intentional? It would be nice to be able to do this from AAPSClient also, but perhaps reasons for this not being shown) If I disconnect pump on AAPS, the running mode icon in AAPSClient turns into "Disconnected pump", and I can click the icon and select "Reconnect pump". This does not sync to AAPS.
Issue two: If I go to Treatments > User entry > the page is only loading, no content shown. (Only AAPS; not happening on AAPSClient)
@olorinmaia your second issue is the same than mine described here https://github.com/nightscout/AndroidAPS/pull/3968#issuecomment-2862429892 It seems to work for @vanelsberg 🤔
@MilosKozak Fix 48ba781 fixed my problem 🥇
Successfully updated main phone with current AAPS dev + PR3980 + fix (10 mins ago) Loop active, all seems well. Will closely monitor/test behavior for the next 48 hours.
anyone else is testing? ready to merge?
anyone else is testing? ready to merge?
On AAPS its working fine on my testrig. The sync between AAPS and client stops working after a while but not sure how to reproduce it. If I toggle the new sync setting for running mode it starts working again. I can provide logs if it helps but this is something that can be improved later on.
What about disconnect pump? Should that be possible on client? If I disconnect pump on AAPS I can resume loop on client but it doesn't sync. Testing with virtual pump.
Logs. AAPS: AndroidAPS_LOG_1747903073970.log.zip
AAPSClient: AndroidAPS_LOG_1747903058076.log.zip
Screenshot of Open Loop set on AAPSClient 10:14 and screenshot from AAPS around 10:36 missing sync
| AAPS | AAPSClient |
|---|---|
I now toggled the Running mode setting in AAPS AAPSClientV3 sync settings off and on again and next attempt from AAPSClient then synced to AAPS.
This is screenshots and logs of the reconnect pump sync issue. Around 10:52 AAPSClient try to resume loop after AAPS has synced a disconnected pump.
AAPS: AndroidAPS_LOG_1747904586255.log.zip
AAPSClient: 
Quality Gate passed
Issues
15 New issues
0 Accepted issues
Measures
0 Security Hotspots
0.0% Coverage on New Code
3.1% Duplication on New Code
Codecov Report
Attention: Patch coverage is 27.57296% with 943 lines in your changes missing coverage. Please review.
Project coverage is 27.44%. Comparing base (
1590206) to head (5f2e672). Report is 40 commits behind head on dev.
Additional details and impacted files
@@ Coverage Diff @@
## dev #3968 +/- ##
============================================
+ Coverage 27.40% 27.44% +0.03%
- Complexity 6436 6462 +26
============================================
Files 2360 2364 +4
Lines 121552 121742 +190
Branches 15600 15628 +28
============================================
+ Hits 33316 33409 +93
- Misses 85652 85737 +85
- Partials 2584 2596 +12
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
- :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
With latest updates, User Entry works now (but tested only on my emulator) Looks good now for merging on my side.
Have been running latest dev version while merging this PR for the past 4 weeks. No issues encountered 👍
👍 Build and install ok. Not seeing any issues.