Trash Schedule | Notifications

I’m looking to set up alerts within OH that will remind the household of a couple of trash schedules so that the right items get placed on the curb on the right days and I’m looking to the community to see what might be the best way to implement this.

The goal is to speak alerts at a designated time prior and also to possibly display a reminder on a sitemap/HabPanel,

Here’s the information I have that the schedule will be based on:

Regular trash pickup is every Monday (except for holidays)
Recycling is every other Monday (except for holidays)

Junk/Heavy Waste is the first Friday of EVEN numbered months
Tree Waste is the first Friday of ODD numbered months.

So the question is, is this something I should use one of the calendar bindings for…or could this be done with rules?

I look forward to hearing your thoughts.

Squid

I can be done with Rules but I would use one of the calendar bindings. In the end it will be way less work and be far more flexible.

Have you used one over the other? Do you have any recommendations?

No. I’ve not had a need for setting a schedule like this yet. I’d probably recommend the CalDav binding as it will work with multiple calendars whereas Gcal only works with Google.

I have exactly the same use case.
I use Gcal to change the trash items to ON, that way I can use it simply in any rule I want. So often we forgot to put the trash outside that I implemented more than one reminder.
mobilephones get alerts, my dreambox displays a message when switched on and in my bathroom the LED lights turn red when I enter. further I implemented squeezebox so openhab even talks to us. depending on which laptop is turned on (my wife’s or mine) in the morning, I use a different tone of voice. my wife hears a lot of beggings and I love you and so on… you know, to meet the WAF… :wink:

1 Like

Would you mind sharing some of your code so I could see how the notifications are implemented?

Thanks.

Squid

var String REMmsg = ""

rule "gMull notification"
    when
        Item gMull received update ON
            then
        
            val StringBuilder mull = new StringBuilder
            gMull.members.filter[ i | i.state == ON ].forEach[i | mull.append(i.name + " und ") ]
            mull.delete(mull.length - 5, mull.length) //delete letztes " und "
            val StringBuilder mullurl = new StringBuilder
            gMull.members.filter[ k | k.state == ON ].forEach[k | mullurl.append(k.name + "%20und%20") ]
            mullurl.delete(mullurl.length - 9, mullurl.length) //delete letztes "%20und%20"
            sendNotification("xxx@gmx.at", "Bitte " + mull +" rausbringen!")
            var String REMmsg = "http://192.168.1.150/web/message?text=Bitte%20" + mullurl + "%20rausstellen!!&type=1&timeout=100"
            sendHttpGetRequest(REMmsg)
        end



rule "Mull switch reset"
    when
        Time cron "0 0 11 1/1 * ? *"  //11:00
        then 
            sendCommand(gMull,OFF)
        end

rule "Mullabfuhr Erinnerung voicecommand"
    when 
        Time cron "0 10 20 1/1 * ? *" or //20:10
        Item gComputer changed
    then
        val StringBuilder mull = new StringBuilder
    if (gMull.state == ON && now.getHourOfDay() >= 20 && now.getHourOfDay() <= 23) {
        gMull.members.filter[ i | i.state == ON ].forEach[i | mull.append(i.name + " und ") ]
        mull.delete(mull.length - 5, mull.length) //delete letzten " und "
        //logInfo ("Mullabfuhr", "bitte rausbringen: "+ mull)
        var String tmp = "Hey,  morgen kommt die Mullabfuhr. Bitte stell " + mull + " vors Tor, sonst stinkts. Bussi und Tschuess"
        say (tmp, "voicerss:deDE")
    }
    else if (gMull.state == ON && now.getHourOfDay() >= 0 && now.getHourOfDay() <= 10) {
        gMull.members.filter[ i | i.state == ON ].forEach[i | mull.append(i.name + " und ") ]
        mull.delete(mull.length - 5, mull.length) //delete letzten " und "
        var String tmp = "Guten Morgen, heute kommt die Mullabfuhr. Bitte stell " + mull + " vors Tor, schnell bevor die Mullabfuhr kommt. Bussi und Tschuess"
        say (tmp, "voicerss:deDE")
    }
end

rule "Mullabfuhr Erinnerung TV"
    when 
        Item enigma_power_switch received update ON 
    then 
        if (gMull.state == ON ) {
            var Timer bootTimer = null
            bootTimer = createTimer(now.plusMinutes(2), [|
                         //sendHttpGetRequest(enigma_REMmsg.state.toString)
                         sendHttpGetRequest(REMmsg)
                         bootTimer = null])
        }
    end

Here you can find my rule based solution as an alternative example

Note: better use Timers instead of Thread::sleep in the example rule, I should update this in the original thread

I would definitely use a calendar simply because in my country you do get the calendar entries from the company collecting the the trash.

This works like a charm… been using this for a while…

I’ve created a new google calendar for trash… and filled with the dates provided from the trash company…

grab the dates via python… store them in OH… and then 1 day before a message via Telegram is pushed in our household group…

Just to make sure I’m looking at this correctly…you are using your python script in place of the calendar bindings?

Thanks,

Squid

Yes… correct… when i was adding this feature to my OH system… there have been problem with the Cal(Dav) binding… Not sure if any of them are running now…
so i used the HowTo from this topic… and after i stumpled upon some problems when installing all things… i made this (linked post) with all informations put together…