Waste collections Belgium

Hi,

Since a few weeks all schedules for waste collection in Belgium are published on a website.
The backend uses an open API.
I have created a binding which reads the API based on your address. It will create a line of text with the date and the next waste collections.
Very helpful for me. It is published on Github in case you’re interested.
Feedback is welcome.

3 Likes

For those who are interested, new version is published on Github
Tokens were updated. Feedback is welcome.

1 Like

Great, I’ll give it a try.
I was looking for a ical file few weeks ago and I didn’t want to install the app so I entered the collection days manually

However I see 2 jar files in the git, (one marked 2021 and the other one 2020).
Assume 2021 is the one to be used, right? (I see both are recently modified, that is why I am asking).

Cheers

Yes, it is the 2021 one.
As I don’t wanted to delete the original one first. If it works for you, then I will delete the other to avoid confusion.

1 Like

Hi @BeanzBE

I get this error when I load the jar:

2021-02-14 14:58:02.790 [WARN ] [org.apache.felix.fileinstall        ] - Error while starting bundle: file:/usr/share/openhab/addons/org.openhab.binding.recycleappbelgium-2.5.12-SNAPSHOT-2021.jar
org.osgi.framework.BundleException: Could not resolve module: org.openhab.binding.recycleappbelgium [278]
  Unresolved requirement: Import-Package: org.eclipse.smarthome.core.library.types

	at org.eclipse.osgi.container.Module.start(Module.java:444) ~[org.eclipse.osgi-3.12.100.jar:?]
	at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:383) ~[org.eclipse.osgi-3.12.100.jar:?]
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundle(DirectoryWatcher.java:1260) [bundleFile:3.6.4]
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundles(DirectoryWatcher.java:1233) [bundleFile:3.6.4]
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:520) [bundleFile:3.6.4]
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:365) [bundleFile:3.6.4]
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:316) [bundleFile:3.6.4]

Any idea what could be wrong?
I am running OH3 on openhabian installed on rPi4 8GB RAM

Ah, of course, OH3. This one is for OH2.5.
I will recompile it for you.

EDIT: Added 3.1 jar

Thanks @BeanzBE

It works when I configure it from the web interface, the result is correct:

(2021-02-16)PMDhuisvuil(2021-02-17)Snoeihout (op afspraak)(2021-02-19)gft

However I get:

2021-02-14 19:36:06.605 [INFO ] [um.internal.RecycleappBelgiumHandler] - java.lang.NullPointerException

when I try to configure the thing via the text file. My config is as follows and I cant see the difference in the configured parameters from the OH3 web interface :
Thing:
Thing recycleappbelgium:Collection:home "Waste@Home" [Zip="2950", Street="xxxx", HouseNumber="xx", Language="NL", refreshInterval=12]

Item:
String NextWasteCollection "Next Waste Collection" <calendar> (grpSettings) {channel="recycleappbelgium:Collection:home:NextCollection"}

As a suggestion, would it be difficult to get the dates per type in a different channel?
For example date for:
-rest
-PMD
-gft
-paper

Or if you already have a rule to take out the dates from the result string can you please share it?
It would be handy to trigger announcements via assistant devices.

The language should be in lower case. Need to make that clearer.
Currently it works for me to just see the date and the (concatenated) string.
Can’t promise anything but will see if I can do something with a separator.

Thanks, it works now.

Hi @BeanzBE ,

I don’t get updates anymore, I tried disable and reenable the thing but no luck.
My last update is from last week. Does it work for you?

Mine shows the update for coming Thursday. I have to wait till Friday to tell you more…

Works great!
Any advice on how to make the output more readable?

@DarkoG let me see if I can some extra logging. This should not pollute your logs too much
@stefaanbolle the whole idea was to put it in one channel. I can try to add a delimiter which you can use to split it yourself.

Great, thanks!

Any suggestions from the group?
Quick change give me this : (2021-02-25)Huisvuil (HV)***Papier-karton
I could put the date between square brackets if you want split it as HV is now also between braces.

@BeanzBE
I don’t see anything strange in the log, no errors reported. I looked at the collection calendar and there is no pick up this week, maybe that is the reason the item didn’t update (they collect the garbage every 2 weeks here, except in the summer gft is collected weekly):
2021-02-19 22:46:39.418 [INFO ] [um.internal.RecycleappBelgiumHandler] - Start fetching next waste collection...

@stefaanbolle
I have a rule that splits the next collection date and yells that on my google home speaker the night before, you might find it usefull:
PS I am not sure what response would come if the next collection is paper, they pick it monthly here and I didn’t see it so far, maybe @BeanzBE could advise

rule "Take out garbage alert"
    when 
	  Time cron "0 10 21,22 ? * * *"   //Run every day
    then
	val strNextCollect = NextWasteCollection.state.toString.split('\\(2').get(1)

       	val strDate ="2" + strNextCollect.split('\\)').get(0)
       	val strWasteType =strNextCollect.split('\\)').get(1)

        val nextCollectionYear = (strDate.split('-').get(0))
        val nextCollectionMonth =(strDate.split('-').get(1))
        val nextCollectiontDay =(strDate.split('-').get(2))

	    val dtNextCollectDate = parse(nextCollectionYear + "-" + nextCollectionMonth + "-" + nextCollectiontDay + "T" + "00:00:00.000+01:00[Europe/Brussels]").withZoneSameInstant(ZoneId.systemDefault())
        logInfo("recycleappbelgium:Take out garbage alert","dtNextCollectDate: "     + dtNextCollectDate)

        if(dtNextCollectDate.isBefore(now.plusHours(3) && dtNextCollectDate.isBefore(now.plusHours(1)))) {
           
            logInfo("recycleappbelgium:Take out garbage alert","Next waste collection date: "     + strDate)
            logInfo("recycleappbelgium:Take out garbage alert","Next waste collection type "     + strWasteType)
            ChromecastGrpGoogleTTSVolume.sendCommand(0)
             var Timer tmrMessageVolume = createTimer(now.plusSeconds(1), [ |                      
                ChromecastGrpGoogleTTSVolume.sendCommand(40)
                if ((strWasteType == "gft") || (strWasteType == "PMDhuisvuil") || (strWasteType == "papier")) playSound("pa.mp3")
            ] )
             var Timer tmrGarbageMessage = createTimer(now.plusSeconds(7), [ |
                            if (strWasteType == "gft") say(",, Remember to take out the garbage. Green garbage is collected tomorrow!")
                            if (strWasteType == "PMDhuisvuil") say(",, Remember to take out the garbage. PMD and home garbage is collected tomorrow!")
                            if (strWasteType == "papier") say(",, Remember to take out the garbage. Paper is collected tomorrow!")
                            ] )    
        }
end

That’s a good one. If the resultset is empty, there is no update on the channel.
I’m open for suggestions. Perhaps I might change it to “No waste collection found” or something.

Thanks! Very useful, made it a telegram notification in stead of say()

I can live with the existing solution, if the result is without a date my rule will not work. I will let you know if there is an update next week.

If you could share what could be the result strings would be fine. I have only seen PMDhuisvuil and gft, so I don’t know what to look for in my rule when other garbage is next for collection.

The result is given by the website. It seems every city/region has given their own description. Mine are different than yours.
I will put *** as delimiter in the next version to make it better readable and parsable.

We are Friday and the text has been updated so it keeps on working here.