Page 1 of 1

How to add explanation between plugin parameters ?

Posted: Saturday 06 November 2021 18:46
by keros
Hello everyone,

I would to know if it is possibile to add explanation between parameters like for the Evohome via web API :
Sans titre.png
Sans titre.png (108.52 KiB) Viewed 1252 times
I looked at differents plugin github repositories but none of them has description integrated between each parameters. They all have the wiki code with only the label :

Code: Select all

<params>
        <param field="Address" label="IP Address" width="200px" required="true" default="127.0.0.1"/>
        <param field="Port" label="Port" width="30px" required="true" default="9090"/>
        <param field="Mode1" label="MAC Address" width="150px" required="false"/>
        <param field="Mode2" label="Shutdown Command" width="100px">
            <options>
                <option label="Hibernate" value="Hibernate"/>
                <option label="Suspend" value="Suspend"/>
                <option label="Shutdown" value="Shutdown"/>
                <option label="Ignore" value="Ignore" default="true" />
            </options>
        </param>
        <param field="Mode3" label="Notifications" width="75px">
            <options>
                <option label="True" value="True"/>
                <option label="False" value="False"  default="true" />
            </options>
        </param>
        <param field="Mode6" label="Debug" width="75px">
            <options>
                <option label="True" value="Debug"/>
                <option label="False" value="Normal"  default="true" />
            </options>
        </param>
    </params>
