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:
- https://servicesgh.renoweb.dk/v1_13/AFP2/GetAffaldsportal2Config.aspx?appidentifier=DDDD4A1D-DDD1-4436-DDDD-3F374DD683A1
- Find your municipality in the list by municipality code, for example 851 for Aalborg. Copy the value of webserviceapikey.
Next, find your street:
- https://servicesgh.renoweb.dk/v1_13/GetJSONRoad.aspx?municipalitycode=851&apikey=webserviceapikey&roadname=streetname
(use the webserviceapikey from above and insert your street name)
Now, find your address:
- https://servicesgh.renoweb.dk/v1_13/GetJSONAdress.aspx?municipalitycode=851&apikey=webserviceapikey&roadid=xxx
(use the roadid from above)
Last, get your pickup data:
- https://servicesgh.renoweb.dk/v1_13/GetJSONContainerList.aspx?municipalitycode=851&apikey=webserviceapikey&adressId=yyy&fullinfo=1&supportsSharedEquipment=1
(use the addressId from above)
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:
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!