bruxy70 / Garbage-Collection

🗑 Custom Home Assistant sensor for scheduling garbage collection (or other regularly re-occurring events - weekly on given days, semi-weekly or monthly)
MIT License
383 stars 90 forks source link

Garbage Collector causes HA to hang in some cases #433

Closed mackowskim closed 1 year ago

mackowskim commented 1 year ago

Before you submit a new bug report, please check that

Describe the bug

Hi, First of all, thanks for this integration!

I have an issue when I try to set up monthly collection on first Monday or Thursday of the month (depends which comes first). So I tried this helper setup:

  1. MONTHLY collection

  2. Collections days: Mon, Thu

  3. First day of the month

  4. Then the last option (which I suppose means whichever comes first in the first week of the month) obraz

Whan I click Apply it shows just SUCCESS and my entire HA instance hangs. Calendar stops working and HA stops responding. After restart, the new helper won't appear

Configuration

No helper created for the given case

Debug logs

Nothing relevant in the log:

2022-10-18 13:44:09.574 DEBUG (MainThread) [custom_components.garbage_collection] Setting Śmieci kolorowe (monthly) from ConfigFlow
2022-10-18 13:44:09.575 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.garbage_collection
2022-10-18 13:44:09.576 DEBUG (MainThread) [custom_components.garbage_collection.sensor] (Śmieci kolorowe) Calling update
bruxy70 commented 1 year ago

Ok, thanks. Confirmed. Will look at this. The last option is IMHO a weird option that means it will not look for 1st Monday or Thursday in the month, but it will always take Monday and Thursday of the 1st week of the month (meaning it has at least 1 day in that month). So it could be, that if 1st of the month is on Tuesday, it will take the Monday 31st as the 1st Monday of the month. I think it is weird, but there are apparently some countries where this is common.

If you configure Monday and Thursday, it will always register both Monday and Thursday, not whichever comes first. If you want to do what you describe, I guess you'd have to do it through a manual update automation - go for Thursday, and if the date is 4th (so Monday was 1st), then move it to Monday (offset it by -3)

mackowskim commented 1 year ago

Thanks for your update. So what if the month starts from Saturday? Then Monday is 3rd and Thursday is 6th. Would you be so kind and send me manual config that would work?

bruxy70 commented 1 year ago

In that case, it will schedule the collection on 3rd and 6th. So if I understand what you want to do, configure it for Thursday only. Enable manual update. Then create an automation based on documentation, checking all the dates and if the day is == 4, call the offset. If this is too complicated for you, then just forget it and deal with the two dates, Monday and Thursday. Or pick one of the two.

github-actions[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had any activity in last 30 days. It will be closed in 5 days if no further activity occurs. Thank you for your contributions.