0.0.5 • Published 3 years ago

fitbit-guhrli-core v0.0.5

Weekly downloads
2
License
GPL-3.0-only
Repository
github
Last release
3 years ago

fitbit-guhrli-core

npm nyc Coverage License from NPM GitHub last commit

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:

0.0.5

3 years ago

0.0.4

3 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago