- Rust 97.2%
- D2 2.8%
|
Some checks failed
Rust / build (push) Has been cancelled
When calibration completed, PresenseManager only updated its own
in-memory config and the watch channel. Two bugs:
1. No subscriber to the watch channel calls Config::save(), so
baselines were lost on restart. The user had to recalibrate after
every boot.
2. PresenceConfig::publish was never called after calibration, so
Home Assistant / any MQTT consumer never saw the new baselines /
threshold / debounce_count on opensleep/state/config/presence/*.
MQTT's 'state/presence/{any,left,right}' still updated (via
update_mqtt from update_presence) but the calibration values
themselves stayed invisible.
Fix in sensor/presence.rs::update_calibration: after writing the new
PresenceConfig to memory and the watch channel, spawn a short async
task that calls new_cfg.publish(&mut client) and full_cfg.save(...).
Done in a spawned task so the sensor select loop doesn't block on
MQTT or file I/O.
Other changes:
- Make config::CONFIG_FILE pub so presence.rs can reference it
- Make config::mqtt::PresenceConfig::publish pub so presence.rs can
call it (previously only used by the set_presence_config action)
- Cosmetic: add a couple more diagnostic log lines during calibration
(samples-processed count, published/saved confirmations) and a
'Presence change' INFO log when the computed state flips, which is
useful for verifying the sensors are healthy without a debug build.
|
||
|---|---|---|
| .cargo | ||
| .github/workflows | ||
| images | ||
| src | ||
| .gitignore | ||
| BACKGROUND.md | ||
| Cargo.lock | ||
| Cargo.toml | ||
| example_couples.ron | ||
| example_solo.ron | ||
| HASS.md | ||
| LICENSE | ||
| MQTT.md | ||
| opensleep.service | ||
| README.md | ||
| SETUP.md | ||
opensleep
Open-source Rust firmware for the Eight Sleep Pod 3 that completely replaces Eight Sleep's proprietary software stack.
Disclaimer
This project is for educational and research purposes only. It is for personal, non-commercial use and is not affiliated with, endorsed by, or sponsored by Eight Sleep. The Eight Sleep name and Pod are trademarks of Eight Sleep, Inc.
Using opensleep will prevent the Eight Sleep mobile app from working and may (though unlikely) permanently alter or damage your device. Use at your own risk.
What is Eight Sleep?
The Eight Sleep Pod 3 is a smart mattress cover that uses water circulation to control temperature (55°F to 110°F) and tracks sleep metrics. While powerful, Eight Sleep's default firmware streams all sleep data to their servers, including when you're in bed, how many people are in bed, and your sleep patterns.
Why Replace the Firmware?
- Complete Privacy: All data stays local.
- Smart Home Integration: Direct control through Home Assistant, MQTT, or custom automations instead of being locked to Eight Sleep's app.
- Enhanced Features: Custom temperature profiles, alarms, etc.
Features
- MQTT interface for remote configuration and state monitoring
- Configuration via Ron file
- Presence detection
- Custom temperature profiles with unlimited points, automatically distributed between
sleepandwaketimes - Vibration alarms relative to
waketime (offsets and vibration settings are configurable) SoloorCouplesmodes- LED control with custom effects
- Daily priming
How This Differs from Other Projects
Other projects like ninesleep and freesleep work by replacing the Device-API-Client (DAC). By replacing the DAC, they can communicate directly with frankenfirmware and send temperature commands, receive sleep tracking data, set alarms, etc.
opensleep replaces all Eight Sleep programs, communicating directly with the microcontrollers that manage sensors and temperature control. This enables real-time sensor data access and complete control over the Pod's behavior.
Technical Overview
The Eight Sleep Pod 3 consists of:
- SOM (System-On-Module): A Variscite i.MX 8M Mini running Yocto Linux, acting as the master controller
- Sensor Subsystem: STM32 microcontroller managing temperature sensors, capacitance sensors (for presence), piezoelectric sensors, and vibration motors
- Frozen Subsystem: STM32 microcontroller managing thermoelectric coolers, water pumps, and priming components
Eight Sleep's stock firmware runs three main programs on the SOM:
- DAC (Device-API-Client): Communicates with Eight Sleep's servers
- Frank (frankenfirmware): Controls both subsystems via USART
- Capybara: Manages LEDs and Bluetooth setup
opensleep replaces all three programs, communicating directly with the Sensor and Frozen subsystems via their USART protocols.
For detailed technical information, see BACKGROUND.md.
Setup
Setting up opensleep requires SSH access to the Pod's SOM, which involves hardware modification. This is not trivial and requires technical expertise. Some Pod variants require specialized tools.
Compatibility:
- ✅ Pod 3: Fully supported (the only version tested with opensleep)
- ⚠️ Pod 4/5: Untested. SSH setup possible but Pod-specific features not implemented. If you'd like to help add support, please contact me.
- ❌ Pod 1/2: Not possible
See detailed setup instructions in SETUP.md.
MQTT Integration
opensleep exposes full control and monitoring through MQTT. You can:
- Monitor presence, temperature, and sensor data in real-time
- Adjust temperature profiles, alarms, and settings
- Trigger actions like calibration (for presence detection)
See the complete MQTT specification in MQTT.md.
Home Assistant
opensleep integrates cleanly with Home Assistant via MQTT. You can build custom dashboards and automations.
See Home Assistant configuration examples in HASS.md.
Roadmap
- Use Sensor subsystem bed temperature readings to improve Frozen temperature control
- Sleep Tracking: Heart rate, HRV, and breathing rate analysis
- Advanced LED patterns using direct current level control
Development
Run in debug mode:
RUST_LOG=debug,rumqttc=info ./opensleep
(This prevents rumqttc from spamming logs)
Contact
If you encounter issues, please open an issue on this repository. For other inquiries, contact me at mail@liamsnow.com.
