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

04-25-2022 01:49
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
Hi all,
I want to transfer sensor data to a MQTT broker using SDK 4.3 on fitbit studio. I already have the data transfered from the versa 2 to the companion app.
But when I try to import the mqtt module the build is fine until I try to connect the client, resulting in the following error:
In companion app:
import * as MQTT from "mqtt";
let client = MQTT.connect('mqtt://localhost:1883')
Building companion
TypeError: can't assign to property "code" on true: not an object.
Details: watchFiles: /project/companion/index.js
Build failed.
Investigating the error, I could not find any occurence of something like <something true>.code = ... inside the mqtt module.
I tried using different nodejs modules, and some seem to work, while some others produce the same build error.
I also tried to change the version of the mqtt module inside package.json bu that does not seem to have an effect at all.
If anyone encountered a similar error, please let me know if you have a solution,
Thanks
04-25-2022 01:57
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


04-25-2022 01:57
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
I think MQTT requires TCP access. The Fitbit environment probably won't allow access to that. You're probably limited to fetch() or WebSockets.
Gondwana Software
