fitbit-guhrli-core
v0.0.5
Published
Library allowing fitbit os applications to fetch and display Continuous Glucose Monitoring data from various sources.
Downloads
16
Maintainers
Readme
fitbit-guhrli-core
A library for fitbit devices to receive Continuous Glucose data from various sources. Consists of both an app and a companion component. Communication between components is done via Fitbit's messaging API
Usage
Install via npm:
npm install fitbit-guhrli-core
App
Import and initialize the app compoment from inside your project's app/index.js
e.g.
import { peerSocket } from 'messaging'
import guhrliApp from 'fitbit-guhrli-core/app'
// initialize on app startup, passing the peerSocket
guhrliApp.initialize(peerSocket)
clock.ontick = (evt) => {
const reading = guhrliApp.getReading() // 243
const alarm = guhrliApp.getAlarm() // 'HIGH'
const age = guhrliApp.getFormattedAge() // '7m'
// use results to update display
...
}
See the full app api here.
Companion
import { initialize, GuhrliError } from 'fitbit-guhrli-core/companion'
initialize({
source: 'NIGHTSCOUT',
nightscoutURL: 'https://example.com/'
})
See the full companion api here.
Usually you'll be reading source and nightscoutURL from the settings
storage. If the source or URL changes, simply call initialize()
again with the
new values. In real life you probably want to catch errors during intialization
as well. See the examples for copy/pastable templates for companion
and settings components, or the original guhrli project for a complete working example.
Available Sources
Three sources for CGM data are currently supported: