Skip to content

Comprehensive Home Assistant integration for Eight Sleep smart mattresses with custom Lovelace card, device actions, and real-time sleep monitoring

License

Notifications You must be signed in to change notification settings

grantnedwards/eight-sleep

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Eight Sleep Integration for Home Assistant

A comprehensive Home Assistant integration for Eight Sleep smart mattresses and mattress covers, featuring a beautiful custom Lovelace card, device actions, enhanced error handling, and real-time sleep stage tracking.

hacs_badge maintainer license

πŸ“‹ Description

This integration provides comprehensive control and monitoring for Eight Sleep smart mattresses and mattress covers. It includes real-time temperature control, sleep stage tracking, biometric monitoring, and a beautiful custom Lovelace card for easy bed management.

Key Features:

  • πŸŽ›οΈ Real-time temperature control with custom Lovelace card
  • πŸ“Š Comprehensive sleep stage and biometric monitoring
  • πŸ”§ Device actions for automation integration
  • πŸ›‘οΈ Enhanced error handling with offline support
  • πŸ“± Responsive design for mobile and desktop

✨ Features

πŸŽ›οΈ Custom Lovelace Card

  • Real-time Temperature Control: Adjust bed temperature with intuitive sliders
  • Visual Bed Presence Indicators: See when someone is on each side of the bed
  • Sleep Metrics Display: View heart rate, HRV, breath rate, and sleep quality
  • Responsive Design: Works perfectly on mobile and desktop devices
  • Theme Support: Automatically adapts to light/dark themes
  • Side-by-Side Controls: Independent control for left and right sides

πŸ”§ Device Actions

  • Temperature Control: Set temperature, increment/decrement, and preset modes
  • Side Control: Turn individual sides on/off
  • Away Mode: Start/stop away mode with one-touch actions
  • Pod Management: Prime pod and configure bed sides
  • Modern Integration: Uses Home Assistant's device action framework

πŸ›‘οΈ Enhanced Error Handling

  • Exponential Backoff: Intelligent retry logic with exponential delays
  • Connection Recovery: Automatic token refresh and connection recovery
  • Graceful Degradation: Continues working when API is temporarily unavailable
  • Detailed Logging: Comprehensive error reporting and debugging information

πŸ“Š Enhanced Sensors

  • Real-time Sleep Stage Tracking: Monitor sleep stages with detailed attributes
  • Sleep Stage Breakdown: Detailed breakdown of sleep stage percentages
  • Biometric Monitoring: Heart rate, HRV, and respiratory rate tracking
  • Environmental Sensors: Room temperature and bed temperature monitoring
  • Device Health: Water level, priming status, and device health monitoring

πŸš€ Installation

Via HACS (Recommended)

  1. Add this repository to HACS
  2. Install the integration
  3. Add your Eight Sleep credentials in Home Assistant
  4. Add the custom card to your Lovelace dashboard

Manual Installation

  1. Copy the custom_components/eight_sleep folder to your Home Assistant custom_components directory
  2. Restart Home Assistant
  3. Add your Eight Sleep credentials in the integrations page

πŸ“‹ Configuration

Basic Integration Setup

  1. Go to Settings β†’ Devices & Services
  2. Click Add Integration
  3. Search for Eight Sleep
  4. Enter your Eight Sleep credentials
  5. The integration will automatically discover your devices

Custom Card Configuration

Add this to your Lovelace dashboard:

type: custom:eight-sleep-bed-card
title: "Eight Sleep Bed"
left_side: "left"
right_side: "right"

Advanced Card Configuration

type: custom:eight-sleep-bed-card
title: "Master Bedroom"
left_side: "left"
right_side: "right"
show_metrics: true
show_presence: true
temperature_range:
  min: 16
  max: 32
  step: 0.5

🎯 Device Actions

The integration provides device actions that can be used in automations:

Temperature Actions

  • Set Temperature: Set specific temperature for bed sides
  • Increment Temperature: Adjust temperature by increment
  • Set Preset: Apply Cool/Warm/Neutral presets

Control Actions

  • Turn On Side: Activate heating/cooling for specific side
  • Turn Off Side: Deactivate heating/cooling for specific side
  • Start Away Mode: Enable away mode
  • Stop Away Mode: Disable away mode

Device Actions

  • Prime Pod: Prime the Eight Sleep pod
  • Set Bed Side: Configure bed side settings

πŸ“Š Sensors

Sleep Stage Sensors

  • Sleep Stage: Real-time sleep stage tracking with duration and history
  • Sleep Stage Breakdown: Detailed breakdown of sleep stage percentages
  • Sleep Efficiency: Calculated sleep efficiency percentage

