Skip to content

MQTT trigger functions fail when no arguments expected #170

Closed
@Beiri22

Description

@Beiri22

With the new additions of 1.3. I got a problem, that is easy to work around but may need some attention:

@mqtt_trigger(...)
@state_active(...)
@task_unique(...)
def lueften():
    SOME

no fails with:

2021-02-26 09:20:09 ERROR (MainThread) [custom_components.pyscript.function] run_coro: got exception Traceback (most recent call last):
File "/config/custom_components/pyscript/eval.py", line 697, in call
elif i < len(self.kw_defaults) and self.kw_defaults[i]["ok"]:
TypeError: lueften() called with unexpected keyword arguments: payload, payload_obj, qos, topic, trigger_type

Easy to work around:

@mqtt_trigger(...)
@state_active(...)
@task_unique(...)
def lueften(**kwargs):
    SOME

But it would be handy to also be allowed to not expect any parameter.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions