You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Defer sync operations until after initialization completes
Added initialization tracking to prevent sync operations from running before
all entities are created and ready. This fixes issues where the integration
would try to sync codes to Z-Wave locks before the integration was fully
initialized.
Changes:
1. Added ATTR_INITIALIZATION_COMPLETE flag to track setup state
2. Initialize flag to False when config entry is set up
3. Set flag to True after "Done creating and/or updating entities" log
4. Binary sensor async_update() skips sync operations until flag is True
5. Trigger coordinator refresh after init completes to check sync status
This ensures:
- All entities are created before any sync operations occur
- Lock providers (like Z-Wave JS) are fully ready before commands are sent
- Users see clean initialization without premature sync attempts
- Sync operations happen after initialization via coordinator refresh
The flow is now:
1. Create all entities in read-only mode
2. Mark initialization as complete
3. Trigger coordinator refresh to check actual sync status
4. Binary sensors then perform sync operations if needed
Files changed:
- custom_components/lock_code_manager/const.py
- custom_components/lock_code_manager/__init__.py
- custom_components/lock_code_manager/binary_sensor.py
All 26 tests passing.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>