My Garbage company has an rest api where you can check when they come to empty the container
http://inzamelkalender.hvcgroep.nl/push/calendar?postcode=2954NL&huisnummer=10
[{
"id": "001ce9bf0b847080a4ec7c9c89f8992e",
"adresId": "",
"code": "GFT",
"naam": "GFT",
"icon": "gft.png",
"dateTime": [{
"date": "2017-08-23 00:00:00",
"timezone_type": 3,
"timezone": "Europe\/Amsterdam"
}, {
"date": "2017-08-23 00:00:00",
"timezone_type": 3,
"timezone": "Europe\/Amsterdam"
}, {
"date": "2017-09-06 00:00:00",
"timezone_type": 3,
"timezone": "Europe\/Amsterdam"
}, {
"date": "2017-09-06 00:00:00",
"timezone_type": 3,
"timezone": "Europe\/Amsterdam"
}, {
"date": "2017-09-20 00:00:00",
"timezone_type": 3,
"timezone": "Europe\/Amsterdam"
}],
"opmerkingen": "",
"alt": false,
"datums": ["woensdag 23 augustus", "woensdag 23 augustus", "woensdag 6 september", "woensdag 6 september", "woensdag 20 september"]
}, {
“id”: “ee77b91da50ba360445eebbe541c9581”,
“adresId”: “”,
“code”: “REST”,
“naam”: “REST”,
“icon”: “rest.png”,
“dateTime”: [{
“date”: “2017-08-30 00:00:00”,
“timezone_type”: 3,
“timezone”: “Europe/Amsterdam”
}, {
“date”: “2017-08-30 00:00:00”,
“timezone_type”: 3,
“timezone”: “Europe/Amsterdam”
}, {
“date”: “2017-09-27 00:00:00”,
“timezone_type”: 3,
“timezone”: “Europe/Amsterdam”
}, {
“date”: “2017-09-27 00:00:00”,
“timezone_type”: 3,
“timezone”: “Europe/Amsterdam”
}, {
“date”: “2017-10-25 00:00:00”,
“timezone_type”: 3,
“timezone”: “Europe/Amsterdam”
}],
“opmerkingen”: “”,
“alt”: false,
“datums”: [“woensdag 30 augustus”, “woensdag 30 augustus”, “woensdag 27 september”, “woensdag 27 september”, “woensdag 25 oktober”]
}, {
“id”: “1bce248267719c42ea142d573ea750a6”,
“adresId”: “”,
“code”: “PAPIER”,
“naam”: “PAPIER”,
“icon”: “papier.png”,
“dateTime”: [{
“date”: “2017-09-01 00:00:00”,
“timezone_type”: 3,
“timezone”: “Europe/Amsterdam”
}, {
“date”: “2017-09-29 00:00:00”,
“timezone_type”: 3,
“timezone”: “Europe/Amsterdam”
}, {
“date”: “2017-10-27 00:00:00”,
“timezone_type”: 3,
“timezone”: “Europe/Amsterdam”
}, {
“date”: “2017-11-24 00:00:00”,
“timezone_type”: 3,
“timezone”: “Europe/Amsterdam”
}, {
“date”: “2017-12-22 00:00:00”,
“timezone_type”: 3,
“timezone”: “Europe/Amsterdam”
}],
“opmerkingen”: “”,
“alt”: false,
“datums”: [“vrijdag 1 september”, “vrijdag 29 september”, “vrijdag 27 oktober”, “vrijdag 24 november”, “vrijdag 22 december”]
}, {
“id”: “14400684f6bfd7233e64b97a61001aef”,
“adresId”: “”,
“code”: “PMD”,
“naam”: “PMD”,
“icon”: “plastic.png”,
“dateTime”: [{
“date”: “2017-09-13 00:00:00”,
“timezone_type”: 3,
“timezone”: “Europe/Amsterdam”
}, {
“date”: “2017-10-11 00:00:00”,
“timezone_type”: 3,
“timezone”: “Europe/Amsterdam”
}, {
“date”: “2017-11-08 00:00:00”,
“timezone_type”: 3,
“timezone”: “Europe/Amsterdam”
}, {
“date”: “2017-12-06 00:00:00”,
“timezone_type”: 3,
“timezone”: “Europe/Amsterdam”
}],
“opmerkingen”: “”,
“alt”: false,
“datums”: [“woensdag 13 september”, “woensdag 11 oktober”, “woensdag 8 november”, “woensdag 6 december”]
}]
I’ve now setup this in my configuration.yaml as follows
sensor:
- platform: rest
name: afvalkalender
resource: http://inzamelkalender.hvcgroep.nl/push/calendar?postcode=2954NL&huisnummer=10
value_template: '{{ value_json.0.naam }} {{ value_json.0.datums.0 }}'
But I would like have it not only for the first object but also for the other ones. I could set up the sensor three times for (Organic, Paper and Plastic waste) but is there a better way to do this?
Ideally I would like to have a group and then the name of the waste and the date it’s collected. The json is sorted by date.
Is it possible to use a json_value as friendly name of the sensor?