Skip to content

Conversation

@benallfree
Copy link

@benallfree benallfree commented Nov 29, 2025

This PR introduces the concept of Meshtastic Plugins: a clean, decentralized way to extend Meshtastic without touching the core firmware.

Currently, the plugin registry is running as part of the https://meshforge.org/ project at https://registry.meshforge.org but I am open to moving it to an official registry if you guys like this concept. The pip package is also currently named mesh-plugin-manager but can be renamed to meshtastic-plugin-manager if you take it on officially.

Key features

  • Plugins live completely outside the core. They are installed as needed via a simple git clone into ./plugins/<plugin-slug>/.

  • A new build helper script ./bin/mpm_pio.py (Meshtastic Plugin Manager) is invoked automatically via a tiny change in platformio.ini:

    • Scans all plugin directories
    • Automatically injects them into the build
    • Discovers any *.proto files in plugins and generates the corresponding protobuf code
    • Allows plugin authors to use protobuf messages for plugin-specific data without ever modifying the core meshtastic/protobufs files
  • mpm_pio.py can also be used as a standalone CLI tool (python bin/mpm_pio.py list, etc.) to list discovered plugins or manually generate protobuf artifacts

  • New lightweight dynamic module registration system in src/modules/ModuleRegistry.cpp

    • Plugin authors simply add MESHTASTIC_REGISTER_MODULE(MyModule) in their code
    • No more need to edit Modules.cpp in the core

Working examples

Next step (suggestion)

If we like this direction, we could spin up an official registry.meshtastic.org that serves the latest registry.json. Plugin authors would contribute via PRs to a canonical registry repository, making discovery seamless for users.

Looking forward to your feedback! This should make third-party extensions much easier and keep the core lean. There may even be existing modules that could be migrated out of the core.

Note: CI will fail until the pip package is published

@vidplace7 vidplace7 added the enhancement New feature or request label Nov 29, 2025
…ry' of github.com:MeshEnvy/firmware into meshenvy/module-registry
… executables from both mpm and firmware virtual environments
…lude labels in error messages and improve directory logging
…nsistency and maintain existing plugin exclusions
… management and protobuf generation

- Removed the deprecated mpm_pio.py script.
- Introduced mpm_generate.py to handle protobuf file generation and plugin include paths.
- Updated platformio.ini to use the new mpm_generate.py script in the pre-build process.
- Deleted poetry.lock and pyproject.toml files as part of the transition to a simpler dependency management approach.
…ty before running generation

- Added a check to determine if the mpm command is available.
- Updated error handling to provide clearer warnings when mpm is not found or when generation fails.
- Improved the flow to skip protobuf generation if mpm is unavailable.
- Added `#pragma MPM_MODULE` directive for automatic module registration in plugins.
- Updated `SampleModule` implementation to align with new registration method.
- Removed obsolete `ModuleRegistry` files as they are no longer needed.
- Adjusted `Modules.cpp` to include dynamic module initialization.
- Enhanced README.md with detailed examples for module registration.

This change streamlines the module registration process and improves clarity in the documentation.
- Simplified the addition of plugin directories to the include path by directly including the plugins directory instead of individual plugin source paths.
- Updated the print statement to reflect the new include path structure.

This change enhances clarity and ensures that includes must be explicit.
- Created a new header file for the sample plugin, defining the plugin version and including the SampleModule.
- Removed the redundant `#pragma MPM_MODULE` directive from SampleModule.h as it is now defined in the new plugin header.

This change establishes the foundational structure for the sample plugin and streamlines module registration.
@fifieldt
Copy link
Member

fifieldt commented Dec 6, 2025

Thanks for being willing to work upstream :)

@benallfree
Copy link
Author

You're welcome. I'm closing this one though, as the approach is out of date.

@benallfree benallfree closed this Dec 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants