48 lines
1.8 KiB
Markdown
48 lines
1.8 KiB
Markdown
# GadgetbridgeMqtt for TrueNAS Scale
|
|
|
|
This is a Gadgetbridge MQTT bridge for TrueNAS Scale, which allows you to connect your Gadgetbridge database to Home Assistant or other MQTT clients.
|
|
|
|
## Setup
|
|
|
|
- copy content [```compose.yaml```](./compose.yaml) your TrueNAS Scale Apps -> Discover Apps -> ⋮ -> Install via YAML
|
|
- edit
|
|
- mount point for your Gadgetbridge database
|
|
- your Timezone
|
|
- environment variables for your MQTT broker
|
|
- start the app
|
|
|
|
## Editing Sensors
|
|
|
|
- add new mqtt sensor around here [main.py#L90](https://git.olli.info/Oliver/GadgetbridgeMqtt/src/branch/main/main.py#L90)
|
|
- add new function for new sensor around here [main.py#L208](https://git.olli.info/Oliver/GadgetbridgeMqtt/src/branch/main/main.py#L208)
|
|
|
|
## Automated Gadgetbridge DB Shrink & Sync
|
|
|
|
### 1. Install Apps (F-Droid)
|
|
* **Termux** (Terminal)
|
|
* **Termux:Boot** (Auto-start scripts)
|
|
|
|
### 2. Configure Apps
|
|
* **Gadgetbridge:** Settings → Auto Export → Location: `/sdcard/Documents/GB_Raw`
|
|
* **Nextcloud:** Auto Upload → Custom Folder → Local: `/sdcard/Documents/GB_Sync` → Remote: `/Backup/Gadgetbridge`
|
|
* **Termux:Boot:** Open app once to initialize.
|
|
|
|
### 3. Termux Setup (Run these commands)
|
|
```bash
|
|
# 1. Setup storage & install python
|
|
termux-setup-storage
|
|
pkg update -y && pkg install -y python wget
|
|
|
|
# 2. Create script directories
|
|
mkdir -p ~/scripts ~/.termux/boot
|
|
|
|
# 3. Download python script
|
|
wget -O ~/scripts/shrinkdb.py https://git.olli.info/Oliver/GadgetbridgeMqtt/raw/branch/main/termux_setup/shrinkdb.py
|
|
|
|
# 4. Create autostart launcher
|
|
printf '#!/data/data/com.termux/files/usr/bin/sh\ntermux-wake-lock\npython ~/scripts/shrinkdb.py &\n' > ~/.termux/boot/start_gb
|
|
```
|
|
|
|
### 4. Finish
|
|
**Reboot your phone.**
|
|
The script will now run automatically, shrinking DBs from `GB_Raw` and placing clean versions in `GB_Sync` for Nextcloud. |