fix: resolve version sensor conflict between legacy and JSON-RPC MQTT topics at boot HA#12
Open
PeterLinuxOSS wants to merge 1 commit into
Open
fix: resolve version sensor conflict between legacy and JSON-RPC MQTT topics at boot HA#12PeterLinuxOSS wants to merge 1 commit into
PeterLinuxOSS wants to merge 1 commit into
Conversation
… topics at boot HA
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.
This PR fixes a race condition in the version sensor at startup.
In some rare cases at boot, the sensor first picks up the old version from the legacy MQTT topic (
openmower/version), and a few minutes later — once OpenMower republishes the version on the new topic (openmower/version/json) — it updates to the correct value. This PR resolves that inconsistency by handling both topics deterministically.Trade-off: This fix effectively disables showing the correct version if you downgrade OpenMower from 1.2.0 back to 1.0.2. I think that's an acceptable cost, since downgrades are rare.
Root cause: The underlying issue is that OpenMower does not clear stale retained messages from MQTT, so the old
versiontopic keeps an outdated retained value. It would be great to fix that on the OpenMower side as well.Suggestion for OpenMower: Add a
schema_versionfield to theopenmower/capabilitiestopic, incremented whenever the MQTT schema changes. This would let integrations detect schema changes reliably instead of relying on topic-name heuristics.Note: parts of this fix were generated with the help of Claude AI.