The clim8 daemon command runs a background scheduler that automatically controls your Eight Sleep Pod based on a configured schedule.
Create a config file at ~/.config/clim8/config.yaml with your schedule:
# Your Eight Sleep credentials
email: "your-email@example.com"
password: "your-password"
# Schedule configuration
schedule:
# Turn on the pod at 10:00 PM
- time: "22:00"
action: "on"
# Set temperature to 68°F at 10:15 PM
- time: "22:15"
action: "temp"
temperature: "68F"
# Lower temperature for deeper sleep at 1:00 AM
- time: "01:00"
action: "temp"
temperature: "65F"
# Slightly warm up before wake time at 5:30 AM
- time: "05:30"
action: "temp"
temperature: "70F"
# Turn off the pod at 6:00 AM
- time: "06:00"
action: "off"
# Optional: Enable verbose logging
verbose: falseon- Turn on the Eight Sleep podoff- Turn off the Eight Sleep podtemp- Set temperature (requirestemperaturefield with F or C suffix)
Times must be in 24-hour format (HH:MM):
"09:00"- 9:00 AM"22:30"- 10:30 PM"01:15"- 1:15 AM
Temperatures must include the unit suffix:
"68F"- 68 degrees Fahrenheit"24C"- 24 degrees Celsius"72F"- 72 degrees Fahrenheit
clim8 daemonclim8 daemon --dry-runclim8 daemon --verboseclim8 daemon --timezone "America/Los_Angeles"clim8 daemon --sync-state=falsenohup clim8 daemon > ~/clim8.log 2>&1 &- Duplicate Prevention: Each scheduled action only runs once per day
- Graceful Shutdown: Responds to SIGINT/SIGTERM signals
- Error Recovery: Continues running even if individual actions fail
- Dry Run Mode: Test your schedule without executing actions
- Detailed Logging: Shows what actions are being executed and when
- Single Instance: Prevents multiple daemons from running simultaneously
- Security Checks: Warns if config file has insecure permissions
- State Synchronization: Automatically checks and corrects device state after system wake/hibernation
The daemon checks that your config file has secure permissions and warns if it's readable by others:
# Secure your config file
chmod 600 ~/.config/clim8/config.yamlYour Eight Sleep credentials are stored in plaintext in the config file. Consider:
-
Setting restrictive file permissions (600)
-
Using environment variables instead:
export CLIM8_EMAIL="your-email@example.com" export CLIM8_PASSWORD="your-password"
[!NOTE] Environment variables won't work when ran as a
brew service
The daemon creates a PID file to prevent multiple instances:
- PID file location:
~/.config/clim8/daemon.pid - Automatically cleaned up on shutdown
Here's a complete example for optimized sleep:
email: "your-email@example.com"
password: "your-password"
schedule:
# Pre-bedtime routine
- time: "21:30"
action: "on"
- time: "21:45"
action: "temp"
temperature: "70F" # Slightly warm for getting into bed
# Sleep onset
- time: "22:30"
action: "temp"
temperature: "68F" # Optimal sleep temperature
# Deep sleep phase
- time: "00:00"
action: "temp"
temperature: "65F" # Cooler for deep sleep
# REM sleep phase
- time: "03:00"
action: "temp"
temperature: "67F" # Slightly warmer for REM
# Pre-wake warming
- time: "06:00"
action: "temp"
temperature: "72F" # Warm up to ease waking
# Wake time
- time: "07:00"
action: "off" # Turn off after wake upps aux | grep clim8tail -f ~/clim8.logclim8 daemon --dry-run --verbose- No schedule items found: Check your config file path and YAML syntax
- Authentication failed: Verify your email and password in the config
- Actions not executing: Ensure times are in correct format and check system time
- Permission denied: Make sure config file is readable by the user running the daemon
- Device state out of sync after wake: The daemon automatically detects and corrects this. If issues persist, check logs for sync warnings
The daemon automatically checks if your Eight Sleep device is in the correct state based on your schedule. This is especially useful when:
- Your computer goes to sleep/hibernation and misses scheduled events
- The device was manually controlled outside of the daemon
- Network connectivity was temporarily lost
The daemon will:
- Determine what the device state should be based on the most recent scheduled action
- Check the actual device state via the Eight Sleep API
- Automatically correct any mismatches by executing the appropriate action
This feature can be disabled with --sync-state=false if needed.