Sharing : Afval kalendar in text sensor

Moderator: leecollings

Post Reply
steef84
Posts: 37
Joined: Friday 30 August 2013 20:24
Target OS: NAS (Synology & others)
Domoticz version: DS213+
Contact:

Re: Sharing : Afval kalendar in text sensor

Post by steef84 »

jvdz wrote:Correct, they have changed the website so I fixed it a couple of weeks ago, but hadn't uploaded the change yet. (it is committed now to github)
Just give that version a try and let me know. :)

Jos
Working thank you!
- Stefan
Derik
Posts: 1601
Joined: Friday 18 October 2013 23:33
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Arnhem/Nijmegen Nederland
Contact:

Re: Sharing : Afval kalendar in text sensor

Post by Derik »

jvdz wrote: Sunday 06 January 2019 23:06 This is an description in Dutch how to make the script working for any of the variations I have published in github:
  • Maak een dummy TEKST sensor aan in domoticz (ik heb Heerlen-Afval gebruikt voor het testen)
  • Kopieer juiste versie script voor jouw regio van https://github.com/jvanderzande/mijnafvalwijzer naar directory domoticz\scripts\lua
  • Edit script en:
    • Pas de variable myAfvalDevice aan met de Device naam die jij hebt aangemaakt in Domoticz.
    • Pas de variable NotificationEmailAdress aan naar jouw email adres.
    • Pas de afvaltype_cfg tabel aan met de tijden en daysbefore die jij wilt per afval type en de tekst die je in de notificatie wilt ontvangen.
Nu zou het moeten werken, maar de tekst sensor wordt pas geupdate als een van de tijden uit de tabel gelijk is aan de huidige tijd, want dan alleen gaat hij de website info ophalen. Je kan dus even tijdelijk de dummy regel aanpassen naar huidige tijd plus 1 minute om de update te forceren.

Sorry for the Dutch and let me know in case anybody needs a translation, but these script are only valid for several Dutch areas.

Jos
Jos

Thanks for your great work..
Dit set my dummy and other perimeters.. i wait what happend, cannot find the time settings :-]
One question:
What is this dummy for:

Code: Select all

[""},
   ["Dummy"]                              ={hour=02,min=10,daysbefore=0,text="dummy to trigger update of text sensor at night"}}
And is it possible to get only 1 day visible in the dummy.
This works better for me into dashticz...

And i mis my Grofvuil and oud ijzer..
ScreenShot182.jpg
ScreenShot182.jpg (27.79 KiB) Viewed 1466 times
Perhaps :-) ?


Edit:
Jos
Perhaps here something wrong?:

Code: Select all

 local commando = "curl --max-time 5 -s 'https://www.mijnafvalwijzer.nl/nl/"..Postcode.."/"..Huisnummer.."/'"
2 times .nl
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
User avatar
jvdz
Posts: 2189
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: Sharing : Afval kalendar in text sensor

Post by jvdz »

@Derik, you are asking many questions in one post so lets see ... oh and you haven't provided me with any info on which script you use and what your information of you area is as several settings depend on this, like the types of garbage you need to define in the table.
Derik wrote: Monday 07 January 2019 19:53 One question:
What is this dummy for:

Code: Select all

[""},
   ["Dummy"]                              ={hour=02,min=10,daysbefore=0,text="dummy to trigger update of text sensor at night"}}
Did you read the comment behind dummy?
This script ONLY gets an update at the defined time in any record that matches the hour/min. So the Dummy simply causes the Website to be checked at 02:10 in the night.
Derik wrote: Monday 07 January 2019 19:53 And is it possible to get only 1 day visible in the dummy.
This works better for me into dashticz...
The general script_time_afvalwijzer.lua only shows the next event. The others default to 3 but have this field you can configure:

Code: Select all

local ShowNextEvents = 3                   -- indicate the next events to show in the TEXT Sensor in Domoticz
Derik wrote: Monday 07 January 2019 19:53 And i mis my Grofvuil and oud ijzer..
ScreenShot182.jpg
Perhaps :-) ?
Well, simply add them to the afvaltype_cfg table with their specific information. ;)
Derik wrote: Monday 07 January 2019 19:53 Jos
Perhaps here something wrong?:

