Toon app: Afvalwijzer

Forum about forum-provided applications on Toon

Moderators: marcelr, TheHogNL, Toonz

Xavier
Member
Member
Posts: 174
Joined: Wed Jan 16, 2019 1:40 am

Re: Toon app: Afvalwijzer

Post by Xavier »

Toonz wrote:Hi all,

I propose the following solution for the provider rd4info.nl on a Toon 1 which is broken due to unsupported SSL functionality on a Toon 1.
On a Toon 2 the current functionality is working fine (rd4info.nl as wastecollector 17).

I created a second wastecollector id for rd4info (28) for use on a Toon 1 only.
As the data cannot be retrieved via QML you will need to download the rd4info calendar via wget with the option --no-check-certificates.
This can be done via a cron job and a simple script (explained in detail in the manuals section on the forum).

Steps to take:
1. login via SSH and create a folder 'waste' under root
2. install cron and wget if not already present using the manuals
3. the script to be scheduled running every week or so should contain (of course change the zipcode/housenr to yours):

Code: Select all

wget --no-check-certificate "https://www.rd4info.nl/NSI/Burger/Aspx/afvalkalender_public_text.aspx?pc=6441kw&nr=141&t=" -O /root/waste/rd4info.txt
4. run the script at least once
5. install the new 4.17 app from ToonStore and switch to wastecollector 28

I will release version 4.17 shortly.

Kind regardz,

Toonz
Going to try this, thanks!
Toon2 with 6.0.2 firmware TSC 2.1.7
Apps: Sonos, Calender, garbagecalender, webcam, doorcam, Onkyo, Domoticzboard, Solar and weather app.
Toonz
Forum Moderator
Forum Moderator
Posts: 1876
Joined: Mon Dec 19, 2016 1:58 pm

Re: Toon app: Afvalwijzer

Post by Toonz »

bananenman wrote:Since it is always a good idea to implement your own way of sharing data (sarcasm mode) the people of https://www.acv-groep.nl/ decided to stop with submitting their data to afvalwijzer.nl and implement their own application.

They are now using http://www.acv-afvalkalender.nl/ which produces a lot of Json garbage.
.......
Hi, it might be doable but it is a completely different approach from any other waste company (breaks the flow of the app a bit).
I will have a look when I have(make) time.... (no promises on any timelines though)

Kind regardz,

Toonz
member of the Toon Software Collective
bananenman
Starting Member
Starting Member
Posts: 3
Joined: Sun Jan 27, 2019 5:50 pm

Re: Toon app: Afvalwijzer

Post by bananenman »

Toonz wrote: Hi, it might be doable but it is a completely different approach from any other waste company (breaks the flow of the app a bit).
I will have a look when I have(make) time.... (no promises on any timelines though)

Kind regardz,

Toonz
Many thanks!
I've manually edited the JSON to match the structure used with the local file within the app. So I'm good for now, unless some dates change, I won't be able to pick up those.
Dewandelaar
Starting Member
Starting Member
Posts: 3
Joined: Mon Dec 31, 2018 12:34 pm

Re: Toon app: Afvalwijzer

Post by Dewandelaar »

Toonz wrote:Hi all,

version 4.14 is available in ToonStore with fixes for this year for meerlanden.nl and cure-afvalbeheer.nl
No other changes.

Kind regardz,

Toonz
Tank you very much,
It works as before.

Kind regards,
Dewandelaar
bananenman
Starting Member
Starting Member
Posts: 3
Joined: Sun Jan 27, 2019 5:50 pm

Re: Toon app: Afvalwijzer

Post by bananenman »

For all who use ACV Kalender...
Here is a VERY VERY dirty script to compile a file for local use in the wastecalendar app.
No comments on the scripting, I know it's dirty, max 1 hr spent on it..
Run in linux, (not on toon itself...) and if you find any other codes for the pickupType, please feel free to post them here.
Prerequisites:
install jq
install curl

Code: Select all

#!/bin/bash

# waste.sh postcode number
# ./waste.sh 1200XX 55

# 0 = Restafval
# 1 = Plastic, metaal en drakpakken
# 2 = Papier
# 3 = Groente, fruit en tuinafval
# 4 = Snoeiafval
# 5 = Textiel
# 6 = Puin
# 7 = Klein Chemisch afval
# 8 = Grofvuil
# 9 = Kunststoffel

[ -e waste ] && rm waste

