Toon app: Afvalwijzer

Forum about forum-provided applications on Toon

Moderators: marcelr, TheHogNL, Toonz

Post Reply
Toonz
Forum Moderator
Forum Moderator
Posts: 1896
Joined: Mon Dec 19, 2016 1:58 pm

Toon app: Afvalwijzer

Post by Toonz »

Hi all,

A major release (5.1) is being released, please read this post as well : domoticaforum.eu/viewtopic.php?f=99& ... 050#p98676

Afvalwijzer 3.8 is available on ToonStore.

Changelog version 3.8:
- area-afval.nl implemented (waste provider 25, download ical from their website and copy the file to Toon as /root/waste/waste_calendar.ics
The file contains the full year calendar, so repeat once a year when next year's calendar is published

Changelog version 3.7:
- avalex.nl implemented (waste provider 24, enter ical calendar id in settings screen)

Changelog 3.6
- extra icons named "A" through "Z" will show only during the full day from midnight to midnight (useful for birthdays)
other icons "a" through "z" will use the display hour value from the configuration screen (useful for waste related items)
- added 'BEST tas' category for RD4, new icon designed by Vibestar

Previous info:

I started implementing a file with extra waste dates to be added to the waste provider data as requested here on this forum but ended up with custom categories and icons as well.
With this you can basically use the app not only for waste dates but also for any sort of calendar reminders, birthdays, wedding dates, whatever......
The extra files can either be hosted on any webserver or placed locally on Toon.


Result looks like this (some snippets):
screenshot_1.png
screenshot_1.png (35.25 KiB) Viewed 95423 times
screenshot_2.png
screenshot_2.png (25.76 KiB) Viewed 95423 times
screenshot_3.png
screenshot_3.png (27.39 KiB) Viewed 95423 times
When you want to store files locally on Toon use "file:///root/waste.txt" for instance instead of "http://192.168.1.192/waste.txt" in the config screen.

The file with extra waste dates should have the following format (either Unix or DOS text files):
YYYY-MM-DD,X
YYYY-MM-DD,X
etc...

Where X = : (built-in fixed descriptions)
"0" : Restafval
"1" : Plastic/Metaal/Drankpakken
"2" : Papier/karton
"3" : Groente/Fruit/Tuinafval
"4" : Snoeiafval
"5" : Textiel
"6" : Steen en puin
"7" : KGA
"8" : Groot vuil
"9" : Kunststoffen
"!" : BEST tas

or "A" through "Z" for custom icons and descriptions (use capitals), shown from midnight to Midnight
or "a" through "z" for custom icons and descriptions (use capitals), shown using the 'display from hour setting'

In this example the file with dates is called waste.txt on my webserver and contains this:

Code: Select all

2018-02-14,7
2018-02-15,7
2018-02-16,A
2018-02-16,B

If you want to use custom icons these should be placed in the folder mentioned in the configuration screen and named A.png, B.png etc.
This same folder should also contain the file "iconLabels.txt" with custom descriptions in JSON format.
In this case the file iconLabels.txt contains

Code: Select all

{"A": "Verjaardag A", "B": "Verjaardag B"}
icons folder on the webserver containing this:
screenshot_4.png
screenshot_4.png (6.52 KiB) Viewed 95423 times
When creating your own icons you could start with the existing ones from the ../wastecollection/drawables folder.
Create png files with size 126 x 126 pixels, and make sure you make the background transparent otherwise it doesn't look good on the dim screen.

If you have designed nice icons for birthdays, weddings, metal waste collection or whatever, feel free to share them here.

As always, comments and feedback are welcome.

Replacement icons designed by madpatrick (overwrite the existing ones in the drawables folder of wastecollection):
drawables.zip
(48.09 KiB) Downloaded 1221 times
Additional icons designed by Vibestar (who also designed the main app icons) for
- Metal
- Wedding
- Wedding (gender neutral ;) )
- Library (return books)
- Birthday
Icons.zip
(29.05 KiB) Downloaded 1117 times
Kind regardz,

Toonz
Last edited by Toonz on Sat Apr 14, 2018 2:56 pm, edited 8 times in total.
member of the Toon Software Collective
Ierlandfan
Member
Member
Posts: 151
Joined: Thu Oct 03, 2013 7:53 pm

Re: Software: modifications and extensions Toon

Post by Ierlandfan »

My trash calendar is a little more structured so I want to use the weeknumbers and days to show the bin. I did it in Lua but qml is "a different cookie"
I was thinking something along this line:

Code: Select all

/* In accordance with ISO 8601, weeks start on Monday and the first Thursday of a year is always in week 1 of that year. Most years have 52 weeks, but some have 53. */

