Open womoak75 opened 1 year ago
@womoak75 this looks like a example template for building and adding custom plugins into the AhoyDTU. Thanks, let us see who will make use of this blueprint for whatever app-plugin they want to provide for AhoyDTU. Did you already have a specific purpose in mind ?
Yes, i do. Want to connect my power meter and implement some "Nulleinspeisung".
I also added a mqtt callback to my example, to enable input/control data for a thirdparty app. e.g. publishing to topic 'inverter/thirdparty/{data}' which will be ignored by the ahoi app. Should be sufficient for a simple start and enables user to add their own code, without "hacking" into the ahoi code base.
A more sophisticated approach would be adding hooks for all major functions (configuration, web, api, etc.), but 'a journey of a thousand miles begins with a single step'
If desired, I could add a pull request for simplicity reasons. :)
@womoak75 could you add a #define to disable your plugin by default and some example in example_overwrite_config.h before you PR. @lumapu did you take a quick look at this sample plugin or should @womoak75 wait with his PR till you have refactored a couple of things which you are busy with ?
Will add a PR at your request.
@stefan123t will do
also tried to add web / webApi / gui support
A possible example scenario for this plugin adapter could be the Thingspeak integration in #185 or the Prometheus support in #190 and PR #356 Maybe the Azure IOT Cloud OAuth also could qualify for such a flexible plugin approach ?
@stefan123t Maybe, but i am not familiar with the requirements.
Would suggest to merge my proposal and let the guys find out if its suitable or not. 'try and error', a frequently used developer approach. :)
Whats still missing, but probably necessary for "plugins", is configuration load/store functionality. I took a look at the relevant code but couldn't figure out how to implement it in a simple way. So i decided my application will use its own storage.
I would also recommend to refactor the GUI. Wouldn't it be much easier concerning maintenance and extension, if there's only one html main page and content loading is done by js? Menu bar entries are loaded via js already.
https://github.com/lumapu/ahoy/compare/main...womoak75:ahoy:plugins
https://github.com/lumapu/ahoy/compare/main...womoak75:ahoy:devel
plugin hacker version v0.0.1 :)
@lumapu können wir das als Beispiel für ein Plugin aktzeptieren und mergen ? @womoak75 hat einiges an Doku geschrieben und man müsste mal prüfen ob es noch aktuell / mergebar ist ?
An interface which allows easy integration of additional user applications into a custom Ahoi build would be a nice feature.
Unfortunately my knowledge of C++ is very 'minimalistic' (java ist my favourite), but i tried my very best to provide a simple example. https://github.com/lumapu/ahoy/compare/main...womoak75:ahoy:main
please feel free to agree/disagree or add additional topics.