差異處
這裏顯示兩個版本的差異處。
| 兩邊的前次修訂版 前次修改 下次修改 | 前次修改 | ||
| tech:owntrack [2025/05/26 17:04] – [Server 端] jonathan | tech:owntrack [2026/03/03 14:26] (目前版本) – 3. 匯出特定 user 或 device 在特定日期區間的軌跡資料作法 jonathan | ||
|---|---|---|---|
| 行 116: | 行 116: | ||
| docker compose exec mosquitto mosquitto_passwd / | docker compose exec mosquitto mosquitto_passwd / | ||
| </ | </ | ||
| + | - 建立 jonathan 存取 MQTT 的帳號密碼 Exp. jonathan / mypassword< | ||
| + | docker compose exec mosquitto mosquitto_passwd / | ||
| + | </ | ||
| ==== 手機端 ==== | ==== 手機端 ==== | ||
| - | | + | === 直接連 OTRecoder === |
| + | | ||
| + | * ++看畫面|{{: | ||
| * 設定 Endpoint 的 URL Exp. http:// | * 設定 Endpoint 的 URL Exp. http:// | ||
| - | * 設定 Credentials 的 Username 與 Password **要和 .env 內設定的相同** | + | * 設定 Credentials 的 Username 與 Password **要和 |
| + | * ++看畫面|{{: | ||
| - | ===== 透過 Cloudflare Tunnel | + | === 連 MQTT (才可看到 Friends) === |
| + | * Connection 要選 MQTT | ||
| + | * ++看畫面|{{: | ||
| + | * 設定 Endpoint | ||
| + | * Host/Port Exp. 192.168.11.200 / 9001 (WebSocket) | ||
| + | * Client ID Exp. jonathan (建議和 Credentials 的 Username 相同 | ||
| + | * Use WebSockets : 啟用 | ||
| + | * ++看畫面|{{: | ||
| + | * 設定 Identification | ||
| + | * Device ID Exp. pixel9 | ||
| + | * Tracker ID Exp. jt (會顯示在 Android 的地圖上) | ||
| + | * ++看畫面|{{: | ||
| + | * 設定 Credentials (設定在 mosquitto/ | ||
| + | * Username Exp. jonathan | ||
| + | * Password Exp. mypassword | ||
| + | * TLS 關閉 | ||
| + | * Parameters | ||
| + | * Keepalive : 3600 | ||
| + | * Clean Session : 啟動 | ||
| + | * ++看設定畫面|{{: | ||
| + | |||
| + | ===== 管理端可以看到畫面 ===== | ||
| + | * Frontend - http:// | ||
| + | * OTRecorder - http:// | ||
| + | |||
| + | ===== 設定 | ||
| * 這樣的設定好處是, | * 這樣的設定好處是, | ||
| + | |||
| + | ==== 透過 Cloudflare Tunnel 設定 OTRecorder 對外服務 ==== | ||
| + | < | ||
| * 以 Endpoint 的 URL Exp. http:// | * 以 Endpoint 的 URL Exp. http:// | ||
| - | ===== 管理端可以看到畫面 ===== | + | ==== 透過 Nginx Proxy Manager 設定 MQTT + WebSocket 對外服務 |
| - | * Frontend - http:// | + | * 以 Endpoint 的 Host: mqtt.ichiayi.com Port:80 為例, 預計對應成 |
| - | * OTRecorder - http://192.168.11.200:8083 \\ {{:tech:螢幕擷取畫面_2025-04-08_135120.png|}} | + | |
| + | |||
| + | |||
| + | ===== 常見問題 ===== | ||
| + | ==== 1. 合併兩個 rec 作法 ==== | ||
| + | * 因為在相同裝置 Exp. Android, 修改設定中的 Device ID, Username 就會在主機端自動建立不同的目錄 Exp. Device ID : pixel9 , Username | ||
| + | * 如果想要將 store/rec 內的紀錄檔 Exp. 2025-05.rec 進行合併 Exp. jonathan/ | ||
| + | - 備份與合併 2025-05.rec < | ||
| + | cd store/ | ||
| + | cp 2025-05.rec 2025-05.rec.bak | ||
| + | cat ../ | ||
| + | </ | ||
| + | - 將合併後的檔案依照資料時間進行排序 < | ||
| + | sort -s -k 1 2025-05.rec -o 2025-05.rec | ||
| + | </ | ||
| + | - 刪除 data.mdb 資料檔< | ||
| + | cd | ||
| + | rm -f store/ | ||
| + | </ | ||
| + | - 重起 otrecorder 服務< | ||
| + | docker compose restart otrecorder | ||
| + | docker compose logs -f otrecorder | ||
| + | </ | ||
| + | |||
| + | ==== 2. 刪除特定 user 或 device 作法 ==== | ||
| + | * 因為在相同裝置 Exp. Android, 修改設定中的 Device ID, Username 就會在主機端自動建立不同的目錄 Exp. Device ID : jonathan , Username : jonathan 就會在 store/rec 與 store/last 都會建立出 jonathan/ | ||
| + | - 針對這檔案型的作法就是直接刪除檔案 Exp. 刪除 jonathan/ | ||
| + | cd | ||
| + | rm -rf store/ | ||
| + | rm -rf store/ | ||
| + | rm -f store/ | ||
| + | </ | ||
| + | - 重起 otrecorder 服務< | ||
| + | docker compose restart otrecorder | ||
| + | </ | ||
| + | - 刪除 MQTT 的資料後, | ||
| + | rm mosquitto/ | ||
| + | docker compose restart mosquitto | ||
| + | </ | ||
| + | - 在 Android 需要進入 Friends-> | ||
| + | * ++看畫面|{{:tech:screenshot_20250526-191959.png?400|}}++ | ||
| + | |||
| + | ==== 3. 匯出特定 user 或 device 在特定日期區間的軌跡資料作法 ==== | ||
| + | * 語法 : < | ||
| + | * Exp. Device ID : pixel9 , Username : jonathan 在 2026-02-05 ~ 2026-02-23 的 gpx 軌跡資料< | ||
| + | curl -o mytrack_20260205-0223.gpx " | ||
| + | </ | ||
| ===== 參考網址 ===== | ===== 參考網址 ===== | ||