A Hubitat Elevation app that monitors light switches to ensure they successfully turn on/off as commanded and retries if necessary. Includes refresh capability to ensure accurate state reporting and is optimized for environments with connectivity issues.
- Automatic Monitoring: Monitors light switches to confirm they reach their desired state
- Smart Retry Logic: Automatically retries failed commands with configurable limits
- Refresh Capability: Sends refresh commands to ensure accurate state reporting
- Cooldown Protection: Prevents rapid retry loops with configurable cooldown periods
- Timeout Handling: Configurable timeout to prevent stuck monitoring sessions
- Manual Monitoring: API function to manually start monitoring from other apps
- Push Notifications: Optional notifications for monitoring failures
- Debug Logging: Comprehensive logging with auto-disable capability
- Connectivity Optimized: Default settings optimized for environments with connectivity issues
- In your Hubitat Elevation hub, go to Apps Code
- Click + New App
- Copy and paste the contents of
Hubitat-Light-Wrapper.groovy
- Click Save
- Go to Apps and click + Add App
- Select Light Monitor Wrapper from the list
- Configure your settings and install
- Status Check Interval (default: 30s): How often to check if the light reached the desired state
- Wait After Refresh (default: 30s): How long to wait after sending a refresh command before checking state
- Maximum Retries (default: 5): Maximum number of retry attempts before giving up
- Command Timeout (default: 240s): Maximum time to spend monitoring a single command
- Cooldown Period (default: 60s): Minimum time between monitoring sessions for the same device
- Send Push Notification on Failure: Enable push notifications when monitoring fails
- Notification Devices: Select devices to receive failure notifications
- Enable Debug Logging: Enable detailed debug logging
- Debug Log Auto-Disable After: Automatically disable debug logging after a specified time
The app automatically monitors any light switch events from external sources (not its own commands). When a light is turned on/off by another automation or manual control, the app will:
- Start monitoring the light
- Send a refresh command to get accurate state
- Check if the light reached the desired state
- Retry the command if needed
- Give up after maximum retries
You can manually start monitoring from other apps using the startMonitoring
function:
// Start monitoring a light to turn it on
app.startMonitoring(device, "on")
// Start monitoring a light to turn it off
app.startMonitoring(device, "off")
The default settings are optimized for environments with connectivity issues:
- 30s intervals: Reduces network congestion and gives devices time to recover
- 240s timeout: Provides adequate time for monitoring cycles without premature cancellation
- 60s cooldown: Prevents rapid retry loops while allowing reasonable responsiveness
- 5 retries: Balances persistence with avoiding infinite loops
- 1.00 - Initial release
- 1.01 - Added refresh capability to ensure accurate state reporting before comparing states
- 1.02 - Fixed retry loop issue where app would monitor events from other sources and get stuck in infinite retry cycles
- 1.03 - Added connectivity issue detection and handling to prevent monitoring during device connectivity problems
- 1.04 - Enhanced connectivity detection to work with different device types (WiFi/Hue, Zigbee, Z-Wave) and added detailed device diagnostics
- 1.05 - Optimized default settings for environments with connectivity issues (30s/30s/240s/60s intervals)
- 1.06 - Fixed infinite loop issue where app was monitoring its own refresh commands by filtering out digital events and adding recent command detection
- Check if the lights are included in the monitoring configuration
- Verify the lights are online and responding to basic commands
- Check the logs for connectivity issues or error messages
- Consider increasing the check interval or timeout settings
- Check for connectivity issues with the lights
- Verify the lights are not being controlled by other automations
- Consider increasing the cooldown period
- Check if the lights are in the correct state before sending commands
- Reduce the number of lights being monitored
- Increase the check interval to reduce polling frequency
- Disable debug logging if not needed
- Check for network congestion or WiFi issues
If you experience continuous refresh commands or monitoring loops:
- Update to version 1.06 or later - This version includes fixes for infinite loops
- Restart the app - Go to app settings and click "Done" to clear stuck monitoring states
- Use the clear function - Run
app.clearStuckMonitoring()
in the Hubitat console if needed - Check for digital events - The app now properly filters out digital responses to its own commands
Feel free to submit issues, feature requests, or pull requests to improve this app.
This project is licensed under the MIT License - see the LICENSE file for details.
For support, please:
- Check the troubleshooting section above
- Review the logs in your Hubitat hub
- Open an issue on GitHub with detailed information about your setup and the problem you're experiencing
Simon Mason - Hubitat community developer