Introducing Half Decent Scale Web Apps


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.


Experience the Apps: Live Demos

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.

  • Weigh and Save: Your go-to app for general weighing tasks. Precisely measure items within a set timeframe and easily export the results for analysis or record-keeping.
  • Quality Control Assistant: Perfect for ensuring consistency. This app allows you to repeatedly weigh the same items, simplifying data tracking and quality checks.
  • Dosing Assistant: Simplify your dosing process with an intuitive interface designed for achieving accurate and repeatable measurements.
  • Cocktail Maker : This interactive app will guide you through all the steps of making classic cocktails from the famous “PDT Cocktail Book.”

Getting Started: How to Connect & Use

Connecting your Half Decent Scale to our web apps is straightforward. Follow these steps:

  1. Browser Check: 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).
  2. Open an App: Navigate to one of the app links provided above.
  3. Enable Pairing Mode: Put your Half Decent Scale into Bluetooth pairing mode.
  4. Connect via App:
    • Click the “Connect” button in the web application.
    • A pop-up window will appear, listing available Bluetooth devices.
    • Select “Decent Scale” from the list.
  5. Connection Confirmed: 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.
  6. Begin: 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:

  • First, connect your device to the Half Decent Scale via a USB-C cable.
  • Next, install the CH34X serial drivers on your device.
  • Select the USB connection from the drop-down menu, click “Connect,” and choose “USB Serial” from the pop-up list.
  • Connect it and the live weight updates will appear on the screen.

Use the WIFI Connection (firmware 3.0.0 required) : Half Decent Scale now uses WiFi for additional features and connectivity.

  • To enable WiFi mode, go to the HDS setup menu and find the “WiFi settings” entry. You can enable or disable Wi-Fi there and view the current Wi-Fi details.
  • If you toggle WiFi on/off, you must restart the scale for the new settings to take effect. HDS will open its own WiFi, called “Decent Scale.” It is protected with a password: '12345678.'
  • Once connected to this WiFi, navigate to hds.local or 192.168.1.1 using your browser to change the WiFi settings. 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.

Purpose & Audience

These web applications serve two main goals:

  • For Scale Users: Our Half Decent Scale tools are practical and easy to use. They enhance the functionality of the scale for everyday tasks.
  • For Developers: A real-world demonstration of Web Bluetooth and Web USB capabilities is essential to encourage exploration and innovation with these technologies.

These apps are ideal for:

  • Decent Espresso Machine and/or Half Decent Scale Owners: Maximize your daily weighing and coffee preparation routines.
  • Quality Control Professionals: Streamline weighing processes, improve consistency, and simplify data collection.
  • Developers & Tech Enthusiasts: Explore a practical implementation of Web BLE and Web USB in an IoT context.

For Developers: Technical Deep Dive

  • The code for these web apps is available in the web_apps directory of the openscale repo.
  • Foundation: It is built with standard HTML, CSS, and JavaScript.
  • Styling: Tailwind CSS is the utility-first approach to styling, ensuring a responsive and modern interface. Note: Tailwind is a CSS framework, but its core logic is in plain JavaScript, avoiding heavy JS frameworks.
  • Connectivity:
    • Web Bluetooth API (Web BLE): Enables wireless communication with the Half Decent Scale.
    • Web USB API: It provides an alternative wired connection method.
    • Browser Compatibility: Use Google Chrome (version 136 or newer) or Microsoft Edge (version 136 or newer), iOS, and Safari using the scale's Wi-Fi connection.
    • WIFI (Websocket): Upgrade half decent scale to firmware 3.0.0, then follow the instructions above to switch it on. HDS will now broadcast weight data and receive tare command via WebSocket endpoint. See example code here. here.
  • Data Storage: Data such as readings and presets are stored locally in the browser's local storage. Users can download their data as JSON or CSV files.

Code Structure & Key Modules

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.


Development Setup

Follow these simple steps to get a local copy up and running:

  1. Download the web_apps Directory: GitHub does not offer a direct download for subdirectories. Use a specialized tool for this. Here are a couple of options:
    • Use a web tool like DownGit or github1s.
    • Go to the tool's website.
    • Paste the URL to the web_apps directory on GitHub: https://github.com/decentespresso/openscale/tree/main/web_apps
    • Follow the tool's instructions to download the directory as a ZIP file.
    • Extract the downloaded ZIP file. This will create a web_apps folder.
  2. Navigate into the project directory: cd web_apps/dosing_assistant
  3. Serve the files with a local HTTP server: 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.

This project is open source, and we strongly encourage developers to explore, learn from, and contribute to the codebase.

#app #opensource #javascript #webweigh #halfdecentscale #bluetooth #usb #decentscale #weighing #WIFI


  • German: Einführung zu Half Decent Scale Web Apps
  • French: Présentation des applications Web Half Decent Scale

    Updated 2025/05/29