BangleApps/apps/health
Gordon Williams 64a92e281a health 0.37: Reduce movement limit for HRM off from 400 to 100
+      Fix daily summary for movement (was not scaling down correctly)
2025-07-29 11:14:45 +01:00
..
ChangeLog health 0.37: Reduce movement limit for HRM off from 400 to 100 2025-07-29 11:14:45 +01:00
README.md health: Added graphs for Temperature and Battery, also reduced duplication in graph code 2025-03-14 11:13:45 +00:00
app-icon.js new 'health' app for 2v11, improved bangle2 launcher 2021-10-14 17:14:10 +01:00
app.js health 0.36: Fix Distance graphs that used '1*' to remove the suffix 2025-07-22 14:52:45 +01:00
app.png new 'health' app for 2v11, improved bangle2 launcher 2021-10-14 17:14:10 +01:00
boot.js health 0.37: Reduce movement limit for HRM off from 400 to 100 2025-07-29 11:14:45 +01:00
boot.min.js health 0.37: Reduce movement limit for HRM off from 400 to 100 2025-07-29 11:14:45 +01:00
chart.min.js Add bar graphs 2023-01-04 08:18:26 +01:00
interface.html health 0.31: Add support for new health format (storing more data) 2025-03-14 10:35:34 +00:00
lib.js health 0.37: Reduce movement limit for HRM off from 400 to 100 2025-07-29 11:14:45 +01:00
lib.min.js health 0.37: Reduce movement limit for HRM off from 400 to 100 2025-07-29 11:14:45 +01:00
metadata.json health 0.37: Reduce movement limit for HRM off from 400 to 100 2025-07-29 11:14:45 +01:00
screenshot.png screenshots 2025-07-02 09:43:20 +01:00
settings.js Update apps to remove default boolean formatters 2024-01-08 21:53:11 +00:00

README.md

Health Tracking

Logs health data to a file in a defined interval, and provides an app to view it

Usage

Once installed, health data is logged automatically. Entries are stored with a 10 minute interval.

To view data, run the Health app from your watch.

Features

Stores:

  • Heart rate
  • Step count (can calculate distance if myprofile is installed and stride length is set)
  • Movement

Settings

  • Heart Rt - Whether to monitor heart rate or not
    • Off - Don't turn HRM on, but record heart rate if the HRM was turned on by another app/widget
    • 3 Min - Turn HRM on every 3 minutes (for each heath entry) and turn it off after 1 minute, or when a good reading is found
    • 10 Min - Turn HRM on every 10 minutes (for each heath entry) and turn it off after 2 minutes, or when a good reading is found
    • Always - Keep HRM on all the time (more accurate recording, but reduces battery life to ~36 hours)
  • Daily Step Goal - Default 10000, daily step goal for pedometer apps to use and for the step goal notification
  • Step Goal Notification - True if you want a notification when the daily step goal is reached

Technical Info

Once installed, the health.boot.js hooks onto the Bangle.health event and writes data to a binary file (one per month).

A library (that can be used with require("health").readXYZ can then be used to grab historical health info.

boot.js and lib.js include some constants that don't get inlined by the simple minifier used in the App Loader, so we use the closure compiler to pre-minify them. The easiest way to use it is to install https://github.com/espruino/EspruinoDocs and run EspruinoDocs/bin/minify.js lib.js lib.min.js

HRM data is stored as a number representing the best/average value from a 10 minute period.

Usage in code

You can read a day's worth of health data using readDay, which will call the callback with each data packet:

require("health").readDay(new Date(), print)
// ... for each 10 min packet:
{ "steps": 40, "bpmMin": 92, "bpmMax": 95, "movement": 488,
  "battery": 51, "isCharging": false, "temperature": 25.5, "altitude": 79,
  "activity": "UNKNOWN",
  "bpm": 93.5, "hr": 6, "min": 50 }

Other functions are available too, and they all take a Date as an argument:

// Read all records from the given month
require("health").readAllRecords(d, cb)

// Read the entire database. There is no guarantee that the months are read in order.
require("health").readFullDatabase(cb)

// Read all records per day, until the current time.
// There may be some records for the day of the timestamp previous to the timestamp
require("health").readAllRecordsSince(d, cb)

// Read daily summaries from the given month
require("health").readDailySummaries(d, cb)

// Read all records from the given day
require("health").readDay(d, cb)

TODO

  • More features in app:
    • Viewing stored altitude/bpm min/max graphs
    • Currently we only graph per hour but we have 10 min data - should it be shown?
    • Pie chart to show percent of time in each activity
    • Calendar view showing steps per day
    • Yearly view
    • Heart rate 'zone' graph
    • .. other

License

The graphs on the web interface use Chart.js, licensed under MIT License.