Need help with custom notification plugin

CMK version: 2.0.0p20/2.1.0-latest
OS version: docker

Error message
var/log/notify.log

2022-10-26 04:58:35,115 [20] [cmk.base.notify] Executing 1 notifications:
2022-10-26 04:58:35,115 [20] [cmk.base.notify]   * notifying cmkadmin via IDERInote2.py, parameters: inote_api_url, inote_api_insecureconnection, inote_api_username, inote_api_userpass, inote_msg_addressingmode, inote_msg_duration, inote_msg_recipient, inote_msg_exclude, inote_msg_popup_or_fs, inote_msg_showticker, inote_msg_notifyreceive, inote_msg_notifyacknowledge, inote_msg_showonwinlogon, inote_msg_showonwinlogononly, inote_msg_homeoffice_or_networkrange, checkmkUrl, inote_plugin_loglevel, bulk: no
2022-10-26 04:58:35,115 [40] [cmk.base.notify]     ERROR:
Traceback (most recent call last):
  File "/omd/sites/cmk/lib/python3/cmk/base/notify.py", line 611, in _process_notifications
    plugin_context = create_plugin_context(raw_context, params)
  File "/omd/sites/cmk/lib/python3/cmk/base/notify.py", line 1455, in create_plugin_context
    events.add_to_event_context(plugin_context, "PARAMETER", params)
  File "/omd/sites/cmk/lib/python3/cmk/base/events.py", line 784, in add_to_event_context
    add_to_event_context(plugin_context, varname, value)
  File "/omd/sites/cmk/lib/python3/cmk/base/events.py", line 786, in add_to_event_context
    plugin_context[prefix] = plugin_param_to_string(param)
  File "/omd/sites/cmk/lib/python3/cmk/base/events.py", line 801, in plugin_param_to_string
    return "\t".join(value)
TypeError: sequence item 1: expected str instance, dict found

Problem description:
Hi,

I’m writing my own notification plugin and it seems to work with the 2.1 checkmk version. But when I’m trying to use it in 2.0 with a specific parameter defined, it crashes with the error above.

I have a theory why it’s failing but don’t know how to fix it. So let me explain and hopefully someone may be able to point me in the right direction on how to fix this and add compatibility for older versions.

So:
In wato I need an optional dropdown and based on its selection I need another dropdown below or a TextInput with an additional FixedValue. Actually right now it’s looking like this:
Selected first choice:
Bildschirmfoto 2022-10-26 um 07.20.10

Selected second choice:
Bildschirmfoto 2022-10-26 um 07.20.20

My code for this looks line this inside the register_notification_parameters() function:

(
    "inote_msg_homeoffice_or_networkrange",
    CascadingDropdown(
        title=_("Home office or network ranges feature"),
        help=_("As the home office and the network ranges feature of IDERI note are mutually exclusive you have to decide which one you would like to use."),
        sorted=False,
        choices=[
            (
                "homeoffice",
                _("IDERI note home office feature"),
                Dictionary(
                    optional_keys=[],
                    elements=[
                        (
                            "homeofficeselection",
                            CascadingDropdown(
                                title=_("Home office mode selection:"),
                                label=_("Mode:"),
                                help=_("You can either choose to exclude recipients working from a remote location to send only to them. This requires the IDERI note home office feature to be configured correctly on the IDERI note server."),
                                sorted=True,
                                choices=[
                                    (
                                        "homeofficeusersonly",
                                        _("Send only to home office users"),
                                    ),
                                    (
                                        "homeofficeusersexclude",
                                        _("Exclude home office users"),
                                    ),
                                ],
                            ),
                        ),
                    ],
                ),
            ),
            (
                "networkrange",
                _("IDERI note network ranges feature"),
                Dictionary(
                    optional_keys=["networkrangeexclude"],
                    elements=[
                        (
                            "networkrangeids",
                            TextInput(
                                title=_("IDERI note NetworkRange IDs to send to"),
                                placeholder=_("Comma separated list of IDs: '10, 8, ...'"),
                                help=_("The IDs of the IDERI note NetworkRange(s) as a comma separated string."),
                                size=80,
                                allow_empty=False,
                            ),
                        ),
                        (
                            "networkrangeexclude",
                            FixedValue(
                                value=True,
                                title=_("Exclude the specified network ranges."),
                                totext = _("True"),
                                help=_("Exclude the specified network ranges."),
                            ),
                        ),
                    ],
                ),
            ),
        ],
    ),
),

Ok, so like I said: Working for me in 2.1 but not in 2.0. With 2.0 I’m getting the error in the notify.log.
I’m testing in docker with images from checkmk dockerhub repo. What can I do to get it to work with older versions? Did I miss something? Is this even supported?
The ‘URL prefix for links to Checkmk’ field of Mail does something similar in my opinion. But I’m completely new to python, so it’s most definitely possible that i missed something important for this to work.

Any help appreciated. :slight_smile:

Regards