06-27-2021 22:12
06-27-2021 22:12
Hello!
Is there any way to transmit heart rate data into a pc? I am looking for a way to stream the data, or a very quick, close to real-time update to a standalone PC - without the added lag/difficulty of creating several layers of applications and transmit the data over the internet (WebAPI?). Ideally, an C# or python example would be greatly appreciated.
This is part of a university research project. I just need the live heart rate data and not other information from the user (not even UserId or any other personal identifier).
Thanks in advance!
Answered! Go to the Best Answer.
06-28-2021 00:30
06-28-2021 00:30
1. The watch can only communicate directly with the companion, so the short answer is 'yes'. You may be able to run the companion component within Fitbit's Win10 app, but I don't think that's as current as the Android and iOS versions so attempting to do so could create additional complications.
2. I don't think so. You're limited to what the API provides.
06-27-2021 23:28
06-27-2021 23:28
It's possible but very difficult. Multiple layers of code are unavoidable, although you can avoid streaming over the internet.
Recommended architecture:
06-28-2021 00:12
06-28-2021 00:12
Hello Peter! Thanks for the quick answer.
I was fearing that I would need some architecture like the one described, from reading other posts on the forum. Thank you for the clarification.
I have a couple of follow-up questions, if I may:
1. Is it mandatory to have the Companion App running on a phone or tablet? For my use case, it is a relay node that serves no purpose. Furthermore, it means that the data will travel wirelessly 2 times (from the watch to the companion, and then from the companion to the pc). If the answer is "Yes, you need the Companion App", then could the Companion app be made so as to run on a PC instead of a portable device?
2. I think I have enough expertise to manually set the communication protocol, to communicate directly with the PC - with some specification details. Would that be an option from the fitbit side? I repeat this is for a specific experiment setup at the University.
06-28-2021 00:30
06-28-2021 00:30
1. The watch can only communicate directly with the companion, so the short answer is 'yes'. You may be able to run the companion component within Fitbit's Win10 app, but I don't think that's as current as the Android and iOS versions so attempting to do so could create additional complications.
2. I don't think so. You're limited to what the API provides.
06-28-2021 01:39
06-28-2021 01:39
I understand. Thanks again for the quick answer, Peter.
Best,
06-28-2021 01:43
06-28-2021 01:43
👍I hope you have a go at it!
06-28-2021 13:42
06-28-2021 13:42
Amendment to suggested architecture...
It's possible that iOS has slacker security than Android, with the result that the companion component may be able to communicate directly with any machine on the same LAN without requiring https. If so, the server component could be hosted on the PC. The .net app itself could possibly perform the server role, which would eliminate one link in the chain.
In addition, rather than using a WebSocket to communicate between server and client .net app (assuming they must be distinct), it might be possible to handle that communication by developing your own API (or applying a prefabricated one). The .net client would need to register a callback function with the server; the server would call that function whenever it receives new data. It may be easier just to use WebSockets which already allow this across different operating systems.
07-01-2021 18:21
07-01-2021 18:21
Hello again Peter, apologies for the late reply, and thanks for the addendum!
I will give it a try.
I was wondering, could I hook up a client .net app to read directly from the WebSocket that the Companion app will be publishing? (Related to the architecture on your first reply). I am not sure why I would need an "internal" data relay inside the mobile device, i.e. from the Companion app to a 'server' app, and then to an external client app. Is there any limitation on the Companion app that I am not understanding? Thanks ahead!
07-01-2021 20:07
07-01-2021 20:07
The short answer to the question about a direct companion-to-.net connection is 'yes'.
The complication I see is security, and the situation depends on the companion's operating system:
Because my companion is on Android, and my desktop machine doesn't have the required certificate, I had to use a server app on Android to get the data off the device. Your circumstances may not be so constrained.
06-17-2023 05:53
06-17-2023 05:53
I dont know if you still need this but, There is a github repository that walks you trough a live view of the heartrate with pretty decent latency. I dont know if I can include links i will try https://github.com/bfroggio/heart-of-frogg