# Downstairs Bathroom Light - Debug Session (2026-07-24)

## Issue
Motion sensor triggers but bathroom light has a 20-30 second delay turning on.

## Key Entities
- `automation.downstairs_bathroom_light_contro` — automation (mode: restart, working correctly)
- `binary_sensor.downstairs_bathroom_occupancy` — Third Reality Zigbee motion sensor (Z2M)
- `switch.downstairs_bathroom_switch` — TP-Link HS200 (exposed via Homebridge)
- `light.bathroom_light` — TP-Link HS220 dimmer (separate device, NOT controlled by automation)

## Findings
1. Automation logic is correct — triggers on occupancy on/off, 30-min timeout, mode restart
2. Automation IS firing and switch IS turning on (confirmed via history)
3. The delay is between automation trigger and switch responding — suggests Homebridge communication delay
4. No other HA automations reference this switch
5. User confirmed no HomeKit/TP-Link app automations interfering
6. User tried restarting Homebridge — delay persisted
7. User was about to restart entire HA server to test

## Resolution (2026-07-23)
Full HA server restart resolved the issue. Post-reboot trigger-to-action times are all under 0.5s.
The delay was caused by a stale Homebridge WebSocket connection to the TP-Link HS200.

## Next Steps If Issue Recurs
- Check Homebridge logs for TP-Link communication errors
- Consider switching automation to control `light.bathroom_light` (HS220) directly if TP-Link integration is available
- Check if Homebridge add-on needs update
