01-02-2022 05:50
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

01-02-2022 05:50
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Hi everyone,
My Fibit Versa 3 won't display the stats (steps, hr, cals) when I run my code but the simulator will. You can see this below, the left is the simulator and the right is mine
(Ignore the HR not appearing in the simulator, I have fixed that but that didn't change the lack of stats on my watch.)
Here is my JS code:
import clock from "clock";
import * as document from "document";
import { preferences } from "user-settings";
import * as util from "../common/utils";
import { me as appbit } from "appbit";
import { today } from "user-activity";
import { HeartRateSensor } from "heart-rate";
import { BodyPresenceSensor } from "body-presence";
/*if (HeartRateSensor && appbit.permissions.granted("access_heart_rate")) {
const hrm = new HeartRateSensor();
hrm.start();
}*/
const myHRM = document.getElementById("myHRM");
// Update the clock every minute
clock.granularity = "minutes";
// Get a handle on the <text> element
const myLabel = document.getElementById("myLabel");
// Update the <text> element every tick with the current time
clock.ontick = (evt) => {
let today = evt.date;
let hours = today.getHours();
if (preferences.clockDisplay === "12h") {
// 12h format
hours = hours % 12 || 12;
} else {
// 24h format
hours = util.zeroPad(hours);
}
let mins = util.zeroPad(today.getMinutes());
myLabel.text = `${hours}:${mins}`;
}
const mySteps = document.getElementById("mySteps");
const myCalories = document.getElementById("myCalories");
if (appbit.permissions.granted("access_activity")) {
console.log(`${today.adjusted.steps} Steps`);
mySteps.text=`${today.adjusted.steps}`;
if (today.local.calories !== undefined) {
myCalories.text=`${today.adjusted.calories}`;
console.log(`${today.adjusted.calories} calories`);
}
}
const hrm = new HeartRateSensor();
if (HeartRateSensor) {
const hrm = new HeartRateSensor({ frequency: 1 });
hrm.addEventListener("reading", () => {
myHRM.text=`${hrm.heartRate}`;
});
hrm.start();
}
And the index.view
<svg class="background">
<image href="plants01.jpg" />
<text id="dayLabel"></text>
<text id="myLabel"></text>
<svg id="stepsLoc" >
<image id="stepsIcon" href="steps_36px.png" load="sync"/>
<text id="mySteps"></text>
</svg>
<svg id="hrmLoc" >
<image id="hrmIcon" href="heart_rate_36px.png"/>
<text id="myHRM"></text>
</svg>
<svg id="caloriesLoc" >
<image id="caloriesIcon" href="calories_36px.png"/>
<text id="myCalories"></text>
</svg>
</svg>

01-02-2022 06:50
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


01-02-2022 15:11
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

01-02-2022 15:11
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Hi Guy, thanks for the reply. I have all permissions in the package.json files ticked (except the App Cluster Storage).
I've actually tried using someone else's code from github and still having the same issue =(

01-04-2022 08:16
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


01-04-2022 08:16
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
As Guy_ said, you should move things inside the tick event, but what's in the CSS file? Make sure you're using the System font family. https://dev.fitbit.com/build/guides/user-interface/css/#fonts
01-04-2022 23:12
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

01-04-2022 23:12
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Having the same problem... Heart Rate and Clock shows up fine but anything from Web API don't show. But works beautifully on Studio.
(I'm on a Sense btw, if that helps at all)

01-04-2022 23:49 - edited 01-04-2022 23:49
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


01-04-2022 23:49 - edited 01-04-2022 23:49
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
01-05-2022 17:33
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

01-05-2022 17:33
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
I turned off firewall and any kind of security for a moment and tested it, it still didn't work. If that were the case then why would it work on the Simulator still?

01-05-2022 20:27
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


01-05-2022 20:27
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
Make sure all necessary permissions are set in package.json (or Studio). Sim doesn't check permissions; watch does.
Gondwana Software
01-05-2022 23:54
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

01-05-2022 23:54
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
Excuse me while I bury my head in embarrassment... But you did point me in the right direction! I didn't think to click "Internet" in the requested permissions in package.json. That apparently allows specifically the Companion app to communicate with the database. Thanks!
@Gondwana wrote:Make sure all necessary permissions are set in package.json (or Studio). Sim doesn't check permissions; watch does.
01-06-2022 00:05
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


01-06-2022 00:05
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Yeah, the oauth and the data fetch definitely use the internet.
Gondwana Software