Code: Select all

 local commando = "curl --max-time 5 -s 'https://www.mijnafvalwijzer.nl/nl/"..Postcode.."/"..Huisnummer.."/'"
2 times .nl
I have no idea what you mean here, please explain?

Jos
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
Derik
Posts: 1601
Joined: Friday 18 October 2013 23:33
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Arnhem/Nijmegen Nederland
Contact:

Re: Sharing : Afval kalendar in text sensor

Post by Derik »

jvdz wrote: Monday 07 January 2019 20:21 @Derik, you are asking many questions in one post so lets see ... oh and you haven't provided me with any info on which script you use and what your information of you area is as several settings depend on this, like the types of garbage you need to define in the table.
Derik wrote: Monday 07 January 2019 19:53 One question:
What is this dummy for:

Code: Select all

[""},
   ["Dummy"]                              ={hour=02,min=10,daysbefore=0,text="dummy to trigger update of text sensor at night"}}
Did you read the comment behind dummy?
This script ONLY gets an update at the defined time in any record that matches the hour/min. So the Dummy simply causes the Website to be checked at 02:10 in the night.
Derik wrote: Monday 07 January 2019 19:53 And is it possible to get only 1 day visible in the dummy.
This works better for me into dashticz...
The general script_time_afvalwijzer.lua only shows the next event. The others default to 3 but have this field you can configure:

Code: Select all

local ShowNextEvents = 3                   -- indicate the next events to show in the TEXT Sensor in Domoticz
Derik wrote: Monday 07 January 2019 19:53 And i mis my Grofvuil and oud ijzer..
ScreenShot182.jpg
Perhaps :-) ?
Well, simply add them to the afvaltype_cfg table with their specific information. ;)
Derik wrote: Monday 07 January 2019 19:53 Jos
Perhaps here something wrong?:

Code: Select all

 local commando = "curl --max-time 5 -s 'https://www.mijnafvalwijzer.nl/nl/"..Postcode.."/"..Huisnummer.."/'"
2 times .nl
I have no idea what you mean here, please explain?

Jos
Jos Thanks

i mean:
https://www.mijnafvalwijzer.nl/nl/
Is this correct two times the nl
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
User avatar
jvdz
Posts: 2189
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: Sharing : Afval kalendar in text sensor

Post by jvdz »

Derik wrote: Monday 07 January 2019 21:11 Jos Thanks

i mean:
https://www.mijnafvalwijzer.nl/nl/
Is this correct two times the nl
Did you try and did you have issues? ;)

Jos
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
rron
Posts: 223
Joined: Sunday 30 March 2014 15:24
Target OS: Linux
Domoticz version: Beta
Location: Waterland
Contact:

Re: Sharing : Afval kalendar in text sensor

Post by rron »

freijn wrote: Monday 07 January 2019 11:20 local MyArea='Weidevenne+en+Hazepolder'

had to put + in between, perhaps a remark in the notes?
Still works ok for me for almost 7 months,( also purmerend)
Thanks to Jos
Rpi, RFXcom, klikaan klikuit switch,thermosmart, z-wave, espeasy, smartevse
RR46
Posts: 7
Joined: Thursday 10 January 2019 12:09
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Netherlands
Contact:

Re: Sharing : Afval kalendar in text sensor

Post by RR46 »

Cool script! Unfortunately, it does not work for me... At my place is RWM instead of RD4... Have tried to adjust it by myself, unfortunately I have not succeeded yet. Someone here adjusted for RWM? :oops:

Did anyone also built this script with ''Pushover" messages?
User avatar
jvdz
Posts: 2189
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: Sharing : Afval kalendar in text sensor

Post by jvdz »

PM me the details of the website and some valid postal code/address (whatever is needed to make the script work) and I will have a look for you.
RR46 wrote: Thursday 10 January 2019 12:27 Did anyone also built this script with ''Pushover" messages?
That should be really easy and simply change this line to reflect the details needed for Pusover:

Code: Select all

      commandArray['SendEmail'] = notificationtitle .. '#' .. notificationtext .. '#' .. NotificationEmailAdress
Jos
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
Rainman
Posts: 10
Joined: Monday 18 April 2016 12:40
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.9700
Contact:

