Repository navigation
Conversation
… of ASCOM connections The driver used to force IsSafe to False whenever no ASCOM client was connected, and that gate lived inside the shared is_safe() method, so it leaked into /api/ext/v1/status and the dashboard too. Webhook, script and microcontroller users of the external API therefore always saw is_safe:false unless NINA happened to be attached (issue #117), and the dashboard appeared frozen with no client (issue #90). MQTT had already bypassed the gate, so the three surfaces disagreed with each other. The gate was never an ASCOM requirement. The spec defines Connected per client and says IsSafe raises NotConnected when not connected; it never asks for a False value. ConformU dropped its "IsSafe must be False before connect" check on 2025-03-16 by Core Team decision. is_safe() now returns the debounced detector state. The Alpaca issafe and devicestate routes apply the gate themselves, per client (IP + ClientID), so a client that never connected still sees False exactly as before, while the external API, dashboard and MQTT all report the same real state. The dashboard tile is renamed Safety State with a tooltip describing the split. Verified with ConformU 4.5 (no issues) and a local Docker run.
When the broker session dropped, the broker published the retained "offline" Last Will for the device. paho's loop_start() then reconnected silently, but discovery and availability were only ever published once at startup, so nothing set the device back to "online". Home Assistant showed the cloud detector as permanently unavailable even though its state topics kept updating every detection cycle. Both MQTT setup paths now install an on_connect handler that republishes the discovery configs, which includes the retained "online" availability message, on every successful connect rather than only the first. The handler accepts the paho 1.x and 2.x callback shapes and ignores failed connects. The ha_discovery attribute is initialised before the client is created because the callback fires from the network thread and may run before discovery has been set up; it simply no-ops in that case and the normal startup publish covers it.
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.
📋 Overview
This pull request primarily addresses two issues: inaccurate safety state reporting to external APIs and dashboards, and Home Assistant device availability problems after MQTT reconnects. It refactors the safety state logic to report the true detector state, applying client-specific gates only for Alpaca connections. Additionally, it ensures Home Assistant devices correctly show as online after an MQTT broker reconnect.
🔄 Changes by Category
IsSafereporting for external APIs and the dashboard, which previously showedFalsewhen no ASCOM client was connected.IsSafefrom the sharedis_safe()method to specific Alpacaissafeanddevicestateroutes, applying it per client.EXTERNAL_API.mdto reflect changes in safety state reporting.IsSafegate logic..gitignoreto include new entries.📊 Analyzed 3 commit(s) | 🕐 Updated: 2026-10-08T07:29:08.265Z | Generated by GitHub Actions