fitbit-guhrli-core

0.0.5 • Public • Published

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:

Package Sidebar

Install

npm i fitbit-guhrli-core

Weekly Downloads

0

Version

0.0.5

License

GPL-3.0-only

Unpacked Size

89 kB

Total Files

33

Last publish

Collaborators

  • oswalde-p