Skip to content

Commit 45b9f14

Browse files
committed
sleeplog 0.19: Write sleep state into health event's .activity field
1 parent d66d0c0 commit 45b9f14

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

apps/sleeplog/ChangeLog

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@
1414
0.16: Only write logs if we have a non-empty log to write
1515
0.17: Minor code improvements
1616
0.18: Add back as a function to prevent translation making it a menu entry
17+
0.19: Write sleep state into health event's .activity field

apps/sleeplog/boot.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ if (global.sleeplog.conf.enabled) {
2525
start: function() {
2626
// add kill and health listener
2727
E.on('kill', global.sleeplog.saveStatus);
28-
Bangle.on('health', global.sleeplog.health);
28+
Bangle.prependListener('health', global.sleeplog.health);
2929

3030
// restore saved status
3131
this.restoreStatus();
@@ -176,6 +176,9 @@ if (global.sleeplog.conf.enabled) {
176176
// set status
177177
global.sleeplog.setStatus(data);
178178
}
179+
// update activity in the 'health' event for when it's logged/sent to Gadgetbridge
180+
if (data.status==3) data.activity="LIGHT_SLEEP";
181+
if (data.status==4) data.activity="DEEP_SLEEP";
179182
},
180183

181184
// check wearing status either based on HRM or temperature as set in settings

apps/sleeplog/metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"id":"sleeplog",
33
"name":"Sleep Log",
44
"shortName": "SleepLog",
5-
"version": "0.18",
5+
"version": "0.19",
66
"description": "Log and view your sleeping habits. This app is using the built in movement calculation.",
77
"icon": "app.png",
88
"type": "app",

0 commit comments

Comments
 (0)