requestidstring=$( bash <<EOF
curl -s 'https://wasteapi.2go-mobile.com/api/FetchAdress' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:64.0) Gecko/20100101 Firefox/64.0' -H 'Accept: application/json, text/plain, */*' -H 'Accept-Language: nl,en-US;q=0.7,en;q=0.3' --compressed -H 'Referer: https://wasteapi.2go-mobile.com' -H 'Content-Type: application/json;charset=utf-8' -H 'Origin: https://afvalportaal.2go-mobile.com' -H 'Connection: keep-alive' -H 'TE: Trailers' --data '{"postCode":"$1","houseNumber":"$2","companyCode":"f8e2844a-095e-48f9-9f98-71fceb51d2c3"}'
EOF
)

requestid=`echo $requestidstring | jq -r ".dataList[].UniqueId?"`

if [ "$requestid" == "" ] 
then
	echo "Address not found, ACV does not service you region?"
	exit
fi

echo -n "Street found: "
echo $requestidstring | jq -r ".dataList[].Street"
echo -n "Number: "
echo $requestidstring | jq -r ".dataList[].HouseNumber"
echo -n "Number: "
echo $requestidstring | jq -r ".dataList[].City"

requestwastelist=$( bash <<EOF
curl -s 'https://wasteapi.2go-mobile.com/api/GetCalendar' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:64.0) Gecko/20100101 Firefox/64.0' -H 'Accept: application/json, text/plain, */*' -H 'Accept-Language: nl,en-US;q=0.7,en;q=0.3' --compressed -H 'Referer: https://wasteapi.2go-mobile.com' -H 'Content-Type: application/json;charset=utf-8' -H 'Origin: https://afvalportaal.2go-mobile.com' -H 'Connection: keep-alive' -H 'TE: Trailers' --data '{"companyCode":"f8e2844a-095e-48f9-9f98-71fceb51d2c3","startDate":"2018-12-21","endDate":"2022-01-09","uniqueAddressID":"$requestid"}'
EOF
)

requestwastelist=${requestwastelist//T00:00:00/}

#echo $requestwastelist | jq -r ".dataList[5].pickupType"

loopcounter=0
pickupType=`echo $requestwastelist | jq -r ".dataList[$loopcounter].pickupType"`

while [ "$pickupType" != "null" ] 
do
case $pickupType in
1) #GREEN from ACV
  echo "Processing GFT dates"
  pickupTypeToon=3
  ;;
2) #PAPER from ACV
  echo "Processing PAPER dates"
  pickupTypeToon=2
  ;;
10) #PMT from ACV
  echo "Processing PMT dates"
  pickupTypeToon=1
  ;;
0) #REST from ACV
  echo "Processing REST dates"
  pickupTypeToon=0
  ;;
4) #TEXTIEL from ACV
  echo "Processing TEXTILE dates"
  pickupTypeToon=5
  ;;
*)
  ;;
esac

pickupDates=`echo $requestwastelist | jq -r ".dataList[$loopcounter].pickupDates[]"`

IFS=$'\n'
for Date in $pickupDates
do
	echo $Date,$pickupTypeToon >> waste

done

loopcounter=$((loopcounter+1))
pickupType=`echo $requestwastelist | jq -r ".dataList[$loopcounter].pickupType"`
done

cat waste | sort | uniq > waste-dates
mv waste-dates waste
Toonz
Forum Moderator
Forum Moderator
Posts: 1876
Joined: Mon Dec 19, 2016 1:58 pm

Re: Toon app: Afvalwijzer

Post by Toonz »

Hi all,

Version 4.17 is available in ToonStore with fixes for rmn.nl as well as an alternative solution for rd4info.nl (see a few posts above).

Changelog:
- created a second waste provider for rd4info.nl (28) on a Toon 1 due to issues with their new website certificate.
retrieve the calendar manually as described on the forum via wget and a cron job.
On a Toon 2 this is not needed and you can continue using waste provider 17 for rd4info.nl
- made a change for a group of waste collectors which retrieves ICS files automatically.
It doesn't matter anymore in which format the provider sends the DATE field.
As this is a generic change for all waste collector below, I might potentially have created an issue elsewhere.
Compared to the previous release rmn.nl should work again now.

Impacted waste collectors:
12: "rmn.nl"
11: "denhaag.nl"

Kind regardz,

Toonz
member of the Toon Software Collective
sanderjohan
Starting Member
Starting Member
Posts: 8
Joined: Thu Feb 22, 2018 10:28 pm

Re: Toon app: Afvalwijzer

Post by sanderjohan »

Hi,

I am using version 4.17 on my Toon1 and have my own waste.txt file for all dates. I am having now problems with the presented information in the tile. It shows now"

Afvalkalender
't error_month
E error_month
- error_month

When I open the tile I see
<!--Don't - -
<!DOCTYPE - -
</body>

etc


Format of the waste.txt file is:
2019-01-02,1
2019-01-09,1
2019-01-09,3
2019-01-16,1
2019-01-16,0
2019-01-23,1
2019-01-23,3

Any idea what the problem can be?

Can you maybe add Veldhoven as a waste provider in the list?

Thanks in advance,

Sander
Toonz
Forum Moderator
Forum Moderator
Posts: 1876
Joined: Mon Dec 19, 2016 1:58 pm

Re: Toon app: Afvalwijzer