Re: Sharing : Afval kalendar in text sensor

Post by Rainman »

The general script_time_afvalwijzer.lua only shows the next event.
Would it be possible to change the general script so it shows multiple events ? At my location they collect the garbage containers and the PMD & Plastics on the same day. Currently I only receive one in my Text device.
User avatar
jvdz
Posts: 2189
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: Sharing : Afval kalendar in text sensor

Post by jvdz »

Rainman wrote: Thursday 10 January 2019 13:26 Would it be possible to change the general script so it shows multiple events ?
Yes that is possible as with the other scripts, just need to modify it to make that happen. :D
Let you know when I have a script to play with.

Jos
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
User avatar
jvdz
Posts: 2189
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: Sharing : Afval kalendar in text sensor

Post by jvdz »

Rainman wrote: Thursday 10 January 2019 13:26 Would it be possible to change the general script so it shows multiple events ? At my location they collect the garbage containers and the PMD & Plastics on the same day. Currently I only receive one in my Text device.
I have made a new version available on GitHub that has a variable at the top where you define the ShowNextEvents to display in the Text sensor.
Give it a spin and let me know.

https://github.com/jvanderzande/mijnafvalwijzer

Jos
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
Rainman
Posts: 10
Joined: Monday 18 April 2016 12:40
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.9700
Contact:

Re: Sharing : Afval kalendar in text sensor

Post by Rainman »

Thanks, I installed the new script and I'm testing it now.

Edit: Almost what I want;

What I get now is

2019-01-11 11:19:03 zaterdag 12 januari=Papier en karton donderdag 17 januari=Restafval donderdag 24 januari=Groente, Fruit en Tuinafval

But on 'donderdag 17 januari' also the Plastic Metalen and Drankkartons is collected where I live, and I am missing those now.

See
https://mijnafvalwijzer.nl/nl/6671GK/35/
User avatar
jvdz
Posts: 2189
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: Sharing : Afval kalendar in text sensor

Post by jvdz »

@Rainman, I see that the formatting for your region for PMD is different than I had with the other test Postcode/Housenr combo's, so it wasn't seeing PMD dates at all.
I have made a change to the RegEx and it looks like it now works for the different test combo's I have. Let me know in case there are still people having issues.
Updated the Github code.

Cheers,
Jos
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
Rainman
Posts: 10
Joined: Monday 18 April 2016 12:40
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.9700
Contact:

Re: Sharing : Afval kalendar in text sensor

Post by Rainman »

Works for me, thanks a lot.

R
User avatar
jvdz
Posts: 2189
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: Sharing : Afval kalendar in text sensor

Post by jvdz »

In my search for trying to avoid all of the REGEXing to scrape the webcontent, I found an option to download the data as JSON, which should be much more reliable. Code is nearly finished and some more testing to be done.
You will have to change the WasteTypes in the table to a a shortname version eg:

Code: Select all

local afvaltype_cfg = {
   ["Restafval"]              ={hour=19,min=22,daysbefore=1,text="Grijze Container met Restafval"},
   ["GFT-container"]          ={hour=19,min=22,daysbefore=1,text="Groene Container met Tuinfval"},
   ["PMD-zakken"]             ={hour=19,min=22,daysbefore=1,text="Oranje Container met Plastic en Metalen"},
   ["Kerstbomen"]             ={hour=19,min=22,daysbefore=1,text="Kerstbomen"},
   ["Snoeiafval"]             ={hour=19,min=22,daysbefore=1,text="Snoei afval"},
   ["Oud papier"]             ={hour=12,min=00,daysbefore=0,text="Blauwe Container met Oud papier"},
   ["dummy"]                  ={hour=02,min=10,daysbefore=0,text="dummy to trigger update of text sensor at night"}}

To

Code: Select all

   ["restafval"]     ={hour=19,min=22,daysbefore=1,text="Grijze Container met Restafval"},
   ["gft"]           ={hour=19,min=22,daysbefore=1,text="Groene Container met Tuinfval"},
   ["pmd"]           ={hour=19,min=22,daysbefore=1,text="Oranje Container met Plastic en Metalen"},
   ["kerstbomen"]    ={hour=19,min=22,daysbefore=1,text="Kerstbomen"},
   ["takken"]        ={hour=19,min=22,daysbefore=1,text="Snoei afval"},
   ["papier"]        ={hour=12,min=00,daysbefore=0,text="Blauwe Container met Oud papier"},
   ["dummy"]         ={hour=02,min=10,daysbefore=0,text="dummy to trigger update of text sensor at night"}}
