Garbage Collection Reminder


#84

very odd

is there a way to do a fresh check other then a test ?


#85

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.


#86

Ok I’ll wait for the next holiday and see what happens


#87

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.


#88

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.


#89

You initialized isRecyclingWeek in the piston. Don’t do that as this will make sure it is always false when the piston starts…


#90

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.


#91

Perfect, thanks for that!


#92

@coops8d what url did you use on line 63 for using pushover? Was it https://api.pushover.net/1/messages.json?
Thanks


#93

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!


#94

This is the version of the piston I am currently using successfully:


#95

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?


#96

Here you go:

format('https://kayaposoft.com/enrico/json/v2.0/?action=getHolidaysForDateRange&fromDate=%s&toDate=%s&country=%s&region=%s&holidayType=public_holiday',formatDateTime($now, "d-M-y"), formatDateTime(addDays($now, pickupDay), "d-M-y"), countryCode, regionCode)

#97

Thanks, I needed to relaunch the dashboard and once I did that everything worked fine.


#98

For me, the “&region” is being converted to “®ion” in webCoRE

Which is returning an error when I query the site:
temp

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?


#99

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 '&reg to an HTML entity).


#100

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.
temp


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.
temp


#101

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 “&region” always converts to “®ion”, so the web request always fails.

temp


Here is my test with a backslash to escape

which returned this:

temp


Does anyone know how to force “&region” to remain in the URL without tampering?


EDIT

The solution for anyone else with the “&” issue is to replace it with
&
in the url.


#102

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.


#103

Interesting…
When the code looks right in webCoRE, the response fails.
When the code looks wrong in webCoRE, the response is successful.

Returns this:

temp