Page 86 of 87

Re: Toon app: Afvalwijzer

Posted: Mon Jan 06, 2025 6:42 pm
by jnieuw
Bestand in /var/volatile/tmp gezet en nu werkt het :)

Re: Toon app: Afvalwijzer

Posted: Tue Jan 07, 2025 9:43 am
by Toonz
die locatie heeft wel als nadeel dat je het bestand opnieuw moet kopieren na een volledige herstart van Toon (na een stroomstoring bijvoorbeeld)

Re: Toon app: Afvalwijzer

Posted: Tue Jan 07, 2025 10:03 am
by jnieuw
Dat snap ik. Alleen is dat nu de enige manier dat hij het wel oppakt. Geen idee waarom, maar het werkt.

Re: Toon app: Afvalwijzer

Posted: Thu Mar 06, 2025 9:17 pm
by Rudolf
Hi,

I've been using this app for quite some time without any problems. But today I noticed that it shows additional dates, "Onbekend".
This is provider '33'. Looks like the expected pick-up dates are shown as well.

Wastedates.txt shows a question mark for these.
The .ics has Summary "Onbekend".

Code: Select all

EGIN:VEVENT^M
DTSTART;VALUE=DATE:20250311^M
SUMMARY:Onbekend^M
BEGIN:VEVENT^M
BEGIN:VEVENT^M
DTSTART;VALUE=DATE:20250311^M
SUMMARY:Onbekend^M
BEGIN:VEVENT^M
BEGIN:VEVENT^M
DTSTART;VALUE=DATE:20250312^M
SUMMARY:GFT^M
BEGIN:VEVENT^M
BEGIN:VEVENT^M
DTSTART;VALUE=DATE:20250314^M
SUMMARY:Onbekend^M
BEGIN:VEVENT^M
BEGIN:VEVENT^M
DTSTART;VALUE=DATE:20250314^M
SUMMARY:Onbekend^M
BEGIN:VEVENT^M
BEGIN:VEVENT^M
DTSTART;VALUE=DATE:20250319^M
SUMMARY:Rest^M
BEGIN:VEVENT^M
BEGIN:VEVENT^M
DTSTART;VALUE=DATE:20250324^M
SUMMARY:Papier^M
BEGIN:VEVENT^M
BEGIN:VEVENT^M
DTSTART;VALUE=DATE:20250326^M

Edit: Thanks to the comments in the wasteCollectionProvider.js I could try the API manually and it seems I now get "Kca" and "Textiel¨

Code: Select all

