It would be useful to be able to disconnect the device on BLE so I can connect with other software.
MeshCore-gui should stay disconnected until I press the connect button and/or perhaps until it is restarted.
It would be useful to be able to disconnect the device on BLE so I can connect with other software.
MeshCore-gui should stay disconnected until I press the connect button and/or perhaps until it is restarted.
<!-- github-sync-id:3945029829 -->
The disconnect/connect feature itself is technically straightforward — you need to be able to pause the auto-reconnect in ble_reconnect.py and explicitly close the BLE connection. A toggle button in the UI that sets a _user_disconnected flag.
The PIN problem goes deeper. BLE pairing works like this:
On first pairing, the device and host exchange a PIN → bonding keys are stored
On Linux, BlueZ stores those keys in /var/lib/bluetooth/<adapter>/<device>/
As long as you stay on the same machine, any software shares the same bonding — the PIN is no longer relevant
Connecting from a different machine requires a new pairing with the MeshCore device's PIN
So:
Scenario | PIN problem?
-- | --
Disconnect GUI → connect with MeshCore CLI on the same Pi | No, BlueZ bonding is shared
Disconnect GUI → connect from a laptop | Yes, laptop needs to pair separately
Disconnect GUI → connect from a phone | Yes, phone needs to pair separately
Conclusion:
The feature is useful and feasible for the "same machine" scenario. Connecting from a different device is a BLE limitation, not something MeshCore GUI can solve.
Want me to draft a design for the disconnect/connect functionality? It would involve changes to worker.py (making the reconnect loop pausable) and a button in the device panel.
The only edge case to consider: if multiple users have the UI open simultaneously, one user pressing disconnect affects everyone. But for a single-device mesh node on a home network, that's fine.
Want me to design this feature?
<p class="font-claude-response-body break-words whitespace-normal leading-[1.7]">Good point. Let me think this through.</p>
<p class="font-claude-response-body break-words whitespace-normal leading-[1.7]"><strong>The disconnect/connect feature itself</strong> is technically straightforward — you need to be able to pause the auto-reconnect in <code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">ble_reconnect.py</code> and explicitly close the BLE connection. A toggle button in the UI that sets a <code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">_user_disconnected</code> flag.</p>
<p class="font-claude-response-body break-words whitespace-normal leading-[1.7]"><strong>The PIN problem</strong> goes deeper. BLE pairing works like this:</p>
<ul class="[li_&]:mb-0 [li_&]:mt-1 [li_&]:gap-1 [&:not(:last-child)_ul]:pb-1 [&:not(:last-child)_ol]:pb-1 list-disc flex flex-col gap-1 pl-8 mb-3">
<li class="whitespace-normal break-words pl-2">On first pairing, the device and host exchange a PIN → <strong>bonding keys</strong> are stored</li>
<li class="whitespace-normal break-words pl-2">On Linux, <strong>BlueZ</strong> stores those keys in <code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">/var/lib/bluetooth/<adapter>/<device>/</code></li>
<li class="whitespace-normal break-words pl-2">As long as you stay on the <strong>same machine</strong>, any software shares the same bonding — the PIN is no longer relevant</li>
<li class="whitespace-normal break-words pl-2">Connecting from a <strong>different machine</strong> requires a new pairing with the MeshCore device's PIN</li>
</ul>
<p class="font-claude-response-body break-words whitespace-normal leading-[1.7]">So:</p>
<div class="overflow-x-auto w-full px-2 mb-6">
Scenario | PIN problem?
-- | --
Disconnect GUI → connect with MeshCore CLI on the same Pi | No, BlueZ bonding is shared
Disconnect GUI → connect from a laptop | Yes, laptop needs to pair separately
Disconnect GUI → connect from a phone | Yes, phone needs to pair separately
</div>
<p class="font-claude-response-body break-words whitespace-normal leading-[1.7]"><strong>Conclusion:</strong></p>
<p class="font-claude-response-body break-words whitespace-normal leading-[1.7]">The feature is useful and feasible for the "same machine" scenario. Connecting from a different device is a BLE limitation, not something MeshCore GUI can solve.</p>
<p class="font-claude-response-body break-words whitespace-normal leading-[1.7]">Want me to draft a design for the disconnect/connect functionality? It would involve changes to <code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">worker.py</code> (making the reconnect loop pausable) and a button in the device panel.</p>
The only edge case to consider: if multiple users have the UI open simultaneously, one user pressing disconnect affects everyone. But for a single-device mesh node on a home network, that's fine.
Want me to design this feature?
<!-- github-comment-id:3908555629 -->
Thanks for the description. I think due to the PIN problem this would not help with my use case which is I want to connect my phone to the companion node when I go out and have the computer (PI) connected when the companion node is at home. Currently when I return meshcore-gui does not reconnect, probably because of the issue you describe.
BTW is working on a PI 3B+ Bookworm headed.
Thanks for the description. I think due to the PIN problem this would not help with my use case which is I want to connect my phone to the companion node when I go out and have the computer (PI) connected when the companion node is at home. Currently when I return meshcore-gui does not reconnect, probably because of the issue you describe.
BTW is working on a PI 3B+ Bookworm headed.
<!-- github-comment-id:3909295305 -->
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
It would be useful to be able to disconnect the device on BLE so I can connect with other software.
MeshCore-gui should stay disconnected until I press the connect button and/or perhaps until it is restarted.
Good point. Let me think this through.
The disconnect/connect feature itself is technically straightforward — you need to be able to pause the auto-reconnect in
ble_reconnect.pyand explicitly close the BLE connection. A toggle button in the UI that sets a_user_disconnectedflag.The PIN problem goes deeper. BLE pairing works like this:
/var/lib/bluetooth/<adapter>/<device>/So:
Conclusion:
The feature is useful and feasible for the "same machine" scenario. Connecting from a different device is a BLE limitation, not something MeshCore GUI can solve.
Want me to draft a design for the disconnect/connect functionality? It would involve changes to
worker.py(making the reconnect loop pausable) and a button in the device panel.The only edge case to consider: if multiple users have the UI open simultaneously, one user pressing disconnect affects everyone. But for a single-device mesh node on a home network, that's fine.
Want me to design this feature?
Thanks for the description. I think due to the PIN problem this would not help with my use case which is I want to connect my phone to the companion node when I go out and have the computer (PI) connected when the companion node is at home. Currently when I return meshcore-gui does not reconnect, probably because of the issue you describe.
BTW is working on a PI 3B+ Bookworm headed.