Skip to content

Comments

plugin blueprint registration#595

Open
RobinWts wants to merge 2 commits intofatihak:mainfrom
RobinWts:clean_PluginBlueprintRegistration
Open

plugin blueprint registration#595
RobinWts wants to merge 2 commits intofatihak:mainfrom
RobinWts:clean_PluginBlueprintRegistration

Conversation

@RobinWts
Copy link

@RobinWts RobinWts commented Feb 13, 2026

This PR contains the changes of my plugin-manger's core-patch.
It make two small additions to the core:

  1. src/plugins/plugin_registry.py
    Add a single function register_plugin_blueprints(app) that:

    • Iterates over all loaded plugin instances
    • For each plugin that implements get_blueprint(), calls it and registers the returned Flask Blueprint with the app
    • Logs success/failure; one failing plugin does not block others
  2. src/inkypi.py

    • Import register_plugin_blueprints
    • After registering core blueprints and before starting the server, call register_plugin_blueprints(app)

With this plugins are able to register their own routes which opens a lot of possibilities to implement plugins that are not possible without that. (e.g. managing assets, like the pluginManager, remote control and automation with web-hooks and push functionality, admin plugins to interact with other processes or services).

It is a minimal change to the core, adding very little but allowing complex plugins. It is backwards compatible, plugins can just ignore it.

Complexity lives in plugins, not core.

Any “clever” or powerful behavior (REST APIs, webhooks, custom endpoints) is implemented inside the plugin’s Blueprint and its own modules.
Core does not gain new concepts (e.g. “plugin APIs,” “plugin webhooks”) beyond “plugins may register one Blueprint.”

edit

Here is a simple poc plugin that uses the registration to add a route to force the currently displayed instance to refresh, it is intended to be called, for example by the PiSugar service but it could easily be called by a script monitoring GPIO pins to add other buttons (this could be set by the settings inside the InkyPi UI which is empty for now) or an automation like NodeRed - yes I am aware that this could also be done by creating a script that finds out what's running from device.json and call /display_plugin_instance with the accuired info but this is a much more stable and less hacky way that is usable for users who do not dive in that deep...

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.

1 participant