sleeplog 0.19: Write sleep state into health event's .activity field

master
Gordon Williams 2025-03-26 09:38:09 +00:00
parent d66d0c064d
commit 45b9f14f7b
3 changed files with 6 additions and 2 deletions

View File

@ -14,3 +14,4 @@
0.16: Only write logs if we have a non-empty log to write
0.17: Minor code improvements
0.18: Add back as a function to prevent translation making it a menu entry
0.19: Write sleep state into health event's .activity field

View File

@ -25,7 +25,7 @@ if (global.sleeplog.conf.enabled) {
start: function() {
// add kill and health listener
E.on('kill', global.sleeplog.saveStatus);
Bangle.on('health', global.sleeplog.health);
Bangle.prependListener('health', global.sleeplog.health);
// restore saved status
this.restoreStatus();
@ -176,6 +176,9 @@ if (global.sleeplog.conf.enabled) {
// set status
global.sleeplog.setStatus(data);
}
// update activity in the 'health' event for when it's logged/sent to Gadgetbridge
if (data.status==3) data.activity="LIGHT_SLEEP";
if (data.status==4) data.activity="DEEP_SLEEP";
},
// check wearing status either based on HRM or temperature as set in settings

View File

@ -2,7 +2,7 @@
"id":"sleeplog",
"name":"Sleep Log",
"shortName": "SleepLog",
"version": "0.18",
"version": "0.19",
"description": "Log and view your sleeping habits. This app is using the built in movement calculation.",
"icon": "app.png",
"type": "app",