Cleanup#10
Conversation
…nd enhance FCM connection handling
There was a problem hiding this comment.
Pull request overview
This PR introduces several improvements to the Siedle Home Assistant integration focused on reliability and maintainability. The changes centralize SIP transport string logic, capture actual socket addresses after connection for accurate SIP headers, add file cleanup on integration removal, enable automatic reloads on option changes, and dispatch connection update signals from the FCM handler.
Changes:
- Refactored SIP transport string logic into a
transport_strproperty onSipConfig, replacing 7 duplicate inline conditionals and fixing a bug where TCP transport was previously treated as UDP - Added
async_remove_entryfor cleaning up persistent files (FCM credentials, token caches) on integration removal, and added an options change listener that triggers integration reload - Enhanced FCM handler to dispatch
SIGNAL_SIEDLE_CONNECTION_UPDATEon connection status changes for immediate binary sensor updates
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
custom_components/siedle/sip_manager.py |
Added transport_str property, replaced inline transport conditionals, captured actual local IP/port from sockets, enhanced connection/registration logging |
custom_components/siedle/fcm_handler.py |
Added dispatcher signal dispatch on FCM connection/disconnection events for immediate UI updates |
custom_components/siedle/__init__.py |
Added options change reload listener, async_remove_entry cleanup, simplified call_ended call to pass full data dict |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Just a comment - Instead of reimplementing just another SIP stack, I would suggest that you use a existing SIP library. You will make your life much easier this way. There is e.g. pjsua available as python library link |
This pull request introduces several improvements and fixes to the Siedle Home Assistant integration, focusing on reliability, maintainability, and better SIP protocol handling. The most notable changes include improved cleanup on integration removal, more robust SIP transport handling, automatic reloads on option changes, and enhanced connection logging.
Integration lifecycle and cleanup:
SIP protocol and connection improvements:
Event handling and UI responsiveness:
Internal API and callback improvements: