biddster / node-red-contrib-schedex

Scheduler for node-red which allows you to enter on/off times as 24hr clock (e.g. 01:10) or suncalc events (e.g. goldenHour). It also allows you to offset times and randomise the time within the offset.
22 stars 17 forks source link

Failed to find valid time #64

Closed arozhankov closed 4 years ago

arozhankov commented 4 years ago

Hello!

I set the following settings: Friday, from 7 to 23 (see screenshot + code) Now: Fri, 22:50 Node displays an error: "Failed to find valid time [07:00]"

Снимок экрана 2019-12-13 в 22 50 47

Why?

================== [{"id":"77792c6e.3aa324","type":"schedex","z":"1da74fa3.e98a7","name":"DayTime_Fri 7-23","suspended":false,"lat":"55.018803","lon":"82.933952","ontime":"07:00","ontopic":"","onpayload":"","onoffset":0,"onrandomoffset":0,"offtime":"23:00","offtopic":"","offpayload":"","offoffset":0,"offrandomoffset":0,"mon":false,"tue":false,"wed":false,"thu":false,"fri":true,"sat":false,"sun":false,"x":330,"y":680,"wires":[["297c227f.07a79e"]]}]

Снимок экрана 2019-12-13 в 22 51 00
tomSmartHome commented 4 years ago

I'm facing the same issue. It occurs when you set a time that has "already passed" as if it couldn't take the "next matching day of the week" for the schedule.

This makes me doubt that schedex supports recursive (weekly) scheduling, any experience here?

arozhankov commented 4 years ago

I'm facing the same issue. It occurs when you set a time that has "already passed" as if it couldn't take the "next matching day of the week" for the schedule.

This makes me doubt that schedex supports recursive (weekly) scheduling, any experience here?

Yes. About six months work fine for me. I plan on the days of the week (different scenarios on different days of the week) the inclusion of lighting by motion sensors.

tomSmartHome commented 4 years ago

I think it will still work correctly.

My theory is that when a schedex node is initiated (you deployed changes, node red restarted, etc.) it fails when the only day of the week you picked is the current day of the week AND the time has already passed.

Instead I would expect that it takes the next matching day (in your case next Friday).

If you redeploy your flow on a different day than Friday (or on Friday before 7AM) it should be fine.

This should still be fixed as unexpected reboots might impact "single day schedules".

biddster commented 4 years ago

Sorry folks, this is a regression from a bit of refactoring I did to fix some other issues. Turns out I can't count!

I'll work up a unit test and try to fix it this week.

biddster commented 4 years ago

Fixed in 1.7.1