Feature request: dynamic parameters for plugins

Python and python framework

Moderator: leecollings

Post Reply
Barberousse
Posts: 141
Joined: Wednesday 02 December 2015 21:47
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: France
Contact:

Feature request: dynamic parameters for plugins

Post 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 ?
User avatar
Dnpwwo
Posts: 820
Joined: Sunday 23 March 2014 9:00
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Melbourne, Australia
Contact:

Re: Feature request: dynamic parameters for plugins

Post 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.
The reasonable man adapts himself to the world; the unreasonable one persists to adapt the world to himself. Therefore all progress depends on the unreasonable man. George Bernard Shaw
zak45
Posts: 954
Joined: Sunday 22 January 2017 11:37
Target OS: Windows
Domoticz version: V2024.4
Contact:

Re: Feature request: dynamic parameters for plugins

Post 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..
Barberousse
Posts: 141
Joined: Wednesday 02 December 2015 21:47
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: France
Contact:

Re: Feature request: dynamic parameters for plugins

Post 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
pipiche
Posts: 2035
Joined: Monday 02 April 2018 20:33
Target OS: Linux
Domoticz version:
Contact:

Re: Feature request: dynamic parameters for plugins

Post 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 .
pipiche
Posts: 2035
Joined: Monday 02 April 2018 20:33
Target OS: Linux
Domoticz version:
Contact:

Re: Feature request: dynamic parameters for plugins

Post 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 ?
zak45
Posts: 954
Joined: Sunday 22 January 2017 11:37
Target OS: Windows
Domoticz version: V2024.4
Contact:

Re: Feature request: dynamic parameters for plugins

Post 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
User avatar
Dnpwwo
Posts: 820
Joined: Sunday 23 March 2014 9:00
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Melbourne, Australia
Contact:

Re: Feature request: dynamic parameters for plugins

Post 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 !
The reasonable man adapts himself to the world; the unreasonable one persists to adapt the world to himself. Therefore all progress depends on the unreasonable man. George Bernard Shaw
Post Reply