RELEASE] Advanced Room Good Night - The Ultimate Sleep Controller

Hey everyone,

I've been working on a comprehensive Good Night controller for my smart home and wanted to share it with the community. If you are looking for a single application to handle everything from climate control to audio, lighting, and global home state synchronization, this might be exactly what you need.

It handles up to 4 separate rooms and intelligently syncs them to dictate your global House Modes.

Key Features:

  • Live Sleep Dashboard: Each room features a built-in HTML dashboard displaying the live environment (temperature and humidity). It also calculates a sleep suitability rating and maintains a 7-day sleep history log.
  • Dynamic Ceiling Fan Control: No more waking up hot or freezing. The app allows you to set a base temperature and will automatically scale your ceiling fan speeds as the room heats up. It officially supports Simple On/Off, 3-Speed, and 5/6-Speed ceiling fans.
  • Global Mode Synchronization: You can require specific rooms to be asleep and ensure there is no active motion before the house enters Night Mode.
  • Blocking Devices: Prevent the house from shutting down if someone is still awake by setting "Blocking Devices" (e.g., if the Living Room TV or Pinball machine is ON, Night Mode is paused).
  • Lead Room Override: Have a master bedroom? You can designate a "Lead Room." Once that room goes to sleep, the app will start a countdown timer to force the rest of the house into Good Night mode, provided there is no active motion.
  • Self-Healing "Fan Wiggle": For those of us with finicky RF fan controllers, there is an optional hourly routine that drops active fan speeds by one tier and bumps them back up to ensure the physical hardware is perfectly synced with Hubitat.
  • Periodic State Enforcement: A routine wakes up every 10 minutes to verify the system state—forcing lights back off or closing shades if they were manually overridden while the room is asleep.
  • System Boot Recovery: If your hub reboots or you experience a power failure during the night, the app will automatically run a recovery scan and re-apply the correct Good Night environment to any room that is still asleep.
  • Sonos Audio Polish: Built-in sleep audio management. Set a fixed nighttime volume, configure a sleep timer to stop playback automatically, and provide up to 5 Audio URIs that the app will randomize each night.

raw.githubusercontent.com/ShaneAllen334/Hubitat_Apps/refs/heads/main/Advanced_Room_Good_Night/Advanced_Room_Good_Night.groovy

Open Source Disclaimer: This application is completely open-source and free to use. You are welcome to install it, edit it to fit your specific needs, or strip out any snippets of code to use in your own projects. Enjoy!

2 Likes

Sunrise Simulation Awareness: Added a new "Pause Lighting Enforcement Switch" input. This allows the app to actively monitor for morning routines and gracefully pause its strict 10-minute lighting enforcement (which normally forces lights off) while a gradual sunrise fade is happening.

New Features

  • Target-Based Hourly Wiggle: The system now calculates exactly what speed the fan should be at based on the current temperature and setpoint before performing the wiggle.

  • Bond Bridge "Off" Resync: If a fan is supposed to be OFF, the wiggle routine now bumps it to LOW temporarily to force a Bond Bridge state reset before sending the final OFF command.

  • Per-Room Wiggle Toggle: Added a new configuration option allowing users to enable or disable the hourly wiggle for each specific room individually.

  • Live Target Speed Display: The Live System Dashboard now explicitly shows the

*Calculated Target Speed so you can see the exact speed the automation is demanding versus the current hardware state.

Fixes & Reliability Updates

  • Command Drop Protection: To prevent the Bond bridge from losing commands, the wiggle routine now forces a speed change (dropping one tier) and then re-evaluates 10 seconds later to securely bump it back to the target.

  • 3x Redundant Shutdown: Implemented a triple-pulse shutdown sequence ("Low-Off-Off") to guarantee that RF fans actually stop spinning and cut power when the room wakes up.

  • Hardware Warm-up Sync: Refined the 30-second power-on delay to ensure the fan hardware is fully energized before the calculated speed command is sent.

raw.githubusercontent.com/ShaneAllen334/Hubitat_Apps/refs/heads/main/Advanced_Room_Good_Night/Advanced_Room_Good_Night.groovy

I was looking at your app, and seems interesting to me, I just suggest to add a Fº - Cº switch, for those of us that don’t plan to use it on Metric system countries.

Thank you for your good work.

1 Like