Page 1 of 1

Feature request: dynamic parameters for plugins

Posted: Wednesday 01 May 2019 11:17
by Barberousse
Hello,

I already developed 2 plugins for Domoticz: DomoticzLinky and DomoticzEbusd. For this plugin, it would be great it the parameters of the plugin could be configured dynamically.

For DomoticzEbusd, as soon as it has the IP address, the telnet port, the user name and password, the plugin is able to send back the possible registers that the user might want to add to the list of registers he wants to monitor (this registers becomes separate Domoticz devices managed by the plugin, for instance temperature, pressure of the boiler, etc.). Today, the user has to parse by himself a JSON page to find the registers he wants to monitor, then he has to write them back to a text input, separated with space. With some dynamic parameters, it would be far easier to configure.

Any thoughts ?

Re: Feature request: dynamic parameters for plugins

Posted: Wednesday 01 May 2019 13:45
by Dnpwwo
@Barberousse,

There are certainly a number of thoughts/threads around on this topic. It seems that Python plugins now being authored are now matching (or exceeding) the complexity of the C++ native support (which is great 8-)).

There are 2 parts to this IMHO:
  • Ability to store/retreive structured configuration from the Domoticz database using the plugin framework
  • Ability to display a plugin specific webpage to maintain the configuration
I am current in the process of adding the ability to maintain configuration (outside of the Parameters) via the framework and hope to have something available soon. I need this for my Google Home plugin so its a priority for me :). I will put something on the forum when this is done.

For the 2nd part, I'm currently planning on trying to serve the web content from the plugin itself rather than extend the Domoticz internal web server. Overall I think that would be more flexible. I'm thinking about creating a Python module that could be imported to help although I'm open to suggestions.

Re: Feature request: dynamic parameters for plugins

Posted: Wednesday 01 May 2019 14:02
by zak45
Dnpwwo wrote: Wednesday 01 May 2019 13:45 I am current in the process of adding the ability to maintain configuration (outside of the Parameters) via the framework and hope to have something available soon. I need this for my Google Home plugin so its a priority for me :). I will put something on the forum when this is done.

For the 2nd part, I'm currently planning on trying to serve the web content from the plugin itself rather than extend the Domoticz internal web server. Overall I think that would be more flexible. I'm thinking about creating a Python module that could be imported to help although I'm open to suggestions.
Like to see this will go in this way.
Great to have new framework feature for configuration.

For the web part, I have played a little bit with the framework communication possibilities and must say that looks very stable.
My last plugin, EZJarviz, use that deeply, and I have even been able to create admin html pages that go through the framework web server without any trouble.
In this way, all is managed by python and fully integrated with Domoticz by using Domoticz Json & custom page possibilities.

Keep up good work..

Re: Feature request: dynamic parameters for plugins

Posted: Wednesday 01 May 2019 14:53
by Barberousse
Dnpwwo wrote: Wednesday 01 May 2019 13:45
  • Ability to store/retreive structured configuration from the Domoticz database using the plugin framework
  • Ability to display a plugin specific webpage to maintain the configuration
Exactly what I need :-) : some functions to serialize/deserialize and save plugin parameters, and a way to display specific web forms with plugin callbacks, with AJAX techniques or whatever suits the needs, I'm not a web developper, that integrates well with Domoticz and AngularJS

Re: Feature request: dynamic parameters for plugins

Posted: Sunday 05 May 2019 18:01
by pipiche
Dnpwwo wrote: Wednesday 01 May 2019 13:45 @Barberousse,

There are certainly a number of thoughts/threads around on this topic. It seems that Python plugins now being authored are now matching (or exceeding) the complexity of the C++ native support (which is great 8-)).

There are 2 parts to this IMHO:
  • Ability to store/retreive structured configuration from the Domoticz database using the plugin framework
  • Ability to display a plugin specific webpage to maintain the configuration
I am current in the process of adding the ability to maintain configuration (outside of the Parameters) via the framework and hope to have something available soon. I need this for my Google Home plugin so its a priority for me :). I will put something on the forum when this is done.

For the 2nd part, I'm currently planning on trying to serve the web content from the plugin itself rather than extend the Domoticz internal web server. Overall I think that would be more flexible. I'm thinking about creating a Python module that could be imported to help although I'm open to suggestions.
Great news, keep me in the loop if you want additional testers .

Re: Feature request: dynamic parameters for plugins

Posted: Sunday 05 May 2019 18:08
by pipiche
zak45 wrote: Wednesday 01 May 2019 14:02
Dnpwwo wrote: Wednesday 01 May 2019 13:45 I am current in the process of adding the ability to maintain configuration (outside of the Parameters) via the framework and hope to have something available soon. I need this for my Google Home plugin so its a priority for me :). I will put something on the forum when this is done.

For the 2nd part, I'm currently planning on trying to serve the web content from the plugin itself rather than extend the Domoticz internal web server. Overall I think that would be more flexible. I'm thinking about creating a Python module that could be imported to help although I'm open to suggestions.
Like to see this will go in this way.
Great to have new framework feature for configuration.

For the web part, I have played a little bit with the framework communication possibilities and must say that looks very stable.
My last plugin, EZJarviz, use that deeply, and I have even been able to create admin html pages that go through the framework web server without any trouble.
In this way, all is managed by python and fully integrated with Domoticz by using Domoticz Json & custom page possibilities.

Keep up good work..
@zak45 can you post some example on how you administrate the plugin with admin htl pages ? DO you mean that you have one sort of plugin for admin and one real plugin ?

Re: Feature request: dynamic parameters for plugins

Posted: Sunday 05 May 2019 18:55
by zak45
@pipiche
hi,
all is managed by the plugin.py file.
To not block Domoticz in case big time consuming tasks, there is another py to handle that...

you can found all in wiki :

https://www.domoticz.com/wiki/Plugins/EZJarviz.html

Re: Feature request: dynamic parameters for plugins

Posted: Monday 13 May 2019 9:38
by Dnpwwo
Current Beta has a new Domoticz.Configuration function to read and write structured data into the database. Data is stored in JSON in the 'Configuration' column in the Hardware table.

Usage is covered here: https://www.domoticz.com/wiki/Developin ... llable_API

Has not been tested extensively yet so try it on your dev systems first !