nielsfaber / scheduler-component

Custom component for HA that enables the creation of scheduler entities
GNU General Public License v3.0
609 stars 39 forks source link

Schedule switch error in version 3.3.4 during a script repeat loop #363

Closed mobilifone closed 6 days ago

mobilifone commented 1 week ago

Checklist

Expected behavior

[What you expected to happen] All schedule switches related to the list should be turned on

Actual behavior

[What actually happened] Only the first element in the list is turned on and than error is raised

Steps to Reproduce

[Explain how to see the behaviour] This happen after the last scheduler update to version. 3.3.4

In my case I have several schedule items with different tags.

I have a script that provide a list of schedule switches (with a specific tag) to be turned on. When the script iterates the list, only the first element (the {{repeat.item}} scheduler switch) turns on but an error "object NoneType can't be used in 'await expression" is raised.

In the previous version was working fine. The problem seems related to scheduler switches only (working fine with any other switch in the house)

Here is the script fragment in yaml to reproduce (see the attached image with the script trace)

alias: myscript sequence:


any help is appreciated. Thanks Dario

image

dc911x commented 1 week ago

I can confirm this, my cover opening schedules gives the same error. Even when toggling on/off. The bellow is what is shown in the log viewer:

result = await task ^^^^^^^^^^ File "/config/custom_components/scheduler/switch.py", line 458, in async_turn_off await self.coordinator.async_edit_schedule( TypeError: object NoneType can't be used in 'await' expression

nielsfaber commented 1 week ago

Ouch, this seems 100% related to a change I made in the 3.3.4 release. I will make a fix for this tomorrow (I’m not at home today).

nielsfaber commented 6 days ago

This is now resolved in the v3.3.5 release. My apologies for causing this issue.

mobilifone commented 6 days ago

Thanks! Dario