Skip to content

WIP: Run multiple mesh nodes on a single device #240

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

alesgenova
Copy link
Contributor

So I decided to do a little experiment the last couple of nights and it ended up working pretty good, but before I spend more time on this I want to check if it's something that the community is interested in.

So this PR is a proof of concept that allows us to run multiple nodes on a single device. This allows us to do the following things for example:

  • Run multiple chat servers on a single device (this case is implemented here)
  • Run both a client node and a repeater
  • Run two or more repeaters with different settings of what will be repeated

At a very high level this is what's happening here:

  • I add a new abstraction called MeshNode.
  • Each instance of MeshNode has its own unique identity.
  • Instead of subclassing Mesh itself, we will have specific implementations of MeshNode for server room, repeater, companion, etc. (provided here is an example for the RoomNode).
  • The Mesh keeps a reference to an array of nodes, and when a packet is received, it gets forwarded to the various nodes, which will determine if it's meant for them or not, and will either process it or ignore it.

So using this architecture, I was able to modify the room server example so that 3 room servers are run on the same hardware, and it actually works, I was able to chat on each instance sharing messages with two clients.

ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
...
ROOM  name: Room_0  identity_key: _main_0  ID: 30F3524B6721DC13954BDD9435268C8D16656C42F83E1C2C865115D61C8A8E8C
ROOM  name: Room_1  identity_key: _main_1  ID: BC0CCF60443669AE0DB87E0F7904486A487043359D53D3753AEBF3FC8770D5ED
ROOM  name: Room_2  identity_key: _main_2  ID: C206756E4AF93AF646E6ED87C09520820CD817B0F80ED11BAA1E5D564709BA7E

Screenshot_20250501_000401_MeshCore

Anyway, this is a proof of concept and is in not anywhere ready to be merged, but I wanted to gauge interest before I sink more time into it.

@antijingoist
Copy link

Gauging interest?

OMG, yes

@mrlmuk
Copy link

mrlmuk commented May 31, 2025

This seems like a brilliant idea which will avoid a lot of waste where people need multiple devices for each role. I currently have a Heltec v3 which really should be a repeater but is set up as a client with WiFi so Home Assistant can connect to it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants