Garbage Collection Reminder


#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


#104

And this is exactly why I wrote my piston to calculate its own holidays, rather than rely on an external holiday notification. In my area, the garbage holidays are NYD, PresidentsDay, Memorial, July4, Labor, Columbus, Xmas. Three are hard dates so that’s easy. The other four are all expressed as the “X-th Monday of (month)”, which is a rule that can easily be written. Why rely on externals when you don’t have to?


#105

The advantage of the externals is that you can ask for a range (e.g., you need to know whether there is a holiday in the next week before or at the day in question) – rather than having to loop over each day a single result makes this a lot easier.

On another note – I have seen the holiday piston and it does look a little “brute force” to me. Using formatDate() you could make it a lot more compact:


#106

Ok, need a little help here. So I’m looking at my dashboard right now and I see this, which is what I would expect. Capture
However last night and this morning I got these notifications

Here is a green snapshot of the piston.

Any help would be greatly appreciated. I can’t remember exactly who I stole this from, but it was in this thread.


#107

Try this update. I changed how I deal with isHoliday.


#108

When I import it it is asking for a url that is missing? Any idea what that might be? The only webpage I see is down on line 45, but that imported correctly…


#109

You can skip the url line. it will be generated when the piston runs.


#110

Awesome, thanks. I see you define two days of the week, do you have collection 2x a week? I just have collection once a week with recycling every other week.

I will set this up to alert me tomorrow, so thanks again.


#111

Yes I have trash collection twice a week, and recycling once a week on same day as my trash pickup. There are other examples to show how to deal with recycling every other week.


#112

I barely have enough trash for once every week, not sure what i would do if it was collected 2x a week. Appreciate the piston, just going through it to try and figure out how to drop the 2nd collection without messing anything else up.


#113

How do you edit this so that it reminds me of my actual trash days? Which happen to be Tuesday and Thursday btw.


#114

You set dayofA to 2 and dayofB to 4.


#115

On all the lines where it says: dayofweek = x
or
dayofweek is x

or both?


#116

Line 29 const integer dayofA = 2
line 31 const integer dayofB=4


#117

So with your piston you should get a push notification as well as an announcement on whatever speakers you select? I set the reminder for today to test it out and I got nothing. The only things I changed was region code to al for Alabama, dayofA and dayofB, the time and the speakers used for the announcement.


I changed the time just now and tried it again and see nothing in my SmartThings activity feed. Any ideas what I might have changed that messed things up?


#118

I am hoping any expert can help me with this one! I cannot for the life of me figure out how to set up my garbage collection piston. I am using echo speaks for announcements but basically here is what I want:

My Normal rubbish bin day is Friday. Then the following Friday is my recycle bin day.

How on earth can I create this piston? I am not too concerned about holidays as I am from UK and can just edit the piston if it ever goes out of sync but basically my 2 bin days just swap on the same day each week. 1 week on same day its recycling then the next week on same day its rubbish.

HELP EXPERTS! haha, unless its not possible ? Thanks


#119

I was finally able to get this piston to run for me.
Thank you Mr. Ranger for this impressive piece of coding!

I have set the countryCode to = usa, and the regionCode to = ca.
The trash day is set to Wednesday, and the recycle day is set to Friday.
The pistion runs every day at 08:05 AM.

Once again, thank you DarcRanger.