pyscript
pyscript copied to clipboard
@task_unique decorator not equivalent to task.unique()
With the @task_unique(name) decorator, the task name is set to ['<name>'] instead of name. task.unique(name) sets the name correctly which means that mixing the two behaves unexpectedly.
Test code:
@time_trigger
@task_unique('test1')
def test():
task.unique('test2')
log.warning(task.name2id())
and this is logged
{"['test1']": <Task pending name='Task-2691674' coro=<Function.run_coro() running at /config/custom_components/pyscript/function.py:448>>, 'test2': <Task pending name='Task-2691674' coro=<Function.run_coro() running at /config/custom_components/pyscript/function.py:448>>}
@craigbarratt this one is for you
Thanks for the bug report. I just pushed 515a5c2 which should fix it.