## Half Decent Web Apps
This collection showcases three web applications built with plain JavaScript, HTML, and CSS. They demonstrate various functionalities available through Web Bluetooth Low Energy (Web BLE), Wi-Fi, and Web USB. These apps will open up new ways to interact with your Half Decent Scale. They provide powerful tools for quality control, precise weighing, and simplified dosing directly from your web browser.
Get hands-on with our web tools. This is currently available for desktop/laptop browsers, Android, and iOS devices via the scale's Wi-Fi connection.
Connecting your Half Decent Scale to our web apps is straightforward. Follow these steps:
It is essential to check the browser. Use only the latest version of Google Chrome (version 136 or newer) or Microsoft Edge (version 136 or newer).
Navigate to one of the app links provided above.
Put your Half Decent Scale into Bluetooth pairing mode.
Once connected, the "Connect" button will turn red and change its text to "Disconnect." You will also see live weight updates from your scale displayed on the screen.
Click the "Start" button and follow the on-screen instructions specific to the app you're using.
Using USB-C Connection :
Our apps also support a direct USB-C connection. If you choose this method:
Use the WIFI Connection (firmware 3.0.0 required) :
Half Decent Scale now uses WiFi for additional features and connectivity.
You can enable or disable Wi-Fi there and view the current Wi-Fi details.
HDS will open its own WiFi, called "Decent Scale." It is protected with a password: '12345678.'
Connect HDS to your home WiFi (2.4 GHz) by going to the hds.local page and entering your WiFi ID and password.
Restart the scale to apply the new settings. Store your WiFi settings correctly and keep your HDS in signal range. If you don't, it will return to its own WiFi (Decent Scale), allowing you to change the settings again if needed.
These web applications serve two main goals:
These apps are ideal for:
The codebase is designed to be understandable and adaptable. The "Weigh and Save" and "Dosing Assistant" features boast a modular structure, while "Quality Control Assistant" uses a monolithic structure, offering a potentially simpler overview of function interactions.
Key JavaScript modules and their roles:
scale.js: Handles BLE protocol, communication with the Half Decent Scale (HDS), and core dosing mode functionality.constants.js: Stores pre-programmed 10-byte messages for HDS communication and various threshold values.state-machine.js: Implements the core logic for "Dosing Assistant" and "Quality Control Assistant" using a Finite State Machine model.export.js: It manages the functionality for exporting weight readings and evaluation data as CSV or JSON files.presets.js: Allows users in "Dosing Assistant" and "Quality Control Assistant" to save target weights as presets, cached locally by the browser.ui-controller.js: Manages updates and changes to the HTML interface.modules/connection : Contains the specific implementations for BLE and USB connection methods.modules/reconnecting-websocket.js/ : A simple module to help you reconnecting websocket automatically, recommend to use if the wifi strength is not strong enough.Refer to the Programmer's Guide to the Half Decent Scale. for comprehensive details on the scale's communication protocols.
Follow these simple steps to get a local copy up and running:
web_apps Directory: GitHub does not offer a direct download for subdirectories. Use a specialized tool for this. Here are a couple of options:web_apps directory on GitHub: https://github.com/decentespresso/openscale/tree/main/web_apps cd web_apps/dosing_assistant
Since these are web applications using Web BLE, they need to be served over https:// or http://localhost
You can use a simple NPX HTTP server or any other local server you prefer.
http.server: npx http-server -p 8000
Then, open your Chrome browser and navigate to either:
http://localhost:8000/weigh_save.html
http://localhost:8000/dosing_assistant.html
This project is open source, and we strongly encourage developers to explore, learn from, and contribute to the codebase.
#app
#usb
#WIFI