Post by Toonz »

have you manually editied the waste.txt file? If so, then you need to select waste provider '0'.
Anyway, I will add veldhoven.nl. They use a known ICS format but just with their own unique waste descriptions.

Will be in a next release (not this week)
member of the Toon Software Collective
guustflater89
Starting Member
Starting Member
Posts: 2
Joined: Tue Dec 08, 2015 12:40 am

Re: Toon app: Afvalwijzer

Post by guustflater89 »

Toonz wrote:Hi all,
Compared to the previous release rmn.nl should work again now.

Impacted waste collectors:
12: "rmn.nl"
11: "denhaag.nl"

Kind regardz,

Toonz
Works fine now for rmn.nl, thnx!
mariusbrouwe
Starting Member
Starting Member
Posts: 6
Joined: Thu Jan 24, 2019 10:31 am

Re: Toon app: Afvalwijzer

Post by mariusbrouwe »

I tried to get the Afvalwijzer working with Rova by following the instructions provided: files.domoticaforum.eu/uploads/Toon/app ... ration.pdf.

The Afvalwijzer tile remains empty (white). My Toon is running version 5.0.4 and the Afvalkalender is 4.17.
Toonz
Forum Moderator
Forum Moderator
Posts: 1876
Joined: Mon Dec 19, 2016 1:58 pm

Re: Toon app: Afvalwijzer

Post by Toonz »

mariusbrouwe wrote:I tried to get the Afvalwijzer working with Rova by following the instructions provided: files.domoticaforum.eu/uploads/Toon/app ... ration.pdf.

The Afvalwijzer tile remains empty (white). My Toon is running version 5.0.4 and the Afvalkalender is 4.17.
It still works over here, some notes:
- in the past I noticed that it makes a difference which browser you use. I have tested this with Internet Explorer on Windows 10
- In the menu choose 'File', 'Save As', save as type 'Webpage, Complete'
- I now see what has changed: the default name for the save file is now "Rova Inzamelkalender.htm" (was "Rova Afvalkalender.htm" in the past, use this filename therefore when saving the file)
- On Toon the file should be called: /root/waste/ROVA Afvalkalender.htm
member of the Toon Software Collective
mariusbrouwe
Starting Member
Starting Member
Posts: 6
Joined: Thu Jan 24, 2019 10:31 am

Re: Toon app: Afvalwijzer

Post by mariusbrouwe »

It still works over here, some notes:
- in the past I noticed that it makes a difference which browser you use. I have tested this with Internet Explorer on Windows 10
- In the menu choose 'File', 'Save As', save as type 'Webpage, Complete'
- I now see what has changed: the default name for the save file is now "Rova Inzamelkalender.htm" (was "Rova Afvalkalender.htm" in the past, use this filename therefore when saving the file)
- On Toon the file should be called: /root/waste/ROVA Afvalkalender.htm
I didn't notice the fact that the webpage had a different name. It's working great now. Thanks!
Toonz
Forum Moderator
Forum Moderator
Posts: 1876
Joined: Mon Dec 19, 2016 1:58 pm

Re: Toon app: Afvalwijzer

Post by Toonz »

hi all,

I just published 4.18 on ToonStore with an update for rd4info.nl users.
No need to update for other users.

Changelog:
- fix for rd4info.nl due to a change in handling of dates by javascript in the newer firmwares

Kind regardz,

Toonz
member of the Toon Software Collective
Xavier
Member
Member
Posts: 174
Joined: Wed Jan 16, 2019 1:40 am

Re: Toon app: Afvalwijzer

Post by Xavier »

Toonz wrote:hi all,

I just published 4.18 on ToonStore with an update for rd4info.nl users.
No need to update for other users.

Changelog:
- fix for rd4info.nl due to a change in handling of dates by javascript in the newer firmwares

Kind regardz,

Toonz
Thanks, this fix works!
Toon2 with 6.0.2 firmware TSC 2.1.7
Apps: Sonos, Calender, garbagecalender, webcam, doorcam, Onkyo, Domoticzboard, Solar and weather app.
Toonz
Forum Moderator
Forum Moderator
Posts: 1876
Joined: Mon Dec 19, 2016 1:58 pm

Re: Toon app: Afvalwijzer

Post by Toonz »

sanderjohan wrote:Can you maybe add Veldhoven as a waste provider in the list?

Yes, it's done. One question: do you have a Toon 1 or a Toon 2?
On Toon 1 you will need to download the calendar via cron and wget as described earlier due to the server certificates which are not supported on Toon1.
Save the file in /root/waste/waste_calendar.ics and choose provider 29

On Toon 2 I can retrieve the file online (need to create a new waste provider for that but that's a 5 min job).

Next release will show up in ToonStore somewhere this weekend.

Kind regardz,

Toonz
member of the Toon Software Collective
Post Reply

Return to “Toon Apps”