Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/genericerror000/gdbg
get dexcom blood glucose
https://github.com/genericerror000/gdbg
dexcom gnome-shell-extension macos pydexcom
Last synced: about 1 month 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 (2 months ago)
- Default Branch: main
- Last Pushed: 2024-11-18T22:10:19.000Z (about 2 months ago)
- Last Synced: 2024-11-18T22:45:19.198Z (about 2 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 app that displays blood glucose in the macos menu bar. retrieves blood glucose from dexcom via the [pydexcom](https://github.com/gagebenne/pydexcom) library. it also writes the blood glucose and trend arrow to a state file that can 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 and would recommend 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. download zip from [releases](https://github.com/GENERICERROR000/gdbg/releases)
2. unzip and move to `Applications folder`
3. setup credentials
*__this file must be created manually__*
* `~/.dexcom/dexcom_credentials.json`
```json
{
"username" : "dexcom_username",
"password": "dexcom_password"
}
```4. run app or add it to your login items on mac
## blood glucose state file
this file is generated by the app
* `~/.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.
### using in zsh $PROMPT
```sh
# ~/.zshrcfunction 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"
fiecho "${color}${value} (${delta}) ${arrow}${END}"
}# backslash in `\$(...)` is required for the value to update every time
export PROMPT="$PROMPT\$(get_bg)"
```## manually building macos statusbar app
using [anaconda](https://docs.anaconda.com/anaconda/install/mac-os/#command-line-install) on macos
```sh
# (1) create virtual environment
conda create --name gdbg python=3.11
conda activate gdbg# (2) install requirements
pip install --no-cache-dir -r requirements.txt# (3) build app
python macos_statusbar/setup.py py2app -A# (4) run app from terminal to see errors
dist/gdbg.app/Contents/MacOS/gdbg
```### known issues
when building, if you get the error that the library `libffi.8.dylib` is missing, you can install it with `brew`.
```sh
brew install libffi
```## credits
assets
* logo by [izzy bulling - @izval](https://www.instagram.com/izval/)
* [modak](https://github.com/EkType/Modak) font used in logopackages
* [gagebenne/pydexacom](https://github.com/gagebenne/pydexcom)
* [jaredks/rumps](https://github.com/jaredks/rumps)
* [dante-biase/py2app](https://github.com/dante-biase/py2app)## references
* [kylebshr/luka-mini](https://github.com/kylebshr/luka-mini/tree/main)
* [Create a macOS Menu Bar App with Python (Pomodoro Timer) - Camillo Visini](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/)## TODO
__(1)__
* [ ] how to handle stale data?
* [ ] show data is stale after 10 ior 15 min?__(2)__
* [ ] linux version (branch:`gnome_extension`)
* [ ] run `dexcom_handler.py` as service
* [ ] create gnome top bar extension
* [ ] use timestamp in state file for "last updated"
* [ ] update readme