refactor: code quality, logging and reliability improvements#15
Merged
Conversation
Critical fixes: - Replace bare except clauses with specific exceptions throughout - Fix hass.bus.fire() called from FCM thread → call_soon_threadsafe + async_fire - Guard e.response None-check before accessing .status_code in all HTTP methods - Save FCM credentials with 0o600 permissions instead of world-readable defaults Logging cleanup: - Standardise all _LOGGER calls to %-style format (no f-strings) - Demote verbose SIP connect/register steps from INFO to DEBUG - Demote FCM registration details, listener lifecycle, MQTT messages to DEBUG - Remove traceback duplication (use _LOGGER.exception instead of error+format_exc) - Mask FCM tokens in log output Architecture: - SiedleDataUpdateCoordinator now holds direct ConfigEntry reference; removes O(n) loop over hass.data to find its own entry on every coordinator update - binary_sensor.py: replace hardcoded "Siedle Türstation" device name with endpoint_id-based name, matching sensor.py convention - Add SIEDLE_DATA_DIR and TASK_NAME_FCM_SETUP constants to replace magic strings Reliability: - MQTT connect_mqtt() retries up to 3 times with exponential backoff (1s, 2s) and enables paho auto-reconnect (1–30s) for post-connect drops Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Critical fixes:
Logging cleanup:
Architecture:
Reliability: