Fitbit Water Tracker for Home Assistant
It’s a bit puzzling why Fitbit and Home Assistant don’t already track water consumption together. Especially considering there is an endpoint for it!
But don’t worry, I have attempted to fill this thirst gap in the smart home world with this app!
This little script fetches and logs your daily water consumption data from your Fitbit account using the Fitbit API.
You can now keep an eye on your hydration levels right from your Home Assistant dashboard exactly like the steps, calories and other sensors offered by the Fitbit integration
How It Works:
- The app automatically fetches your daily water log from the Fitbit API every 30 minutes. I’ve also added a manual trigger that will fire the script when you enable the “trigger_script” input_boolean
Requirements:
To use the “Fitbit Water Tracker” app, you’ll need to set the following Fitbit API credentials in your Home Assistant:
-
input_text.access_token
: Your Fitbit API access token. Don’t have it? Follow the Fitbit API OAuth2 Tutorial to get one. -
input_text.refresh_token
: Your Fitbit API refresh token. Obtain it during the OAuth2 setup following the tutorial above. -
client_id
: Your Fitbit API client ID. You’ll need to create an app and get this from your Fitbit developer account. -
client_secret
: Your Fitbit API client secret. Also obtained during the app creation in your Fitbit developer account. -
input_text.user_id
: Your Fitbit user ID. It’s part of your Fitbit API credentials.
The access tokens last for 8 hours before having to be renewed, hence why both tokens are in as input_text objects - if someone can tell me a better way of declaring these I’d appreciate it but I can’t set them as arguments of the script since they need to be updated
When declaring the script in apps.yaml
, don’t forget to add client_id
and client_secret
along with other parameters.
Here’s an example of how to declare the script in apps.yaml
:
fitbit_water_tracker:
module: FitbitWaterLog
class: FitbitWaterLog
client_id: YOUR_FITBIT_CLIENT_ID
client_secret: YOUR_FITBIT_CLIENT_SECRET
Stay hydrated, fit, and fabulous with the Fitbit Water Tracker for Home Assistant. Let’s quench that thirst for data, one refreshing sip at a time!