05-08-2019 13:44
05-08-2019 13:44
I'm hoping this isn't too hard to do. I have a project I'm starting to work on and I want to use my Versa to start and stop recording on a camera connected to a Raspberry Pi. My idea is that I will have an app on the Versa with start, stop, and a couple of other options. That app will used the communication api to send the button pressed to a companion app. But I'm not sure how to connect the companion app to something outside the Fitbit environment that isn't web based. The connection will have to be bluetooth. I could set up the Raspberry pi as an access point and connect the Android phone that way but I would lose internet connectivity that way. I would like the phone to still be usable for web browsing, etc.
05-08-2019 13:57
05-08-2019 13:57
There is no mechanism for communicating with bluetooth devices directly. You could run a websocket server or web server on your Pi, then communicate from the companion API to that.
05-08-2019 18:19
05-08-2019 18:19
Jon,
Thanks. But that would mean using WiFi wouldnt it between the companion app and the raspberry pi? Which would mean I would lose ability to browse websites, email, etc on the phone while using the companion.
What about sharing data between the companion app and another android app on the device. Basically having the companion poke an android app to do the bluetooth socket.
05-09-2019 02:54
05-09-2019 02:54
Both devices would need to be on the same wifi network, but that doesn't mean you can't access other sites. Another option would be to expose your Pi to the internet, or link it with an IFTTT trigger.
In theory you could run a local websocket server on the phone, and the companion could communicate with that, but keeping it all running can be a challenge with battery optimisation.
05-09-2019 10:35
05-09-2019 10:35
Jon,
It is looking like I will have to go the Android local WebSocket server route. The reason is I don't want to go to the actual external internet because I won't have a guarantee of connectivity to anything but the Fitbit, Phone, and RPi. The environment will be such that I don't know if I will have good cell service and probably won't have wifi, I might but I don't know for sure. So the connection will be Fitbit to Companion (BlueTooth), Companion to Android App (Websocket to Localhost), Android app to RPi (BlueTooth).