Skip to content

HolyBitsLLC/esphome-prodigy-bed

Repository files navigation

esphome-prodigy-bed

ESPHome firmware that bridges a Leggett & Platt Prodigy 2.0 / Okin adjustable bed base to Home Assistant over WiFi.

The bed's under-bed control box speaks Bluetooth (either Bluetooth Classic SPP for the Bluegiga module beds, or BLE for the Okin variant). A small ESP32 board sits on the bedroom power strip, talks Bluetooth to the bed, and exposes everything to Home Assistant via the native encrypted ESPHome API. No HACS, no custom Python, no cloud.

⚠️ Status: functional alpha. Tested against the Bluegiga 88:6B:0F Bluetooth Classic Prodigy 2.0 base and the Okin BLE variant. PRs welcome.


What you get in Home Assistant

When the firmware is flashed and the bed is paired, Home Assistant's built-in ESPHome integration (no HACS) auto-discovers a single Bed Controller device with:

  • Switches: Bluetooth connection, Anti-Snore preset, Massage Wave, Massage Power, Under-Bed Lights
  • Buttons: Flat / Zero-G / Memory 1-4 presets, Save-To-Memory 1-4, Head/Foot Up/Down, Stop
  • Selects: Massage Head level (Off / Low / Medium / High), Massage Foot level
  • Number slider: Bed Motion Duration — controls how long each Head/Foot tap drives the motor (0.2 s – 10 s, default 1 s)
  • Sensors: uptime, WiFi RSSI / SSID / IP / MAC, ESPHome version, firmware version, BT/BLE link state

Tap any preset/motion/light/massage entity and the firmware will auto-connect Bluetooth on demand — there's no need to press a "Connect" button first.

A ready-made Lovelace dashboard with a press-and-hold pad is in home-assistant/dashboards/bed-control.yaml.


Hardware

Variant Bed transport Recommended board Notes
bed-classic-left.example.yaml / bed-classic-right.example.yaml Bluetooth Classic SPP M5Stack ATOM Lite (original ESP32) Required for Bluegiga 88:6B:0F Prodigy 2.0 boxes — those modules are BR/EDR only.
bed-ble-okin.example.yaml BLE GATT M5Stack NanoC6 (ESP32-C6) For the Okin / Reverie BLE variants.

You'll need (per bed):

  • 1× ESP32 board from above
  • 1× USB-C cable + 5 V power source
  • WiFi access on a 2.4 GHz SSID

See docs/HARDWARE.md for the BOM, photos, and optional 3D-printable enclosures.


Quickstart

git clone https://github.com/HolyBitsLLC/esphome-prodigy-bed.git
cd esphome-prodigy-bed

cp secrets.example.yaml secrets.yaml
$EDITOR secrets.yaml             # Fill in WiFi + generate keys

# 1) Discover your bed's Bluetooth MAC (hold the bed's BT pairing
#    button on the wired remote, or unplug the bed for 60s and re-plug):
./scripts/discover_bed.sh         # macOS / Linux with bluetoothctl
# or
python3 scripts/discover_bed.py   # cross-platform via bleak

# 2) Edit the example device YAML for your variant and replace
#    the bed_mac substitution:
$EDITOR bed-classic-left.example.yaml

# 3) Plug the ESP32 in via USB and flash:
pip install esphome
esphome run bed-classic-left.example.yaml

After the first flash, all subsequent flashes can be OTA over WiFi.

When the device boots, watch the onboard RGB LED — see docs/STATUS_LED.md for what each colour means.


Adding it to Home Assistant

  1. Plug in the ESP32 board and wait for the status LED to turn green (WiFi up + HA API up + Bluetooth link to the bed established).
  2. In Home Assistant, go to Settings → Devices & Services → Add Integration → ESPHome.
  3. Either accept the auto-discovery prompt or enter the device hostname (espbedleft.local by default) and port 6053.
  4. When prompted for the encryption key, paste the value of api_encryption_key from your secrets.yaml.
  5. The bed appears as a single device with all switches, buttons, selects, sensors, and the motion-duration slider.
  6. (Optional) Import the dashboard from home-assistant/dashboards/bed-control.yaml — it includes a press-and-hold motion pad.

Full setup guide: docs/HOME_ASSISTANT.md.


Repo layout

.
├── bed-classic-left.example.yaml    # Top-level ESPHome config (left bed, BT Classic)
├── bed-classic-right.example.yaml   # Top-level ESPHome config (right bed, BT Classic)
├── bed-ble-okin.example.yaml        # Top-level ESPHome config (BLE Okin variant)
├── secrets.example.yaml             # Template — copy to secrets.yaml
├── esphome/
│   ├── components/
│   │   └── prodigy_classic_bt/      # Custom C++ component for BT Classic SPP
│   └── packages/                    # Reusable ESPHome YAML packages
├── home-assistant/
│   ├── dashboards/bed-control.yaml  # Lovelace dashboard with press-and-hold
│   └── packages/                    # HA YAML automations / scripts
├── docs/
│   ├── HOME_ASSISTANT.md            # Full HA setup guide
│   ├── HARDWARE.md                  # Bill of materials + wiring
│   ├── STATUS_LED.md                # LED state colour reference
│   ├── TROUBLESHOOTING.md           # Common pairing & connection issues
│   ├── FURNIBUS_PROTOCOL.md         # The BT Classic packet protocol
│   └── ble-protocol/                # BLE GATT protocol notes (Okin/Gen2)
└── scripts/                         # Bluetooth discovery + probing tools

License

MIT — see LICENSE. The reverse-engineered protocol notes in docs/ were derived from clean-room analysis of the publicly available com.leggett.prodigy2 Android app and from the open-source smartbed-mqtt project.


Credits

About

ESPHome firmware for Prodigy 2.0/3.0 (Bluegiga/Furnibus) and Okin/Reverie (BLE) adjustable beds — runs on M5Stack ATOM Lite or NanoC6. Includes Home Assistant dashboard with press-and-hold motion.

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors