https://github.com/genericerror000/gdbg
get dexcom blood glucose
https://github.com/genericerror000/gdbg
dexcom gnome-shell-extension macos pydexcom
Last synced: 29 days ago
JSON representation
get dexcom blood glucose
- Host: GitHub
- URL: https://github.com/genericerror000/gdbg
- Owner: GENERICERROR000
- License: mit
- Created: 2024-10-30T04:51:11.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-11-18T22:10:19.000Z (over 1 year ago)
- Last Synced: 2025-07-04T10:43:16.633Z (11 months ago)
- Topics: dexcom, gnome-shell-extension, macos, pydexcom
- Language: Python
- Homepage:
- Size: 12.1 MB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# gdbg

## overview
> gdbg: *get dexcom blood glucose*
a python service that retrieves/displays blood glucose from dexcom via the [pydexcom](https://github.com/gagebenne/pydexcom) library and writes it (and other info) to state file. the state file can then be used for displaying data in your terminal (or anything else you want).
this app was inspired by [kylebshr/luka-mini](https://github.com/kylebshr/luka-mini/tree/main). this is a *fantastic* app i and would recommend it for people who want a seamless app experience. i wanted to be able to access the blood glucose data outside of the app for other uses.

## how to use
1. clone repo
2. set up environment
```sh
python3 -m venv gdbg
source gdbg/bin/activate
```
3. install requirements
```sh
pip install -r requirements.txt
```
4. setup credentials
*__this file must be created manually__*
`~/.dexcom/dexcom_credentials.json`
```json
{
"username" : "",
"password": ""
}
```
5. run via cli
```sh
python cgm_service.py
```
## blood glucose state file
this file is generated by the app if set to write state
* `~/.dexcom/bg_status.txt`
format of the status is: `[bg] [delta] [trend arrow] '[reading timestamp]'`
the delta starts at 0 and will show change after second reading is retrieved.
### example usage in zsh $PROMPT
```sh
# ~/.zshrc
function get_bg() {
RED='\033[91m'
GREEN='\033[92m'
YELLOW='\033[93m'
END='\033[0m'
state_file=$(cat $HOME/.dexcom/bg_status.txt)
value=$(echo "$state_file" | cut -d' ' -f1)
delta=$(echo "$state_file" | cut -d' ' -f2)
arrow=$(echo "$state_file" | cut -d' ' -f3)
if [[ $value -ge 80 && $value -le 180 ]]; then
color="$GREEN"
elif [[ $value -gt 180 ]]; then
color="$YELLOW"
elif [[ $value -lt 80 ]]; then
color="$RED"
fi
echo "${color}${value} (${delta}) ${arrow}${END}"
}
# backslash in `\$(...)` is required for the value to update every time
export PROMPT="$PROMPT\$(get_bg)"
```
## references
* [kylebshr/luka-mini](https://github.com/kylebshr/luka-mini/tree/main)
(https://camillovisini.com/coding/create-macos-menu-bar-app-pomodoro)
* [Glucose Readings in a Terminal Prompt - Hart Hoover](https://harthoover.com/glucose-readings-in-a-terminal-prompt/)
## credits
assets
* logo by [izzy bulling - @izval](https://www.instagram.com/izval/)
* [modak](https://github.com/EkType/Modak) font used in logo
packages
* [gagebenne/pydexacom](https://github.com/gagebenne/pydexcom)
created by
* [GENERIC_ERROR](https://generic_error.xyz/)
-//-
## TODO:
* [ ] testing