Mark,

full ack, has been on my list as well. I'll handle the web UI side.

I don't think we need to migrate/change the folder structure, we should be able to just add the meta data. I tried to define the structure to be usable as a public repository. Did I miss something?

Btw, I used the naming "module" plugins instead of "script" plugins, as web plugins also consist mostly of scripts. I thought that would clear things for users, but I'm not sure now.

Regarding the plugin structure and meta data, we should decide wether to split plugins into their elements or keep them bundled. You seem to opt for bundles ("web subdirectory"). I would second that, but we then need to take into account a plugin may consist of multiple module and/or web plugins (see Edimax plugin for an example). Normally it's just one module plugin, but we should not restrict the system in that way. So the JSON file should allow to define an array of plugin elements / options.

Currently there's a version on each element, and but we could/should simplify this to a central overall version for the plugin.

To automatically install plugins, the meta data also needs to define the types and default setups for web/frontend plugins.

Draft: edimax.json:

{
  name: "edimax",
  title: "Edimax: Smart Plug Control",
  description: "Smart Plug control for Edimax models SP-1101W, SP-2101W et al",
  group: "Home Automation",
  info: "https://docs.openvehicles.com/en/latest/plugin/edimax/README.html",
  maintainer: "Michael Balzer <dexter@dexters-web.de>",
  version: "2.1",
  prerequisites: ["ovms>=3.2.010"],
  elements: [{
    type: "script",
    path: "edimax.js",
    name: "edimax" // optional, defaults to plugin name
  },{
    type: "webpage",
    path: "edimax.htm",
    page: "/usr/edimax",
    label: "Edimax Smart Plug",
    menu: "Config",
    auth: "Cookie"
  },{
    type: "webhook",
    path: "edimax-status.htm",
    page: "/status",
    hook: "body.post"
  }]
}


A method to easily disable/enable installed plugins would also be nice, i.e. as subcommands "plugin disable" / "plugin enable".

Regards,
Michael


Am 14.07.20 um 07:55 schrieb Mark Webb-Johnson:

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:

  1. Implement a mechanism for plugins to directly extend the console command language (other than the current ’script exec PLUGIN.fn’).

  2. 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:


Does that make sense? Any suggestions/comments?

Regards, Mark.


_______________________________________________
OvmsDev mailing list
OvmsDev@lists.openvehicles.com
http://lists.openvehicles.com/mailman/listinfo/ovmsdev

-- 
Michael Balzer * Helkenberger Weg 9 * D-58256 Ennepetal
Fon 02333 / 833 5735 * Handy 0176 / 206 989 26