Garbage pickup dates in Denmark: RenoWeb

Many municipalities in Denmark are using the same IT infrastructure for managing containers, routes, collection dates etc. This is a short tutorial for integrating with RenoWeb, so your home automation will keep track of the next pickup dates for your garbage containers.

Prerequisites: HTTP binding and JSONPath transformation.

To keep the solution itself simple, there is some preparation needed: You need to find your container ids.

First, get municipalities:

Next, find your street:

Now, find your address:

Last, get your pickup data:

In the response you will find your container ids. For example:

{
    "status": {
        "id": 0,
        "status": null,
        "msg": "Ok"
    },
    "list": [
        {
            "id": 1,
            "name": "140L haveaffald",
            "count": "1",
            "module": {
                "id": 2,
                "name": "Haveaffald 140 L",
                "fractionname": "Haveaffald"
            },
            "fractionid": 7,
            "nextpickupdate": "Tirsdag d. 20-02-2024",
            "nextpickupdatetimestamp": "1708387200",

Here the id is 1 for the first container.

Now the most important part is done, since we have a working URL for retrieving the data we need. We can now configure some channels and items:

Thing http:url:renoweb "RenoWeb" [ baseURL="https://servicesgh.renoweb.dk/v1_13/GetJSONContainerList.aspx?municipalitycode=851&apikey=webserviceapikey&adressId=yyy>
    Channels:
        Type string : next-pickup-garden-waste "Haveaffald" [ stateTransformation="JSONPATH:$.list[?(@.id == 1)].nextpickupdatetimestamp" ]
        Type string : next-pickup-recycling    "Genbrug"    [ stateTransformation="JSONPATH:$.list[?(@.id == 2)].nextpickupdatetimestamp" ]
        Type string : next-pickup-mixed-waste  "Restaffald" [ stateTransformation="JSONPATH:$.list[?(@.id == 3)].nextpickupdatetimestamp" ]
}

And items:

Group:DateTime:EARLIEST RenoWeb_NextPickup "Næste tømning [%1$td.%1tm.%1$tY]" <time>

DateTime RenoWeb_NextPickup_GardenWaste "Haveaffald [%1$td.%1tm.%1$tY]" <time> (RenoWeb_NextPickup) { channel="http:url:renoweb:next-pickup-garden-waste" }
DateTime RenoWeb_NextPickup_Recycling   "Genbrug [%1$td.%1tm.%1$tY]"    <time> (RenoWeb_NextPickup) { channel="http:url:renoweb:next-pickup-recycling" }
DateTime RenoWeb_NextPickup_MixedWaste  "Restaffald [%1$td.%1tm.%1$tY]" <time> (RenoWeb_NextPickup) { channel="http:url:renoweb:next-pickup-mixed-waste" }

This mapping “magically” works because there is a DateTimeType constructor taking a string with an epoch value.

That’s it, really. Sitemap example:

Or widget Garbage Collection:

image

component: widget:garbage_list_v1
config:
  datearray: '"Haveaffald","green","f7:trash","RenoWeb_NextPickup_GardenWaste"|"Genbrug","blue","f7:trash","RenoWeb_NextPickup_Recycling"|"Restaffald","black","f7:trash","RenoWeb_NextPickup_MixedWaste"'
  tomorrow: I morgen
  today: I dag

Next step is to use your imagination how to use this data. As an example, I’m using a Sonos Move 2 as audio sink with prepared TTS audio samples for announcing upcoming pickups after a certain time of the day when motion is detected in the family room (i.e. when there is someone there to hear the announcement).

Have fun!

2 Likes

I noticed that this stopped working a few days ago. It turns out that new IDs were assigned, so actually everything is still working, but it’s needed to go through the payload again to obtain the new IDs.