# GUM Smart Toothbrush (Playbrush) for Home Assistant [![HACS Custom](https://img.shields.io/badge/HACS-Custom-orange.svg)](https://hacs.xyz) [![Validate](https://github.com/scomans/playbrush-ha/actions/workflows/validate.yml/badge.svg)](https://github.com/scomans/playbrush-ha/actions/workflows/validate.yml) [![Tests](https://github.com/scomans/playbrush-ha/actions/workflows/tests.yml/badge.svg)](https://github.com/scomans/playbrush-ha/actions/workflows/tests.yml) [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE) Unofficial Home Assistant integration for the **GUM Playbrush** smart toothbrush (the brush advertises itself over Bluetooth Low Energy as `Playbrush`). It runs completely locally over Bluetooth, no cloud and no account needed. The BLE protocol was reverse engineered from one brush (model `PBAv3.4.0`, firmware `1.2.5`). See [docs/protocol.md](docs/protocol.md) for everything that is known, and what is not. > **Unofficial.** This project is not affiliated with, endorsed by or supported by GUM, Sunstar or Playbrush Ltd. > Brand names and logos belong to their owners. ## Features - Detects when you brush (motor running) and measures the brushing time - Contact pressure while brushing, as a value and as a level (none / light / medium / hard) - Rough position of the brush (left / right / neutral / idle) - Battery: estimated percentage, a low-battery flag (red LED on the brush) and the raw value - Charging detection - "Last brushed" timestamp that survives restarts and does not reset at midnight - Device information (model, firmware, serial number) is read from the brush ## Requirements - Home Assistant 2024.11 or newer (the integration logo is only shown on 2026.3 or newer, everything else works without it) - The [Bluetooth integration](https://www.home-assistant.io/integrations/bluetooth/) with a working adapter or an [ESPHome Bluetooth proxy](https://esphome.io/components/bluetooth_proxy.html) within range of the bathroom ## Installation ### HACS (custom repository) [![Open your Home Assistant instance and open this repository in the Marketplace.](https://my.home-assistant.io/badges/marketplace_repository.svg)](https://my.home-assistant.io/redirect/marketplace_repository/?owner=scomans&repository=playbrush-ha&category=integration) Use the button above, or add the repository by hand: 1. In HACS open the three-dot menu, choose **Custom repositories** and add `https://github.com/scomans/playbrush-ha` as category **Integration**. 2. Install **GUM Smart Toothbrush (Playbrush)** and restart Home Assistant. ### Manual 1. Copy the folder `custom_components/gum` of this repository to `/custom_components/gum`. 2. Restart Home Assistant. ## Setup 1. Close the official app (the brush accepts only **one** Bluetooth connection at a time). 2. Shake the brush or switch the motor on. It only advertises while it is awake. 3. The brush is discovered automatically as **GUM**. Otherwise go to **Settings > Devices & services > Add integration > GUM** and pick it from the list. ### Options **Settings > Devices & services > GUM > Configure** | Option | Default | Description | |---|---|---| | Disconnect after idle (seconds) | 20 | While connected the brush streams sensor data and stays awake. After this many seconds without motor or movement the integration disconnects so the brush can go back to sleep (5-300). | ## Entities | Entity | Type | Description | |---|---|---| | Brushing | binary sensor | On while the motor runs. | | Charging | binary sensor | On when the brush was put on the charger. The brush cannot be reached while charging, so this is derived from what it reports right before the connection drops and stays on until the brush is seen again. | | Battery low | binary sensor | The brush's own low-battery warning (its LED blinks red). | | Connected | binary sensor (diagnostic) | Bluetooth connection state. Turns off by design after the idle time. | | Battery (estimated) | sensor, % | Estimated from the brush's supply-voltage value. Only updated with the motor off, at least 10 s after it stopped. See [Limitations](#limitations). | | Battery (raw) | sensor (diagnostic) | The raw value: about 130 full, about 109 when the warning starts, about 101 when the brush switches off. | | Pressure | sensor, % | Contact pressure of the brush head, 0 when the motor is off. | | Pressure level | sensor | none / light / medium / hard (rough thresholds from one person's test). | | Position | sensor | idle / neutral / left / right: a coarse roll class, not a tooth-zone detection. | | Last brushing time | sensor, s | Duration of the last brushing. Motor sessions that start less than 60 s after the previous one ended (for example after a dropped Bluetooth link) are added up. | | Brushing time today | sensor, s | Motor time today. Resets at midnight and when Home Assistant restarts. | | Last brushed | sensor, timestamp | End of the last brushing that lasted at least 20 s in total (fragments less than 60 s apart count together). Restored after a restart. | | Movement | sensor (diagnostic, disabled by default) | Movement intensity 0-100. | ## How it works - **Connecting.** The brush only advertises while it is awake (shaken, lifted, motor on) and sends identical advertisements every time. Home Assistant does not forward unchanged advertisements to integrations, so the integration also checks once per second whether a new advertisement was seen and then connects. - **Staying awake.** The brush does not disconnect by itself while a client is subscribed (tested: still connected after 15 minutes on the table, streaming 20 frames per second). The integration therefore disconnects after the idle time and ignores advertisements for 20 s afterwards (the brush sends a few more packets for about 11 s before it sleeps). - **Brushing time.** The brush reports no elapsed time. If the motor is already running when the integration connects, the start is estimated from the moment the brush woke up (first advertisement after at least 15 s of silence, at most 45 s ago). For the most accurate time: shake the brush, wait until **Connected** is on, then start the motor. - **Battery.** The brush reports a supply-voltage value that sags under motor load and recovers within about 10 s after the motor stops. The percentage is interpolated from one full discharge run (see [docs/protocol.md](docs/protocol.md#battery)). ## Limitations - The brush can only be reached while it is awake, and not at all on the charger. Between uses the entities show the last known values. - The battery percentage is an **estimate** from one brush and one continuous discharge run. Rest values recover by 1-2 units after long pauses, so the estimate tends to read slightly low. Real calibration needs more brushes and runs. - Pressure levels and the position classes are rough. Position distinguishes left and right, not upper and lower teeth. - The official app keeps a brushing history. This integration does not read or write anything of that kind: no history, no settings, no commands are sent to the brush. ## Troubleshooting - Close the official app and shake the brush firmly or switch the motor on briefly. - Check **Settings > Devices & services > Bluetooth > Advertisement monitor** (Advanced) to see whether Home Assistant sees the brush at all. If not, it is an adapter or range issue. - Enable debug logging, restart, shake the brush and look for lines with `custom_components.gum`: ```yaml logger: logs: custom_components.gum: debug ``` Expected lines: `new advertisement seen (poll) -> connecting`, `connected`, later `idle for 20 s, disconnecting`. ## Development ```bash python -m unittest discover -s tests -v ``` The tests replay recorded sensor captures (`tests/data`) through the parser and the device state machine; Home Assistant itself is not needed. Scripts for exploring the brush and for recording new captures are in [tools/](tools/README.md). How to record the official app's Bluetooth traffic is described in [docs/capturing-app-traffic.md](docs/capturing-app-traffic.md). ## Contributing Reports from other models and firmware versions are very welcome, in particular battery runs (raw value against the app's bars) and the meaning of the unknown bytes listed in [docs/protocol.md](docs/protocol.md#open-questions). ## AI disclosure This project was developed with the help of an AI coding assistant ([Claude Code](https://claude.com/claude-code) by Anthropic). Large parts of the code, the tests, the tools, the documentation and the analysis of the Bluetooth protocol were written or drafted with it, together with a human who ran the experiments on a real brush and uses the integration. The behaviour was checked against recorded data from one brush and by the unit tests, but AI-written code can contain mistakes and the protocol notes are inferences, not manufacturer documentation. Please review the code before you rely on it, and report anything that looks wrong. ## License [MIT](LICENSE)