QDate date;
QDate::weekNumber(* weekNumber = 0) <<< Semantically wrong and compiled?(No experience with QT)
var specialdays; // like holidays and things like that
= {
//Insert special days
}

if (lookupdate != specialdays) 
if (*weekNumber == afvalSoort )  

switch (date.dayOfWeek()) { //You get the idea
 case 1:
  //Monday
  break;
 case 2:
  //Tuesday, it's subconcious in our head
//Show Icon
case 3:
 //Wednesday, it's concious in our head, put it on the street in the evening 
 //Show Icon
case 4:
//Thursday morning, just in case I forgot and I am watching the thermostat
  ///Show Icon

case 5:
//Just in case like some holiday on thursday 
  //Show Icon
case 6:
  //Saturday, don't bother me, too late
  break;
case 7:
//Sunday, don't bother me,
  break;
Toonz
Forum Moderator
Forum Moderator
Posts: 1896
Joined: Mon Dec 19, 2016 1:58 pm

Re: Software: modifications and extensions Toon

Post by Toonz »

I made a small change in the function updateWasteIcon to show the icon from ~17:00 onwards (ThermostatApp.qml):

Code: Select all

		var now = new Date( (new Date)*1 + 1000*3600*7); //current date/time plus 7 hours to show icon from 17:00 the day before onwards
@Ierlandfan: I like the idea to make a formula for the correct 'waste days' but we still need to edit special dates (holidays) in the code to make it 100% correct.
I am leaning towards the idea of putting the calendar in a separate text file which you can easily update without the need for restarting qt-gui (could be a local file on Toon or a file on your webserver)

EDIT 19/4: first bug found: waste icon isn't removed properly the next day, fix being tested.....
member of the Toon Software Collective
Toonz
Forum Moderator
Forum Moderator
Posts: 1896
Joined: Mon Dec 19, 2016 1:58 pm

Re: Software: modifications and extensions Toon

Post by Toonz »

Here the next beta for the waste icon display functionality.
Installation preferably manual to keep your own version of the thermostat app (see some posts above)

Changelog:
- fix for removing the icon after 24 hours
(The function updateWasteIcon in ThermostatApp.qml was lacking proper initialisation of the variables which caused the icon to stay on screen if the next day was not a waste day.)
- waste icon is now shown from around 18:00 the day before (see post above) and is removed same time next day


To do (not in the coming 2 weeks):
- read the waste calendar from an external file instead of hardcoding in wasteCalendar.js
Attachments
thermostat_show_waste_mod_V0.2.zip
(122.74 KiB) Downloaded 1152 times
member of the Toon Software Collective
Ierlandfan
Member
Member
Posts: 151
Joined: Thu Oct 03, 2013 7:53 pm

Re: Software: modifications and extensions Toon

Post by Ierlandfan »

In our case they shift the pickup day for the the bin so I was thinking along this line:

function getIconName(lookupDate) {
if (lookupdate == specialweek)
// return the text "special week", show correct bin with arrow and the day+date in text (So you know there something different)
else
return afvalSoortURL[afvalSoort[lookupDate]];

But first make your script work, for some reason it doesn't show a bin. Do I have to wait untill some time of day to show up or is a killal -9 qt-gui enough to make it instant show?
Toonz
Forum Moderator
Forum Moderator
Posts: 1896
Joined: Mon Dec 19, 2016 1:58 pm

Re: Software: modifications and extensions Toon

Post by Toonz »

Ierlandfan wrote:In our case they shift the pickup day for the the bin so I was thinking along this line:

function getIconName(lookupDate) {
if (lookupdate == specialweek)
// return the text "special week", show correct bin with arrow and the day+date in text (So you know there something different)
else
return afvalSoortURL[afvalSoort[lookupDate]];

But first make your script work, for some reason it doesn't show a bin. Do I have to wait untill some time of day to show up or is a killal -9 qt-gui enough to make it instant show?
killall qt-gui should be sufficient as the timer is also fired at start, so the icon should be there instantly. Updated every hour thereafter.
Just double checking - did you:
- copy the new waste icons into the drawables folder?
- copy all the code blocks between "//waste display start" and "//waste display end" in both ThermostatApp.qml and ThermostatSidepanel.qml?
- added '21 april 2017 in this case' to the wasteCalender.js file? (case sensitive, no leading zeroes in day numbers)
var afvalSoort = {
"21 april 2017" : 3,
.....



Regarding your suggestion above, how do we know which week is a special week? Still needs to be hardcoded somehow I think
member of the Toon Software Collective
Ierlandfan
Member
Member
Posts: 151
Joined: Thu Oct 03, 2013 7:53 pm

Re: Software: modifications and extensions Toon

Post by Ierlandfan »

Well, we could check a public calender for (Dutch) special days

It's working now. The case-sensitive part did the trick, I wrote all months with leading Capital :-)
Ierlandfan
Member
Member
Posts: 151
Joined: Thu Oct 03, 2013 7:53 pm

Re: Software: modifications and extensions Toon

Post by Ierlandfan »

At domoticz.com we created a trash plugin for dashticz and Rob implemented live dates.
The json calls to several trash services are known by now, even for HVC so that takes care of the manual adding of the dates. (Including special days)
The plugin is javascript so maybe we can use the idea of the script to implement it in QT.
Toonz
Forum Moderator
Forum Moderator
Posts: 1896
Joined: Mon Dec 19, 2016 1:58 pm

Re: Software: modifications and extensions Toon

Post by Toonz »

Ierlandfan wrote:At domoticz.com we created a trash plugin for dashticz and Rob implemented live dates.
The json calls to several trash services are known by now, even for HVC so that takes care of the manual adding of the dates. (Including special days)
The plugin is javascript so maybe we can use the idea of the script to implement it in QT.
Hi,

thanks for the tip, although I haven't found the source code of the Trashcan app there, I got the idea.
Challenge is that you have to create a dedicated routine to parse the (different) responses from all different trash collector companies.

I found the right URL for mine (mijnafvalwijzer.nl), by the way, this gives the whole, full year calendar ;-).
I am happy to implement others as well if you let me know which trash collector company/website I need to access (if you PM me a valid zipcode/housenr/street for testing that would be helpful). Not sure how many people are actually using this, probably don't need to implement all.

Also need to build a data entry screen on Toon to select your waste collector and enter your zipcode / house nr etc

I also plan to list the first next collection date in text under the icon....

Looking forward to hear your views, tips, ideas for implementing this.....

Regardz,

Toonz
member of the Toon Software Collective
Toonz
Forum Moderator
Forum Moderator
Posts: 1896
Joined: Mon Dec 19, 2016 1:58 pm

Re: Software: modifications and extensions Toon

Post by Toonz »

TerrorSource wrote: Some traffic websites offer a free xml service.
Here's an example for fileindex.nl: https://pastebin.com/vzCvLnR2
Is on my to-do list.
Currently working on a new waste collection app which retrieves waste collection dates from mijnafvalkalender.nl.
Got the engine working now but need to add a config screen to enter your zipcode/house nr.
I will also make a selection box to select other waste collection companies/websites but each new one will need it's own function to parse the output from that http call.
It will be a separate app with its own tile showing the next three waste collection events and in dim state a big icon with the waste type for that day (if any).

I will rewrite the thermostat_mod to use the collected dates from the new app instead of the built-in dates as in the current thermostat_mod posted earlier.
In this way you can choose to use a tile or do the thermostat mod.

Regardsz,

Toonz
member of the Toon Software Collective
Toonz
Forum Moderator
Forum Moderator
Posts: 1896
Joined: Mon Dec 19, 2016 1:58 pm

Waste collection App

Post by Toonz »

Hi all,

I hereby show you my latest addition to Toon: the waste collection app.
It is able to retrieve online the waste collection dates for all communities which are supported via mijnafvalwijzer.nl
The code is setup in such a way that other waste data providers can be easily added (happy to do this for you if you send me the URL plus a working zipcode/housenr for testing).
The app contains a tile showing the first three waste collection dates, in dim state a big icon is shown for the specific type of waste that day. On days without waste collection the tile is empty in dim state.
The icon in dim state is shown from 18:00 onwards the day before, for folks who put their waste on the street the evening before.
Dates retrieved from the internet are stored in /var/volatile/tmp/wasteDates.txt
Each day at 18:00 the app is checking for new dates and whether an icon has to be shown, the path to the icon is stored in /var/volatile/tmp/wasteDateIcon.txt
Tile in dim state and normal:
TileDim.png
TileDim.png (1.11 KiB) Viewed 100452 times
Tile.png
Tile.png (10.4 KiB) Viewed 100452 times
wastecollection_V1.0.zip
(12.49 KiB) Downloaded 1122 times
Because I hate empty spaces on Toon in dim state :D I also tweaked the thermostat mod posted earlier. This mod will display a big waste icon underneath the temperature in dim state. You probably guess that the url for the image is taken from /var/volatile/tmp/wasteDateIcon.txt. This icon is update daily at 18.01 to allow the tile to refresh the data first. If you prefer this mod than of course you also need to install the wastecollection app but you don't need to put the waste collection tile on any of your homepages. For backwards compatibility I also kept the javascript waste date option but that value will be overwritten by the wasteDateIcon file if exists.

I made changes to two thermostat app files: ThermostatApp.qml and ThermostatSidePanel.qml
I added wasteCalendar.js with the actual data for waste collection at my place and the icons in the drawables folder.
All changes made to the two system files are clearly marked with '//waste display start' and '//waste display end' lines.
To make the screen more balanced I am showing the temperature a bit higher to make room for the waste icon. If there is no Icon to show the original position is used.

The attached Thermostat app is from 3.7.9. I am not sure if the app has changed over time. I suggest you to apply the changes between the two markers in your own version on your Toon.
You also need to edit wasteCalendar.js to enter the waste collection dates for your place or install the wastecollection app.
The icon is updated daily at 18.01.
Thermostat_dimstate.png
Thermostat_dimstate.png (7.49 KiB) Viewed 100452 times
wastecollection_thermostat_show_waste_mod_V1.0.zip
(123.04 KiB) Downloaded 1095 times
Summarizing:
If your hometown is supported by mijnafvalwijzer.nl: {
--> install wastecollection app. Edit in the WastecollectionApp.qml your own zipcode and housenr.
--> if you want the thermostat mod as well in combination with the wastecollection app:
----> add the code between the markers in ThermostatApp.qml and ThermostatSidePanel.qml to your Toon
----> add the wasteCalender.js to the Thermostat folder just for backwards compatibility. It must be there otherwise Thermostat app can't boot up. No need to enter dates there.
----> icons are displayed from wastecollection/drawables
}
if your hometown is not supported by mijnafvalwijzer.nl (or any other provider which can be implemented): {
--> waste collection app cannot be used.
--> the only option is the Thermostat mod, plus populate wasteCalender.js with the dates for your hometown and restart the gui.
--> icons are displayed from thermostat/drawables (copy them over!!) and refreshed at 18.01
}

My next post will be shorter for sure :oops:

Regardz,

Toonz
member of the Toon Software Collective
TerrorSource
Administrator
Administrator
Posts: 494
Joined: Thu May 04, 2017 9:28 pm

Re: Software: modifications and extensions Toon

Post by TerrorSource »

Woow nice app! Going to use it for sure! :D

Maybe its better to make new topics for each new app so the replies/issues will be sorted in the topic instead of all in 1 topic.
Toonz
Forum Moderator
Forum Moderator
Posts: 1896
Joined: Mon Dec 19, 2016 1:58 pm

Re: Toon app: waste collection (Afvalwijzer)

Post by Toonz »

Hi all,

On request of Marijn I have added support for "deafvalapp.nl".
Currently supported:
"mijnafvalwijzer.nl"
"deafvalapp.nl"

You need to edit WastecollectionApp.qml at the top to select one of these two waste providers and edit your zipcode/house nr.
Fully compatible with the thermostat_mod version 1.0 posted earlier.

While testing I found out it is possible to have two waste types collected on the same day.
But currently just the first waste type icon is shown for that day.

In the next version I will add support for two waste types on the same day.
If you want me to add more waste providers just let me know (it helps if you send me the URL to retrieve the dates).

Regardz,

Toonz
Attachments
wastecollection_V1.1.zip
(13.15 KiB) Downloaded 1075 times
member of the Toon Software Collective
Marijn
Starting Member
Starting Member
Posts: 40
Joined: Wed Jul 03, 2013 8:13 pm

Re: Toon app: waste collection (Afvalwijzer)

Post by Marijn »

Thanks for adding deafvalap.nl and i'm happy that I raised the 2 types of waste collecting issue. [emoji12]
Toonz
Forum Moderator
Forum Moderator
Posts: 1896
Joined: Mon Dec 19, 2016 1:58 pm

Re: Toon app: waste collection (Afvalwijzer)

Post by Toonz »

Hi all,

I enhanced the waste collection app to show two icons in dim state if two types of waste are collected the same day.
The same change was applied to the thermostat_mod to show the waste in dim state.

Screenshots with both options enabled with one and two types of waste:
SingleWaste.png
SingleWaste.png (11.54 KiB) Viewed 100088 times
DoubleWaste.png
DoubleWaste.png (10.78 KiB) Viewed 100088 times
The main app with tile:
wastecollection_V1.2.zip
(13.23 KiB) Downloaded 1139 times
The Thermostat mod (thermostat app firmware 3.7.9, apply changes manually as described in earlier posts)
wastecollection_thermostat_show_waste_mod_V1.2.zip
(117.03 KiB) Downloaded 1148 times
Regardsz,

Toonz
member of the Toon Software Collective
Post Reply

Return to “Toon Apps”