Skip to content

Instantly share code, notes, and snippets.

@rootasjey
Last active November 23, 2018 19:09
Show Gist options
  • Save rootasjey/63d323708b4279b9a388c3f225edc2ac to your computer and use it in GitHub Desktop.
Save rootasjey/63d323708b4279b9a388c3f225edc2ac to your computer and use it in GitHub Desktop.
Fitbit settings companion messaging
// Companion
import * as messaging from "messaging";
sendValue('weatherRefreshTime', time);
function sendValue(key, val) {
if (val) {
sendSettingData({
key: key,
value: JSON.parse(val)
});
}
}
function sendSettingData(data) {
// If we have a MessageSocket, send the data to the device
if (messaging.peerSocket.readyState === messaging.peerSocket.OPEN) {
messaging.peerSocket.send(data);
return;
}
console.log("No peerSocket connection");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment