by Ron Deagle
Turns on Bluetooth when the FitBit app is in the foreground, to enable FitBit syncing.
Once you close the app (assuming that you close it after the sync completes), the flow will determine if another device is connected via Bluetooth (I.e. it's possible that Bluetooth was enabled/connected prior to the FitBit sync).
If another device isn't connected, Bluetooth will be disabled until the next time that the FitBit app is in the foreground. If another device IS connected, it will not disable Bluetooth, allowing the other device to continue working.
This flow is a modified variant of the Auto FitBit Bluetooth found in the Automate community. It was created to fit my use case, taking into account that I use my phone to stream music to my truck stereo via Bluetooth (and if I'm in the middle of doing that, then decide to sync, I didn't want my audio to stop when Bluetooth was disabled after FitBit sync).