Garbage Collection Reminder


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


#120

bazgee

Using the example above, dwba, I would separate your Trash day from your Recycle day so they operate independently by altering the code beginning at line 56 as follows:

only when

{$dayOfWeek} is {dayofA}

with
Echo - Echo
do
Send PUSH notification “{“Reminder: " formatDateTime(addDays($now,0),“EEE, dd-MMM-yyyy”)”: " if({holidaysObserved} != “”,“No Trash collection Today. Holiday: ]” {holidaysObserved}, if({$dayOfWeek} == dayofA, “:wastebasket:Trash collection Today”, if({$dayOfWeek} == dayofB, “:recycle:Recycling Collection Today”,“No collection today”)))}”;
Speak “{“Reminder: " formatDateTime(addDays($now,0),“EEE, dd-MMM-yyyy”)”: " if({holidaysObserved} != “”,“No Trash collection Today. Holiday: ]” {holidaysObserved}, if({$dayOfWeek} == dayofA, “Trash collection Today”, if({$dayOfWeek} == dayofB, “Recycling Collection Today”,“No collection today”)))}”;

end with;

only when

{$dayOfWeek} is {dayofB}
with
Echo - Echo
do
Send PUSH notification “{“Reminder: " formatDateTime(addDays($now,0),“EEE, dd-MMM-yyyy”)”: " if({holidaysObserved} != “”,“No Trash collection Today. Holiday: ]” {holidaysObserved}, if({$dayOfWeek} == dayofA, “:wastebasket:Trash collection Today”, if({$dayOfWeek} == dayofB, “:recycle:Recycling Collection Today”,“No collection today”)))}”;
Speak “{“Reminder: " formatDateTime(addDays($now,0),“EEE, dd-MMM-yyyy”)”: " if({holidaysObserved} != “”,“No Trash collection Today. Holiday: ]” {holidaysObserved}, if({$dayOfWeek} == dayofA, “Trash collection Today”, if({$dayOfWeek} == dayofB, “Recycling Collection Today”,“No collection today”)))}”;

end with;


#121

I can’t change my recycling and trash days. I am from UK and we don’t get the choice. Normal bin is collected on Friday and the following Friday it swaps to recycling and so on…


#122

I’m not asking you to change the days of your actual collection. I was referring to changing the code in the piston.


#123

Yes but your piston wouldn’t work as my bin days are the same day so whenever it is ran it announces its bin day and recycle bin day at the same time. I need it to be bi weekly but for each one.