[{"date":"2025-03-11T00:00:00","name":"Kca","daysTillDate":5,"totalThisYear":null},{"date":"2025-03-11T00:00:00","name":"Textiel","daysTillDate":5,"totalThisYear":null},{"date":"2025-03-12T00:00:00","name":"Gft","daysTillDate":6,"totalThisYear":null},{"date":"2025-03-14T00:00:00","name":"Kca","daysTillDate":8,"totalThisYear":null},{"date":"2025-03-14T00:00:00","name":"Textiel","daysTillDate":8,"totalThisYear":null},{"date":"2025-03-19T00:00:00","name":"Pbd","daysTillDate":13,"totalThisYear":null},{"date":"2025-03-19T00:00:00","name":"Restafval","daysTillDate":13,"totalThisYear":null},{"date":"2025-03-21T00:00:00","name":"Papier","daysTillDate":15,"totalThisYear":null},{"date":"2025-03-26T00:00:00","name":"Gft","daysTillDate":20,"totalThisYear":null},{"date":"2025-03-28T00:00:00","name":"Kca","daysTillDate":22,"totalThisYear":null},{"date":"2025-03-28T00:00:00","name":"Textiel","daysTillDate":22,"totalThisYear":null},{"date":"2025-04-02T00:00:00","name":"Pbd","daysTillDate":27,"totalThisYear":null},{"date":"2025-04-02T00:00:00","name":"Restafval","daysTillDate":27,"totalThisYear":null},{"date":"2025-04-08T00:00:00","name":"Kca","daysTillDate":33,"totalThisYear":null},{"date":"2025-04-08T00:00:00","name":"Textiel","daysTillDate":33,"totalThisYear":null},{"date":"2025-04-09T00:00:00","name":"Gft","daysTillDate":34,"totalThisYear":null},{"date":"2025-04-11T00:00:00","name":"Kca","daysTillDate":36,"totalThisYear":null},{"date":"2025-04-11T00:00:00","name":"Textiel","daysTillDate":36,"totalThisYear":null},{"date":"2025-04-16T00:00:00","name":"Pbd","daysTillDate":41,"totalThisYear":null},{"date":"2025-04-16T00:00:00","name":"Restafval","daysTillDate":41,"totalThisYear":null},{"date":"2025-04-18T00:00:00","name":"Papier","daysTillDate":43,"totalThisYear":null},{"date":"2025-04-23T00:00:00","name":"Gft","daysTillDate":48,"totalThisYear":null},{"date":"2025-04-25T00:00:00","name":"Kca","daysTillDate":50,"totalThisYear":null},{"date":"2025-04-25T00:00:00","name":"Textiel","daysTillDate":50,"totalThisYear":null},{"date":"2025-04-30T00:00:00","name":"Pbd","daysTillDate":55,"totalThisYear":null},{"date":"2025-04-30T00:00:00","name":"Restafval","daysTillDate":55,"totalThisYear":null},{"date":"2025-05-
BAR-afvalbeheer shows:
"Mobiel afvalaanbiedstation (zie afvalwijzer)"
for these dates.

It's a bit difficult to show what it is, because it allows you to bring several types of waste at severa locations throughout the town.

Code: Select all

Kleine elektrische apparaten zoals een kapotte föhn, tandenborstel, laptop, scheerapparaat, lamp, boormachine of telefoon.
Klein Chemisch Afval (KCA) zoals een verfblik, olie, medicatie, spaarlampen of batterijen.
Harde kunststoffen zoals speelgoed, plantenbakje, opbergkrat of een emmer.
Hout zoals een krukje, fotolijstje, onderzetters, vogelhuisje of plankje.
Metalen zoals een koekenpan, keukengerei, gereedschap, rekje, prullenbak of ijzerdraad.
Karton zoals een doos.
Frituurvet - en oliën  
Piepschuim
Textiel
With this change, it shows Textiel or KGA

Code: Select all

        function wasteTypeCode(shortName) {
                switch (shortName) {
                        case "Restafval": return 0;
                        case "Gft": return 3;
                        case "Papier": return 2;
                        case "Pbd": return 1;
                        case "Kca": return 7;
                        case "Textiel": return 5;
                        default: break;
                }
                return "?";
        }

Re: Toon app: Afvalwijzer

Posted: Wed Mar 12, 2025 11:41 am
by Toonz
Thanks Rudolf,

I have updated the plugin '33', additionally also added the 'Snoeiafval' waste code used in some other cities (rwm.nl provider)
Please go to the 'Instellingen' screen of the app to automatically update the plugin.

Kind regardz,

Toonz

Re: Toon app: Afvalwijzer

Posted: Sat Mar 22, 2025 8:41 pm
by madpatrick
Hi,

Fow sometime i don't see the wastebin icon any more on the homescreen.
Only the arrow is visible when the wastebin has to return

Re: Toon app: Afvalwijzer

Posted: Sat Mar 22, 2025 11:13 pm
by Toonz
madpatrick wrote: Sat Mar 22, 2025 8:41 pm Hi,

Fow sometime i don't see the wastebin icon any more on the homescreen.
Only the aeeow is visible when the wastebin has to return
I assume you are referring to the waste icon in the thermostat panel (above the room temperature) and not the systray icon.
Can you go to the settings screen of the app to review your settings:
'Display icon vanaf uur:" 18 (if you want to show icons from 18:00 the day before the waste is collected
"Afvalicons in thermostaat" : enabled (green)

If all is set ok and the future waste collection dates shown are ok, then I would advise to restart the gui.
Note that the wastecollection app is starting retrieving data about 5 minutes after the gui restart

Re: Toon app: Afvalwijzer

Posted: Sun Mar 23, 2025 5:26 pm
by madpatrick
I think it is an issue with the custom icons.
My webserver was change a few months ago and the icons were not resored to the new webserver.
Apperntly it was reloading the icons and could not find them (of course)

Only i can get them back for some reason.
The default icon apperaed when switch of the setting custom icons

Can it be and can use https websites?

RMN ICS

Posted: Fri Jul 25, 2025 2:56 pm
by dagr9782
In case you need to generate an ICS file from the RMN Afvalkalender Mendix site, I created a KNIME workflow to transform webcapture JSON to ICS.

1. Access https://21burgerportaal.mendixcloud.com/p/rmn/landing/
2. Fill in zipcode and house number (do not send)
3. F12 - Network (Developer Tools - Network Capture)
4. Send the form
5. Export the WebCapture to JSON
6. In the KNIME workflow, change the file in the first node and execute the last node.

Re: Toon app: Afvalwijzer

Posted: Thu Aug 07, 2025 10:21 pm
by michel30
Hello.

RD4 number 17 does not work anymore? maybe they changed something on there webpage?
I am not sure if this was the link https://mijn.rd4.nl/kalender could you please have a look.
Thanks.

Re: Toon app: Afvalwijzer

Posted: Thu Aug 07, 2025 10:39 pm
by Xavier
Same here, number 17 rd4 doesn't work anymore....
rd4info.nl doesn't work anymore. Its now mijn.rd4.nl

Re: Toon app: Afvalwijzer

Posted: Thu Aug 07, 2025 11:45 pm
by Toonz
will have a look when back in NL

Re: Toon app: Afvalwijzer

Posted: Fri Aug 08, 2025 12:40 am
by Xavier
This new code below works at my side.

Main difference, data is now based on JSON API.

This URL format provides data:
https://data.rd4.nl/api/v1/waste-calend ... &year=2025

Adjusted code below

Code: Select all

//<provider>17</provider><version>1.0.2</version><parms>"zipcode,housenr"</parms>
//provider rd4info testdata:6444GL 10
//provider rd4info via officiële JSON API

function readCalendar(wasteZipcode, wasteHouseNr, extraDates, enableCreateICS, wasteICSId, wasteStreet, wasteStreetName, wasteCity, wasteFullICSUrl) {
	var wasteDatesString = "";
	var cureAfvalbeheerDates = [];
	var xmlhttp = new XMLHttpRequest();
	var year = new Date().getFullYear();

	xmlhttp.onreadystatechange = function () {
		if (xmlhttp.readyState === XMLHttpRequest.DONE) {
			if (xmlhttp.status === 200) {
				var json = JSON.parse(xmlhttp.responseText);
				if (json.success && json.data && json.data.items && json.data.items.length > 0) {
					var afvalItems = json.data.items[0]; // data.items is een array met 1 object waarin dates zitten

					for (var i = 0; i < afvalItems.length; i++) {
						var date = afvalItems[i].date; // formaat: yyyy-mm-dd
						var type = afvalItems[i].type; // bv: residual_waste
						var wasteType = wasteTypeRd4api(type);

						if (wasteType !== "?") {
							cureAfvalbeheerDates.push(date + "," + wasteType);
						}
					}

					var tmp = sortArray2(cureAfvalbeheerDates, extraDates);

					for (var i = 0; i < tmp.length; i++) {
						wasteDatesString = wasteDatesString + tmp[i] + "\n";
					}
					writeWasteDates(wasteDatesString, enableCreateICS);
				}
			} else {
				updateWasteIcon("error");
			}
		}
	}

	var url = "https://data.rd4.nl/api/v1/waste-calendar?postal_code=" + encodeURIComponent(wasteZipcode) + "&house_number=" + wasteHouseNr + "&house_number_extension=&year=" + year;
	xmlhttp.open("GET", url, true);
	xmlhttp.send();
}

function wasteTypeRd4api(apiType) {
	switch (apiType) {
		case "gft": return 3;               // Groente/fruit/tuinafval
		case "residual_waste": return 0;   // Restafval
		case "pmd": return 1;              // Plastic/Metaal/Drankkartons
		case "paper": return 2;            // Papier
		case "pruning_waste": return 4;    // Snoeiafval
		case "christmas_trees": return "#";// Kerstbomen
		case "best_bag": return "!";       // BEST-tas
		default: return "?";               // Onbekend type
	}
}

function sortArray2(inputarray, extraDates) {
	var newArray = inputarray.concat(extraDates);
	newArray.sort();
	return newArray;
}

function writeWasteDates(wasteDatesString, enableCreateICS) {
	var doc2 = new XMLHttpRequest();
	doc2.open("PUT", "file:///var/volatile/tmp/wasteDates.txt");
	doc2.onreadystatechange = function () {
		if (doc2.readyState === 4) {
			if (doc2.status === 0) {
				updateWasteIcon("no");
			}
		}
	};
	doc2.send(wasteDatesString);

	if (enableCreateICS) {
		var outputICS = "";
		var tmpICS = wasteDatesString.split("\n");

		for (var i = 0; i < tmpICS.length; i++) {
			if (tmpICS[i].length > 10) {
				outputICS += "BEGIN:VEVENT\r\n";
				outputICS += "DTSTART;VALUE=DATE:" + tmpICS[i].substring(0, 4) + tmpICS[i].substring(5, 7) + tmpICS[i].substring(8, 10) + "\r\n";
				outputICS += "SUMMARY:" + wasteTypeFriendlyName(tmpICS[i].substring(11, 12)) + "\r\n";
				outputICS += "END:VEVENT\r\n";
			}
		}

		var doc3 = new XMLHttpRequest();
		doc3.open("PUT", "file:///var/volatile/tmp/wasteDates.ics");
		doc3.send(outputICS);
	}
}

function wasteTypeFriendlyName(typeChar) {
	switch (typeChar) {
		case "0": return "Restafval";
		case "1": return "PMD-afval";
		case "2": return "Papier";
		case "3": return "GFT";
		case "4": return "Snoeiafval";
		case "#": return "Kerstboom";
		case "!": return "BEST-tas";
		default: return "Onbekend";
	}
}

Re: Toon app: Afvalwijzer

Posted: Fri Aug 08, 2025 2:48 pm
by michel30
Hi,

Yes this link https://data.rd4.nl/api/v1/waste-calend ... &year=2025 works for me as well with my postcode and housenumber.
The only question is where must I add this script in? or is this something that Toonz needs to planned in?

Re: Toon app: Afvalwijzer

Posted: Fri Aug 08, 2025 2:49 pm
by michel30
Toonz wrote: Thu Aug 07, 2025 11:45 pm will have a look when back in NL
Thanks, have a nice vacation.