I feel that our plugin system offers a missed
opportunity. By making small extensions to available
functionality, we can use this system to do so much - and with a
much lower complexity and barrier to entry compared to C++ ESP
IDF development.
There are a couple of things I would like to now do:
- Implement a mechanism for plugins to directly
extend the console command language (other than the current
’script exec PLUGIN.fn’).
- Implement a plugin repository, and command line
tools for managing plugins. We simply need to have a store
and directory of available plugins, a way of
searching/listing those, and a uniform way to install/remove
plugins. Once this is done, perhaps someone can handle the
web UI side of this, and perhaps that can even be done as a
plugin :-)
I’m already working on #1. Just an extension to the
existing script system to allow plugins to register commands,
and to have the command register/deregister done automatically
on plugin load/unload.
However, #2 is a little more tricky and I’m looking
for feedback on the design of this. My idea is:
- Store the plugins in a new
github/openvehicles/Open-Vehicle-Monitoring-System-3/plugins
folder. Eventually the /plugin folder will all be migrated
to here.
- Each plugin has a unique name; the directory in
/plugins.
- Within each plugin directory, there is a
<name>.json file (JSON format) with defined tags to
describe the plugin. If the plugin delivers a web extension,
that is in the ‘web’ subdirectory. If the plugin delivered a
script extension, that is in the ’script’ directory.
Documentation (in rst format) is in the ‘docs' directory.
The JSON file would need the following, at a minimum:
- Name: The plugin ID
- Title: One line title
- Group: Group for the plugin
- Version: The version string of the plugin
- Description: Longer textual description of the
plugin
- Prerequisites: Prerequisites to be checked
(Each plugin installed provides name=version, the system
provides system-level ones such as the version of
firmware, and then the prerequisites is simple a list of
<name><operator><version> as required)
- We can automatically build the documentation, and
list, for all plugins for our docs.openvehicles.com (in a
similar way to how it is done for /plugin now).
- On a repository server, as part of a nightly
build job, we can automatically build a single directory
JSON file from the <name>,json descriptors. We can
publish this, as well as a git export/checkout of the
plugins, on a http download site.
- On the module, we can store a list of repository
servers (allowing the user to add/remove as they require).
- Contributors/authors of plugins simply GitHub
clone our repository, and issue pull requests as
appropriate. They can also have their own private repository
servers (just need to host the directory json file and
associated code files) and add it to their modules.
- The ‘plugin’ command tree on the module will
provide commands for:
- List installed repositories
- Add a new repository
- Remove a repository
- List installed plugins
- List/Search available plugins
- Install a plugin
- Remove a plugin
- Update a plugin
- I would like to try to unify the web and script
plugin systems a bit more closely. They are really two sides
of the same coin (with some plugins providing both).
Does that make sense? Any suggestions/comments?
Regards, Mark.
_______________________________________________
OvmsDev mailing list
OvmsDev@lists.openvehicles.com
http://lists.openvehicles.com/mailman/listinfo/ovmsdev