Announcing Fitbit OS SDK 6.0
chevron down

Announcing Fitbit OS SDK 6.0

Fitbit OS SDK 6.0

Fitbit OS firmware version 5.2 has recently been released for Fitbit Sense and Fitbit Versa 3 and today we're announcing Fitbit OS SDK 6.0.

Fitbit OS SDK 6.0 features a new API, a weekly goal for Active Zone Minutes (AZM) and it aligns our mobile companion APIs by filling a few small gaps on iOS. If that wasn't enough we've also added Norwegian language support, and introduced a couple of breaking changes for good measure!

Note: This is the first time the SDK version number hasn't aligned perfectly with the firmware version, but this was necessary due to some breaking API changes that required a version bump for the SDK.

In a break from our usual deprecation strategy we have chosen to also maintain a version of SDK 4.x so developers can continue to build apps and clocks for our legacy smartwatches. Please be aware that later this year we will be ending support for SDK 4.x in our device simulator and Fitbit Studio. Developers should prepare for this by ensuring they are familiar with our Command Line SDK which can continue to be used for SDK 4.x with physical devices.

Companion Weather API

The current temperature and weather conditions are some of the most highly engaging features of popular clocks. Developers previously needed to implement this through 3rd party APIs and often at their own expense.

The new Companion Weather API allows developers to fetch the current weather conditions for the user's current location without the complexity or cost of 3rd party services. The data includes: temperature, unit (celsius/fahrenheit), condition, the UTC date updated, location name, and UTC time offset for the location.

import { me as companion } from "companion";
import weather from "weather";

if (companion.permissions.granted("access_location")) {
     .then(data => {
       if (data.locations.length > 0) {
         const temp = Math.floor(data.locations[0].currentWeather.temperature);
         const cond = data.locations[0].currentWeather.weatherCondition;
         const loc = data.locations[0].name;
         const unit = data.temperatureUnit;
         console.log(`It's ${temp}\u00B0 ${unit} and ${cond}
 in ${loc}`);
     .catch(ex => {

Note: Developers should always check for the appropriate permissions. If the location or background location permissions are not granted to the Fitbit mobile app the weather data will not be available.

See It In Action

To see a full example of using the new Companion Weather API in Fitbit OS SDK 6.0, please check out our open source SDK-Weather-Clock project on Github.

Bonus Update

As a special bonus for all SDK 4.x developers out there, we were able to make the new Companion Weather API available since this is a mobile only API and didn't require any firmware changes.

If you're using Fitbit Studio you just need to select SDK 4.3 in the package.json settings, or for the command line tools, change the @fitbit/sdk version to ~4.3, then install with npm install or yarn install.

AZM Weekly Goal

We originally enhanced our User Activity API with Active Zone Minutes back when we announced SDK 4.2. Today we've updated it to include the user's Weekly goal in addition to the existing Daily goal.

Developers can now read the user AZM goal value in minutes, and the current progress towards the weekly goal in minutes. An event is also emitted when the user reaches their weekly goal.

import { weekGoals, week } from "user-activity";

console.log(`${weekGoals.activeZoneMinutes} mins weekly AZM goal`);
weekGoals.addEventListener("reachgoal", (evt) => {
   // AZM Weekly Goal has been met

Norwegian Language Support

Fitbit OS 5.2 added language support for Norwegian (nb-NO) and developers can now utilise it within their apps and clocks.

Adding support for Norwegian is as simple as adding translations in an additional nb-NO.po file within your i18n folders.

Read our localization guide for full details.

Companion API Enhancements (iOS)

To bring the iOS Companion APIs in alignment with Android, we added support for the Base64 encoding/decoding functions atob() and btoa().

We also fixed an iOS specific issue when using URLSearchParams with FormData.

Breaking Changes

There are 2 breaking changes that developers will need to be aware of when updating their projects to SDK 6.0.

1. Batched Sensor Readings

All sensors now use Uint32Array for timestamps within batched readings, not Float32Array. Please check your code carefully if you're working directly with any of the sensors such as: Accelerometer, Barometer, Gyroscope, Heart Rate, and Orientation.

2. Importing Modules

Due to a change in rollup.js (the bundler we use for packaging our JavaScript files), any module that doesn't contain a default export will need to be imported using a slightly different syntax.

e.g. import * as module from "module";

This change applies to the following APIs: crypto, document, fs, jpeg, power, scientific, scientific/signal, system, user-activity, and user-settings.

Project Upgrade Instructions

In order to use the new SDK version 6.0 you need to take the following steps:

1. Set the SDK Version

If you're using Fitbit Studio you just need to select SDK 6.0 in the package.json settings, then follow the additional steps below.

For the command line tools, change the @fitbit/sdk version to ~6.0.0, and ensure you're using the @fitbit/sdk-cli ^1.7.3, then install with npm install or yarn install.

2. Fix Broken Imports

As mentioned previously, there are some breaking changes due to changes in the underlying bundling tool for JavaScript.

Change the import syntax if you're importing any of the following modules: crypto, document, fs, jpeg, power, scientific, scientific/signal, system, user-activity, user-settings.

Old syntax:

import document from "document";

New syntax:

import * as document from "document";

3. Batched Sensors

If you're using raw sensor readings in batch mode, you need to check your code as we changed from Float32Array to Uint32Array.

Until Next Time

We can't wait to see more weather and AZM clocks in the gallery!

Follow @fitbitdev on Twitter, and join our Fitbit Community Forum to keep in touch. Curious to see the amazing work Fitbit Developers have done so far? Keep tabs on #Made4Fitbit on Twitter.