Rain forecast automation

This automation has been working like a charm for weeks now, but I realized that I need the variable of 4 days to be more specific. I need to calculate the remaining days untill next wednesday so the automation will check the forecast from today untill next wednesday and tell me if it’s gonna rain. I’ve been looking in the forum for the template to calculate the remaining days untill a specific week date and convert it on an integral number with the format %w, but I cant seem to tweak a template that works. Can you please help with this code?
Thanks