meshcore-ha icon indicating copy to clipboard operation
meshcore-ha copied to clipboard

Add repeater: contact not found

Open semml0r opened this issue 8 months ago • 6 comments

Dear all, I have a Heltec V3 via WiFi added and it works without any problems. Trying to add my Repeater station, which is 5m away from my companion, results in "Contact not found". I cannot add any repeater station, constantly getting "contact not found", although repeaters show up with their correct public hash. I am running:

  • Home Assistant OS Core 2026.4.1
  • Supervisor 2026.03.2
  • Operating System 17.1
  • Frontend 20260325.6

Possibly it's an issues on my side. Happy to test / provide more details if required, thanks in advance for all the work and a possible hint what could lead to this.

semml0r avatar Apr 04 '26 09:04 semml0r

Thanks for reporting this @semml0r! I can confirm this is a bug — the "Add Repeater" dropdown includes discovered (advertised) contacts, but the validation step only checks contacts that have been added to your companion device. So a repeater you've seen over the air shows up in the list but fails with "Contact not found" when selected.

Workaround: Add the repeater as a contact on your companion device first, then retry "Add Repeater":

  1. Add a Discovered Contacts dropdown to your dashboard using the select.meshcore_discovered_contact entity, along with a button that calls the meshcore.add_selected_contact action — see the contacts docs for the dashboard card YAML
  2. Select the repeater from the dropdown and click the Add Contact button
  3. Once added, go back to Settings → Devices & Services → MeshCore → Configure → Add Repeater Station — the repeater will now pass validation

Alternatively, you can call the meshcore.execute_command action with add_contact <pubkey_prefix> directly from Developer Tools → Actions. See Add Contact via services.

I'll get a fix out so the Add Repeater flow either handles discovered contacts properly or filters the dropdown to only show contacts already on the device.

awolden avatar Apr 05 '26 02:04 awolden

Traced this. The repeater dropdown lists both added and discovered contacts, but the validation step only searches contacts actually added to the node. So if you pick a repeater that's only been discovered over the air (not added to the node's contact list yet), it shows in the list but the lookup fails with "Contact not found."

Workaround: add the contact to the node first, then add it as a repeater.

The cleaner fix would be for the add-repeater flow to add the discovered contact to the node before login, so discovered repeaters work directly.

(Unrelated to the HA-upgrade reports in #260, different code path.)

awolden avatar Jun 16 '26 00:06 awolden

I can reproduce this on meshcore-ha v2.9.0 and was able to identify a workaround that may help locate the bug.

Environment

  • Home Assistant 2026.8.x
  • meshcore-ha v2.9.0
  • USB Companion @ 115200 baud
  • Room Server: CMB Public
  • Public key prefix: d73c2651365c

Symptoms

The Room Server was fully functional:

  • Present in the companion as an Added contact (not just discovered).
  • Receiving fresh adverts.
  • Remote management worked correctly.
  • Login to the Room Server succeeded from the MeshCore app.
  • Current public key added to the Room Server ACL with Admin permission.
  • Appeared correctly in Settings → Devices & Services → MeshCore → Configure → Add Repeater Station.

However, pressing Submit always failed with:

Contact not found

The HA log contained:

Contact not found with public key prefix: d73c2651365c

I also observed:

'NoneType' object has no attribute 'get_contact_by_key_prefix'

Investigation

The repeater selector is populated using the coordinator's merged contact list (_iter_known_contacts() / get_all_contacts()), where the Room Server is present.

However, when submitting the form, the code performs:

contact = meshcore.get_contact_by_key_prefix(pubkey_prefix)

In my case this returned None, despite the contact existing in the coordinator cache and being fully usable from the companion.

Workaround Tested

I modified config_flow.py so that if get_contact_by_key_prefix() returned None, it fell back to searching _iter_known_contacts() using the same public key prefix.

After:

  • ha core check
  • restarting Home Assistant Core

the Room Server added successfully via Add Repeater Station.

Conclusion

This appears to be a mismatch between:

  • the contact source used to populate the repeater dropdown, and
  • the contact source used to validate the selected repeater.

The selected repeater exists in the coordinator cache but cannot always be resolved through meshcore.get_contact_by_key_prefix().

Happy to provide logs, my patch, or test any proposed fix if it would be helpful.

Thanks again for all the work on this integration.

Dani-CRNC avatar Aug 08 '26 22:08 Dani-CRNC

I have exactly the same issue. I added manually the router as contact using the actions, then after meshcore integration Reload it seems to be working, but now i am faced with "Failed to log in to repeater. Check password and try again." I am sure of the password, because I use it on all my other companion devices, it's not the password.

toto99303 avatar Aug 18 '26 11:08 toto99303

is this still happening on the current integration version?

awolden avatar Sep 19 '26 06:09 awolden

Это все еще происходит в текущей версии интеграции? Yes! I still can’t add a repeater.

volinvladim avatar Nov 13 '26 07:11 volinvladim