Jos
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
User avatar
jvdz
Posts: 2189
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: Sharing : Afval kalendar in text sensor

Post by jvdz »

An updated script_time_afvalwijzer.lua is made available in github: https://github.com/jvanderzande/mijnafvalwijzer
Changes:
  • It now uses the json.mijnafvalwijzer.nl website, which returns the information in a JSON format, making the script less sensitive for layout changes.
  • It is also faster as the amount of data is less and faster processed.
  • It now also has an option to save your config details in a separate file "afvalwijzerconfig.lua" to avoid having to modify the bases script and making script upgrades easier. An example file is available.
  • The script will now also tell you exactly which table entries are missing in the afvaltype_cfg tabel, which you can cut&paste into your config and modify.
  • An reminder field is added to the table in case you like to get a second notification after x hours, the same day.
Let me know in case you have questions or have suggestions for improvement.

Jos
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
EddyG
Posts: 1042
Joined: Monday 02 November 2015 5:54
Target OS: -
Domoticz version:

Re: Sharing : Afval kalendar in text sensor

Post by EddyG »

Real nice and working perfectly.
I have 2 suggestions.
1. Create some short additional text to show in the domoticz text device.
pdm is a little bit short and should start with a Capital e.g. Pmd, but better Plastic, Metaal and Drankkartons.
Please put extra space around the "=" for readability in the line.

Code: Select all

txt = txt..web_afvaldate .. " = " .. web_afvaltype .. "\r\n" 
Last edited by EddyG on Saturday 12 January 2019 15:06, edited 2 times in total.
User avatar
jvdz
Posts: 2189
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: Sharing : Afval kalendar in text sensor

Post by jvdz »

EddyG wrote: Saturday 12 January 2019 14:14 Real nice and working perfectly.
Thanks :)
EddyG wrote: Saturday 12 January 2019 14:14 I have 2 suggestions.
1. Create some short additional text to show in the domoticz text device.
pdm is a little bit short and should start with a Capital e.g. Pmd, but better Papier, Metaal and Pastic.
Just checked and we can retrieve the long description from the returned JSON data and these will then return e.g.:
gft = Groente, Fruit en Tuinafval
papier = Papier en karton
pmd = Plastic, Metalen en Drankkartons
restafval = Restafval
It is an simple change when people want this rather than the short name.
EddyG wrote: Saturday 12 January 2019 14:14 Please put extra space around the "=" for readability in the line.

Code: Select all

txt = txt..web_afvaldate .. " = " .. web_afvaltype .. "\r\n" 
I've already changed the content of the text sensor from:
12-1-2019=pmd
to
12 jan 2019 -> pmd
which with the previous proposal would be:
12 jan 2019 -> Plastic, Metalen en Drankkartons

What say you? :)

Jos
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
EddyG
Posts: 1042
Joined: Monday 02 November 2015 5:54
Target OS: -
Domoticz version:

Re: Sharing : Afval kalendar in text sensor

Post by EddyG »

Sounds perfect, Tnx for the quick response.
User avatar
jvdz
Posts: 2189
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: Sharing : Afval kalendar in text sensor

Post by jvdz »

I decided to add the following option to keep things flexible for everyone:

Code: Select all

-- ###  text sensor format options -----------------------------------------
-- date options:
--    dd  = day in 2 digits   eg 31
--    mm  = month in 2 digits eg 01
--    mmm = month abbreviation in 3 characters eg : jan
--    yy   = year in 2 digits eg 19
--    yyyy = year in 4 digits eg 2019
-- Afvaltype description options
--    sdesc = short afvaltype description from Website  eg pmd
--    ldesc = LOng afvaltype description from Website   eg Plastic, Metalen en Drankkartons
textformat = "dd mmm yy ldesc"
It is available in the current github version.

Jos
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest