-
-
Notifications
You must be signed in to change notification settings - Fork 8
Scale Gateway
The EverShelf Scale Gateway is an Android app that bridges a Bluetooth LE smart scale to EverShelf, enabling automatic weight-based inventory tracking.
Smart Scale
│ (Bluetooth LE)
▼
Android device (Scale Gateway app)
│ (WebSocket — ws://127.0.0.1:8765)
▼
EverShelf Server (scale_relay.php — SSE relay)
│ (Server-Sent Events)
▼
EverShelf Web App (auto-fills weight in add/use forms)
The Gateway runs a local WebSocket server on port 8765. The EverShelf server proxies scale readings to the browser via SSE, avoiding HTTPS→WS mixed-content issues.
Current version: v2.1.0 — requires Android 7.0+
| Protocol | BLE Service | Notes |
|---|---|---|
| Bluetooth SIG Weight Scale |
0x181D / char 0x2A9D
|
Most compatible |
| Bluetooth SIG Body Composition |
0x181B / char 0x2A9C
|
Weight + body fat |
| Generic fallback | Any notifiable characteristic | Auto-heuristic for 100+ models |
Verified compatible models:
- Xiaomi Mi Body Composition Scale 2
- Renpho Smart Body Fat Scale
- Any scale supported by openScale
Download and install the APK. You may need to enable "Install from unknown sources" in Android Settings.
Kiosk users: the Setup Wizard installs the gateway automatically in Step 5.
The gateway server starts immediately. Note the Gateway URL shown (e.g. ws://192.168.1.100:8765).
In EverShelf Settings → Scale:
- Enable scale integration
- Enter the Gateway URL (or let auto-discovery find it)
Kiosk users: this is done automatically during setup.
Tap "Cerca Bilance Bluetooth" (Find Bluetooth Scales). Make sure your scale is powered on. Tap it in the list to pair and connect.
When scale integration is enabled:
- Open the Add or Use form for any product with unit
gorml - A "⚖️ Leggi bilancia" button appears
- Tap it — a live weight display appears with a stability indicator
- Step on or place the product on the scale
- When the reading stabilizes, a 5-second countdown starts
- The weight auto-fills the quantity field and the form submits
- 10g threshold — readings that haven't changed enough between products are ignored to prevent stale readings
- 12-second server-side dedup — a second scale-triggered deduction of the same product within 12 seconds is rejected (guards against BLE multi-fire)
-
ml conversion — when the product unit is
ml, the weight in grams is accepted and a hint is shown: "weight in grams → will be converted to ml"
The header of the EverShelf web app shows a real-time scale status icon (⚖️):
| State | Meaning |
|---|---|
| ⚖️ green | Connected and ready |
| ⚖️ amber | Searching / reconnecting |
| ⚖️ grey | Disconnected |
| ⚖️ red | Error |
Every 6 hours the gateway app checks GitHub releases. If a newer version is available, a banner appears with a one-tap download and install.
- Make sure BLE is enabled on the Android device
- Step on/shake the scale to wake it up (most scales enter sleep mode quickly)
- Some scales only advertise while someone stands on them
- Confirm the Gateway URL in EverShelf Settings matches the URL shown in the gateway app
- Check that the Android device and the EverShelf server are on the same network
- Tap "Disconnetti / Riconnetti" in the gateway app to refresh the WebSocket connection
- Make sure you are accessing EverShelf over HTTPS (not plain HTTP)
- The SSE relay (
scale_relay.php) handles the HTTP→WS bridging — ensure the relay script is reachable
cd evershelf-scale-gateway
./gradlew assembleRelease
# APK: app/build/outputs/apk/release/app-release.apkRequires Android Studio or JDK 17+ with the Android SDK.
The gateway uses the following GATT profile order:
-
Weight Scale (
0x181D) — standard weight only -
Body Composition (
0x181B) — weight + additional metrics - Generic fallback — subscribes to all notifiable characteristics and applies a heuristic parser that handles byte-order variations used by the majority of consumer smart scales
Weight values are extracted in kg, converted to grams, and broadcast over WebSocket as:
{ "weight_g": 1234, "stable": true, "unit": "g" }