Peer API
chevron down
 

Peer API

Variable: device

Type: PeerDevice

The Peer API provides information about the Fitbit device.

import { device } from "peer";
console.log(device.modelName);

Variable: app

Type: PeerApp

The Peer API provides information about the app running on the Fitbit device.

import { app } from "peer";
console.log(app.readyState);

Interface: PeerApp

Information and events related to the application running on the peer device.

Properties

onreadystatechange

((this: PeerApp, event: Event) => any) or undefined

Event handler for readystatechange events from this object.

The readystatechange event is emitted when the peer application state changes. The new state can be obtained via the readyState property.

readonly readyState

"unknown" or "started" or "stopped"

Current state of the peer application.

  • "started" means that the peer application is running,
  • "stopped" means that the peer application is not running
  • "unknown" means that the state of the peer application is unknown.

State transitions can be observed by handling the readystatechange event.

Interface: PeerDevice

Information related to the peer device.

Properties

readonly batteryLevel

"empty" or "low" or "medium" or "high" or "unknown"

Device battery level.

readonly lastSyncTime

Date

Time at which the device was last sync'ed.

readonly modelId

string

Device model identifier. Developer-facing device model ID.

NOTE: the model identifier is always the same for a given device, even when the model name may change.

readonly modelName

string

Device model name. User-facing device model name as displayed in the Fitbit mobile application. Example: Ionic

NOTE: the model name may change over time for a given device as it may be different before and after a device is released commercially. Once a device is released commercially, the model name remains the same.

readonly screen

{ readonly width: number; readonly height: number; }

Device screen information.

readonly type

string

Device type. Standard device types include WATCH for smart watches and TRACKER for trackers.