very odd
is there a way to do a fresh check other then a test ?
Not easily since it only check between the current day and the pickup day for holidays. Since we’re past the holiday already, it still wouldn’t find it.
When it says make sure to initialize this variable if it’s recycle week or not, does that mean just set to true or false for what ever week it is currently? As I had it as false for last week (no recycle) but it does not seem to have changed to true for this week.
I just gave it another week to make sure and yeah it does not seem to be changing each week. Can anyone please idiot proof my piston as I am sure I made a mistake somewhere there. This week should be both normal and recycle.
You initialized isRecyclingWeek
in the piston. Don’t do that as this will make sure it is always false when the piston starts…
I initialized isRecyclingWeek using int(formatDateTime($now,‘w’))%2==0.
If your recycle gets pickup on even weeks (week 2, 4, 38), set it to == 0
1 for odd weeks (week 1, 3, 37)
You can then remove the line set variable {isRecyclingWeek} = {!isRecyclingWeek}
I think that should work.
@coops8d what url did you use on line 63 for using pushover? Was it https://api.pushover.net/1/messages.json?
Thanks
Does anyone have a backup code that is still working to import this piston? Every one I’ve tried has failed. Doing this on a mobile phone and it’s a rather long piston to try and type all that out on a phone. Much appreciated!
Hi @ahndee. Line 45 did not come through when I imported this.
(even the image looks garbled for some reason)
Can you post that expression in plain text please?
Here you go:
format('https://kayaposoft.com/enrico/json/v2.0/?action=getHolidaysForDateRange&fromDate=%s&toDate=%s&country=%s®ion=%s&holidayType=public_holiday',formatDateTime($now, "d-M-y"), formatDateTime(addDays($now, pickupDay), "d-M-y"), countryCode, regionCode)
Thanks, I needed to relaunch the dashboard and once I did that everything worked fine.
For me, the “®ion” is being converted to “®ion” in webCoRE
Which is returning an error when I query the site:
I am wondering if I need to parse the url prior to making this GET request.
Is this line an Expression or Value in your piston?
It is an expression and shows up garbled in the editor for me as well but it works.
Try this expression instead:
format('https://kayaposoft.com/enrico/json/v2.0/?action=getHolidaysForDateRange&fromDate=%s&toDate=%s&country=%s%sregion=%s&holidayType=public_holiday',formatDateTime($now, "d-M-y"), formatDateTime(addDays($now, pickupDay), "d-M-y"), countryCode, '&', regionCode)
(i.e., I split the '&'
from 'region'
in order to prevent the automatic conversion of '®
to an HTML entity).
Your logic is sound, but that also returns the same wonky address:
I even tried logging to console in case the returned syntax was different, but I got the same results.
Since there are no holidays this week, I am going to copy that line into another portion of the code to see if the direct web call works
Edit
Shoot. That did not work either.
I don’t know how this url is working for you guys. I have tried in 3 different browsers, tried both Value & Expression, tried splitting it into two variables “&re” and “gion”, and even tried using an escape character, but “®ion” always converts to “®ion”, so the web request always fails.
Here is my test with a backslash to escape
which returned this:
Does anyone know how to force “®ion” to remain in the URL without tampering?
EDIT
The solution for anyone else with the “&” issue is to replace it with
&
in the url.
In order to try and get a valid response, you could try to set the end data to 2-1-2019. I believe the conversion to ® might happen only on the UI (when logging to the console), the actual request goes out correctly.
Interesting…
When the code looks right in webCoRE, the response fails.
When the code looks wrong in webCoRE, the response is successful.
Returns this: