- Creates folder based environment variables which can be defined in ./.envrc
- Installation: https://direnv.net/#basic-installation
- After every change of the .envrc file you need to allow the changes with the command
$ direnv allow . - Test env variables in python
import os print ("test1: %s" % os.environ.get('DB_HOST')) print ("test2: %s" % os.environ.get('CLIENT_SECRET'))
- First installation
$ python3 -m venv python-venv - Change into virtual environment
$ source python-venv/bin/activate - Install python dependencies
$ pip3 install python-dateutil fitbit influxdb - Write requirements.txt for reinstallation (optional)
$ pip freeze > requirements.txt $ pip install -r requirements.txt - Deactivate venv
$ deactivate
- https://gitlab.com/fsvm88/fitbit-api-exporter
- Use only api_poller.py
- Diff Changes
170,171c170,171 < 'elevation': None, # dateTime, value < 'floors': None, # dateTime, value --- > # 'elevation': None, # dateTime, value > # 'floors': None, # dateTime, value 187,188c187,188 < 'elevation', # dateTime, value < 'floors', # dateTime, value --- > # 'elevation', # dateTime, value > # 'floors', # dateTime, value 212,215c212,215 < 'foods_log': [ < 'caloriesIn', < 'water' < ], --- > # 'foods_log': [ > # 'caloriesIn', > # 'water' > # ],
- /lib/systemd/system/fitbit.service
[Unit] Description=Fitbit Data Import After=multi-user.target [Service] Type=idle ExecStart=/home/plex/Documents/Scripts/fitbit/scripts/api_poller-CLI.sh > /tmp/fitbit-log.txt 2>&1 [Install] WantedBy=multi-user.target sudo systemctl daemon-reloadsudo systemctl enable fitbit.servicesudo systemctl start fitbit.servicesudo systemctl status fitbit.servicesudo systemctl stop fitbit.servicesudo systemctl disable fitbit.service