Fix NEW_CONTACT handling to check the live radio contact list before treating nodes as new#192
Open
Littleaton wants to merge 1 commit into
Open
Fix NEW_CONTACT handling to check the live radio contact list before treating nodes as new#192Littleaton wants to merge 1 commit into
Littleaton wants to merge 1 commit into
Conversation
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 how the bot handles
NEW_CONTACTevents. I have not fully tested it, Just thought id PR some ideas on this topic as the bot logging for adverts is annoying if its new or not, its always saying its new.Right now the bot can log a repeater as newly discovered and “database only” even when the firmware has already added that node to the radio’s contact list. The issue is that the handler was making its decision too early, without checking the live contact state on the radio first.
This change makes the bot check the radio contact list before deciding whether a node is actually new.
Changes
NEW_CONTACTNEW_CONTACTpayload when adding contacts so path data is preservednew_contact_discoveredaudit entry for nodes that are already knownWhy
In
auto_manage_contacts=devicemode, the firmware should usually be handling contact creation already. The bot should reflect the actual state of the radio instead of assuming everyNEW_CONTACTevent means a brand new node.This makes the logs more accurate and avoids the repeated “new repeater discovered” / “tracking in database only” messages for nodes that are already present.
Expected behavior after this change
When a node advert is heard and a
NEW_CONTACTevent follows:Files
modules/message_handler.pymodules/repeater_manager.pytests/test_message_handler.pyValidation
python -m py_compileNote
There is still a possible timing edge case if the firmware has emitted
NEW_CONTACTbut has not populated the contact table yet by the time the bot checks it. In that case the bot may still treat the node as missing and try to repair it. That fallback is intentional.