</plugin>
"""
Is it possibile to add the explanations ?

Re: How to add explanation between plugin parameters ?

Posted: Sunday 07 November 2021 8:01
by Dnpwwo
Hi keros,

You can't in the current Domoticz stable but I liked this idea so I just pushed an update into the beta channel that allows it:

Code: Select all

<plugin key="Timeout" name="Timeout Tester" author="Dnpwwo" version="2.2.7" externallink="https://www.google.com">
    <description>
        <h2>Timeout Tester</h2><br/>
        Connect to URL and timeout with specified interval (milliseconds).
    </description>
    <params>
        <param field="Address" label="IP Address" width="200px" required="true" default="localhost"/>
        <param field="Mode1" label="Protocol" width="75px">
            <options>
                <option label="HTTPS" value="443"/>
                <option label="HTTP" value="8080"  default="true" />
            </options>
        </param>
        <param field="Mode2" label="Timeout" width="50px" required="true" default="250">
            <description>Values below 250 milliseconds will be ignored</description>
        </param>
        <param field="Mode6" label="Debug" width="150px">
            <description><h2>Debugging</h2>Select the desired level of debug messaging</description>
            <options>
                <option label="None" value="0"  default="true" />
                <option label="Python Only" value="2"/>
                <option label="Basic Debugging" value="62"/>
                <option label="Basic+Messages" value="126"/>
                <option label="Connections Only" value="16"/>
                <option label="Connections+Python" value="18"/>
                <option label="Connections+Queue" value="144"/>
                <option label="All" value="-1"/>
            </options>
        </param>
    </params>
</plugin>
the description is shown above the parameter and can contain embedded HTML so it can be styled

Re: How to add explanation between plugin parameters ?

Posted: Sunday 07 November 2021 9:14
by keros
Thank you very much Dnpwwo for your very quick action :P

I uptade to the lastest beta 13842 but I can not see the changes for the moment. That normal ? I have to wait for the next build ?

Re: How to add explanation between plugin parameters ?

Posted: Sunday 07 November 2021 9:20
by pipiche
I like that


Envoyé de mon iPhone en utilisant Tapatalk

Re: How to add explanation between plugin parameters ?

Posted: Sunday 07 November 2021 20:42
by Dnpwwo
Yes, it should be in the next beta build.

Re: How to add explanation between plugin parameters ?

Posted: Sunday 07 November 2021 20:45
by keros
Wonderfull :P

Thanks a lot

Re: How to add explanation between plugin parameters ?

Posted: Thursday 11 November 2021 10:06
by keros
The build changed (13872 now) but the description still not appears in the plugin page :roll:
Is it a problem on my side, or the modifications haven't been pushed yet ?

EDIT : I looked at my log and I have those errors for my test plugin
2021-11-11 10:12:21.352 Error: Test: (Timeout) failed to load 'plugin.py', Python Path used was '/home/pi/domoticz/plugins/Test/:/usr/lib/python37.zip:/usr/lib/python3.7:/usr/lib/python3.7/lib-dynload:/usr/local/lib/python3.7/dist-packages:/usr/lib/python3/dist-packages:/usr/lib/python3.7/dist-packages'.
2021-11-11 10:12:21.353 Error: Test: Module Import failed, exception: 'SyntaxError'
2021-11-11 10:12:21.353 Error: Test: Import detail: File: , Line: 1, offset: 1
2021-11-11 10:12:21.353 Error: Test: Error Line '<plugin key="Timeout" name="Timeout Tester" author="Dnpwwo" version="2.2.7" externallink="https://www.google.com">
2021-11-11 10:12:21.353 '
2021-11-11 10:12:21.353 Error: Test: No traceback available
The plugin.py is exactly the code you wrote above.

Re: How to add explanation between plugin parameters ?

Posted: Saturday 13 November 2021 19:57
by JanJaap
Hi Keros,

At first glance there seems to be an error already on the first line of your plugin. Sure that is all correct?

Re: How to add explanation between plugin parameters ?

Posted: Saturday 13 November 2021 21:14
by keros
Thanks for your reply JanJapp

I tooked exactly the example given just above by Dnpwwo :?

I tried with the wiki example code (which Dnpwwo has updated) and the description appears :D

Code: Select all

<plugin key="Kodi" name="Kodi Players" author="dnpwwo" version="1.0.0" wikilink="http://www.domoticz.com/wiki/plugins/Kodi.html" externallink="https://kodi.tv/">
    <description>
        <h2>Kodi Media Player Plugin</h2><br/>
        <h3>Features</h3>
        <ul style="list-style-type:square">
            <li>Comes with three selectable icon sets: Default, Black and Round</li>
            <li>Display Domoticz notifications on Kodi screen if a Notifier name is specified and events configured for that notifier</li>
            <li>Multiple Shutdown action options</li>
            <li>When network connectivity is lost the Domoticz UI will optionally show the device(s) with a Red banner</li>
        </ul>
        <h3>Devices</h3>
        <ul style="list-style-type:square">
            <li>Status - Basic status indicator, On/Off. Also has icon for Kodi Remote popup</li>
            <li>Volume - Icon mutes/unmutes, slider shows/sets volume</li>
            <li>Source - Selector switch for content source: Video, Music, TV Shows, Live TV, Photos, Weather</li>
            <li>Playing - Icon Pauses/Resumes, slider shows/sets percentage through media</li>
        </ul>
    </description>
    <params>
        <param field="Address" label="IP Address" width="200px" required="true" default="127.0.0.1"/>
        <param field="Port" label="Port" width="30px" required="true" default="9090"/>
        <param field="Mode1" label="MAC Address" width="150px" required="false"/>
        <param field="Mode2" label="Shutdown Command" width="100px">
            <options>
                <option label="Hibernate" value="Hibernate"/>
                <option label="Suspend" value="Suspend"/>
                <option label="Shutdown" value="Shutdown"/>
                <option label="Ignore" value="Ignore" default="true" />
            </options>
        </param>
        <param field="Mode3" label="Notifications" width="75px">
            <options>
                <option label="True" value="True"/>
                <option label="False" value="False"  default="true" />
            </options>
        </param>
        <param field="Mode6" label="Debug" width="75px">
            <description><h2>Debugging</h2>Select the desired level of debug messaging</description>
            <options>
                <option label="True" value="Debug"/>
                <option label="False" value="Normal"  default="true" />
            </options>
        </param>
    </params>
</plugin>

Re: How to add explanation between plugin parameters ?

Posted: Wednesday 01 February 2023 20:06
by madpatrick
Does anybody know if you can use these check boxes in a Python plugin ?
2023-02-01 20_04_49-(1) Domoticz - Post a reply.png
2023-02-01 20_04_49-(1) Domoticz - Post a reply.png (10.95 KiB) Viewed 638 times