Biometric Sensors

  • Heart Rate: Real-time heart rate monitoring
  • HRV: Heart rate variability tracking
  • Breath Rate: Respiratory rate monitoring
  • Sleep Quality: Sleep quality score

Environmental Sensors

  • Room Temperature: Current room temperature
  • Bed Temperature: Current bed temperature
  • Target Temperature: Target heating temperature

Device Sensors

  • Water Level: Pod water level status
  • Priming Status: Pod priming status
  • Device Health: Overall device health status

πŸ”§ Services

The integration provides several services for advanced control:

Temperature Services

  • eight_sleep.heat_set: Set heating level with duration
  • eight_sleep.heat_increment: Increment heating level

Control Services

  • eight_sleep.side_on: Turn on bed side
  • eight_sleep.side_off: Turn off bed side
  • eight_sleep.away_mode_start: Start away mode
  • eight_sleep.away_mode_stop: Stop away mode

Alarm Services

  • eight_sleep.alarm_snooze: Snooze alarm
  • eight_sleep.alarm_stop: Stop alarm
  • eight_sleep.alarm_dismiss: Dismiss alarm

Device Services

  • eight_sleep.prime_pod: Prime the pod
  • eight_sleep.set_bed_side: Configure bed side settings

πŸ€– Automation Examples

Automatic Temperature Adjustment

automation:
  - alias: "Cool Bed at Bedtime"
    trigger:
      platform: time
      at: "22:00:00"
    action:
      - service: climate.set_temperature
        target:
          entity_id: climate.eight_sleep_left_side
        data:
          temperature: 18

Sleep Stage Monitoring

automation:
  - alias: "Notify Deep Sleep"
    trigger:
      platform: state
      entity_id: sensor.eight_sleep_sleep_stage_enhanced
      to: "Deep Sleep"
    action:
      - service: notify.mobile_app
        data:
          message: "Deep sleep detected - optimal rest phase"

Away Mode Automation

automation:
  - alias: "Start Away Mode When Gone"
    trigger:
      platform: state
      entity_id: person.your_name
      to: "not_home"
    action:
      - service: eight_sleep.away_mode_start
        target:
          entity_id: sensor.eight_sleep_sensor

🎨 Custom Card Features

Temperature Control

  • Real-time Slider: Adjust temperature from 16Β°C to 32Β°C
  • Preset Buttons: Quick access to Cool, Warm, and Neutral settings
  • Side-specific Control: Independent temperature control for each side
  • Visual Feedback: Active sides are highlighted

Sleep Metrics

  • Heart Rate: Real-time heart rate monitoring
  • HRV: Heart rate variability tracking
  • Breath Rate: Respiratory rate monitoring
  • Sleep Quality: Sleep quality score percentage

Presence Detection

  • Visual Indicators: Green dots show when someone is present
  • Side-specific: Separate indicators for left and right sides
  • Real-time Updates: Updates automatically when presence changes

Responsive Design

  • Mobile Optimized: Touch-friendly controls for mobile devices
  • Desktop Enhanced: Full feature set for desktop use
  • Theme Support: Automatically adapts to light/dark themes

πŸ” Troubleshooting

Integration Issues

  1. Authentication Failed: Verify your Eight Sleep credentials
  2. No Devices Found: Ensure your Eight Sleep device is online
  3. Connection Errors: Check your internet connection and Eight Sleep service status

Card Issues

  1. Card Not Loading: Ensure Eight Sleep integration is properly configured
  2. Temperature Controls Not Working: Check that climate entities are available
  3. Metrics Not Displaying: Verify sensor entities are available and sleep session is active

Sensor Issues

  1. No Sleep Data: Ensure you're actively using the bed for sleep tracking
  2. Missing Sensors: Check that all sensor entities are properly created
  3. Stale Data: Verify the integration is updating regularly

πŸ“ˆ Performance

Optimizations

  • Smart Polling: Updates based on device state and activity
  • Connection Pooling: Efficient API connection management
  • Caching: Intelligent data caching to reduce API calls
  • Background Updates: Non-critical data updates in background

Error Recovery

  • Exponential Backoff: Intelligent retry logic prevents API overload
  • Token Refresh: Automatic token refresh when expired
  • Graceful Degradation: Continues working during temporary API issues
  • Connection Monitoring: Real-time connection status tracking

🀝 Contributing

We welcome contributions! Please see our Contributing Guidelines for details.

Development Setup

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Submit a pull request

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgments

  • Eight Sleep for providing the API
  • Home Assistant community for inspiration and feedback
  • Contributors who have helped improve this integration

πŸ“ž Support


Made with ❀️ for the Home Assistant community

About

Comprehensive Home Assistant integration for Eight Sleep smart mattresses with custom Lovelace card, device actions, and real-time sleep monitoring

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published