Page 7 of 18

Re: Sharing : Afval kalendar in text sensor

Posted: Saturday 12 January 2019 16:35
by EddyG
Tnx, at the end you left a "needupdate = true" to many.

Re: Sharing : Afval kalendar in text sensor

Posted: Saturday 12 January 2019 20:37
by Derik
Sorry removed ..

see something on github... :shock:
GREAT work Jos

Edit:

Only here is dombo71 again....
I mis in the github codee the local part etc.[ like the script i use before ]
Do i need to replace your new config precisely or do i need to edit so it is like on the old part?

Code: Select all

local myAfvalDevice='D.M.:fval'
local Postcode='6AW'
local Huisnummer='9'
local Notificat
The new:

Code: Select all

myAfvalDevice='Container'                                -- The Text devicename in Domoticz
ShowNextEvents = 3                                       -- indicate the next x events to show in the TEXT Sensor in Domoticz
Postcode='your-zip-here'                                 -- Your postalcode
Huisnummer='your-housenr-here'                           -- Your housnr
NotificationEmailAdress = "your-email-address(es)-here"  -- Specify your Email Address for the notifications

-- uncoment any of the b
So just only replace the the whole old config part for the new one?

Re: Sharing : Afval kalendar in text sensor

Posted: Saturday 12 January 2019 20:54
by jvdz
EddyG wrote: Saturday 12 January 2019 16:35 Tnx, at the end you left a "needupdate = true" to many.
Sorry about that, will fix it later this evening.

Jos

Re: Sharing : Afval kalendar in text sensor

Posted: Saturday 12 January 2019 20:56
by jvdz
Derik wrote: Saturday 12 January 2019 20:37 So just only replace the the whole old config part for the new one?
It will work with and without local, but only when changed in the main script. When you use the separate config file it has to be without local or else it won't work.

Jos

Re: Sharing : Afval kalendar in text sensor

Posted: Saturday 12 January 2019 21:50
by jvdz
jvdz wrote: Saturday 12 January 2019 20:54
EddyG wrote: Saturday 12 January 2019 16:35 Tnx, at the end you left a "needupdate = true" to many.
Sorry about that, will fix it later this evening.
Fixed in Github.
This will fix the update running each minute!
I have used that while testing/debugging and forgot to remove it before commiting to Github ... but fixed now.

Jos

Re: Sharing : Afval kalendar in text sensor

Posted: Sunday 13 January 2019 13:51
by jvdz
Just committed some updates to script_time_afvalwijzer.lua:
  • Added the option to use the different Notification systems configured in Domoticz:

    Code: Select all

    NotificationEmailAdress = ""        -- Specify your Email Address for the notifications. Leave empty to skip email notification
    Notificationsystem = ""             -- Specify notification system eg "telegram/pushover/.." leave empty to skip
    
  • added a commented line to use the JSON.lua distributed with Domoticz for those that haven't installed the generic version. Just comment the first line and uncomment the second line in case you get errors for the first.

    Code: Select all

    -- load JSON lib
    JSON = require "JSON"     -- use generic JSON.lua
    --~ JSON = (loadfile "/home/pi/domoticz/scripts/lua/JSON.lua")()  -- Use default Domoticz JSON.lua
    
  • Added versionnumber and start logmessage when update starts.
  • Renamed alvalwijzerconfig.lua to alvalwijzerconfig.lua.example to avoid messing up any local version.
Let me know in case of issue. :)
Jos

Re: Sharing : Afval kalendar in text sensor

Posted: Sunday 13 January 2019 14:16
by JuanUil
Hi Folks,

Just to let you know:
I have been struggeling with the program from Jos for a couple of days and I could not got it working.
I PM-ed Jos and in 1 hour he fixed the problem for me!!!
Now I can collect the data for Blink in the Helmond area.

Many thanks to Jos!!

Re: Sharing : Afval kalendar in text sensor

Posted: Sunday 13 January 2019 14:25
by jvdz
JuanUil wrote: Sunday 13 January 2019 14:16 Many thanks to Jos!!
You're welcome. ;)
JuanUil wrote: Sunday 13 January 2019 14:16 Now I can collect the data for Blink in the Helmond area.
The script is also added to my github: https://github.com/jvanderzande/mijnafvalwijzer

Jos

Re: Sharing : Afval kalendar in text sensor

Posted: Sunday 13 January 2019 14:48
by JuanUil
Just one more question:
The program keeps checking every minute if there is an update.
I sroke out the dummy 1 and changed the dummy 2 time but it keeps checking every minute.

Re: Sharing : Afval kalendar in text sensor

Posted: Sunday 13 January 2019 15:43
by jvdz
Oops ... did it again. :shock:
Just remove line 218:

Code: Select all

      needupdate = true
I add that line while testing/debugging to force the update each run.
Updated it also in Github.

Jos

Re: Sharing : Afval kalendar in text sensor

Posted: Sunday 13 January 2019 15:48
by JuanUil
Thnx Jos,

that did the trick!! ;)

Re: Sharing : Afval kalendar in text sensor

Posted: Monday 14 January 2019 8:45
by freijn
Hi Jos,

Found an issue in the logfile :

Code: Select all

2019-01-14 02:11:00.729 Error: EventSystem: in AfvalAlarm: [string "-- AF-PUR module to get the Afval schedule fo..."]:145: bad argument #1 to 'gmatch' (string expected, got nil)
Line 145:

Code: Select all

for web_afvaldate, web_afvaltype in string.gmatch(tmp, '<td>(.-)</td>[\r\n%s]-<td>(.-)</td>[\r\n%s]-<td>.-</td>') do
My afvaltypes:
local afvaltype_cfg = {

Code: Select all

   ["Rest"]       ={hour=19,min=22,daysbefore=1,text="Grijze Container met Restafval"},
   ["GFT"]        ={hour=19,min=22,daysbefore=1,text="Bruine Container met Tuinfval"},
   ["Papier"]     ={hour=12,min=00,daysbefore=0,text="Blauwe Container met Oud papier"},
   ["Dummy"]      ={hour=02,min=11,daysbefore=1,text="dummy"}}
Any clue why tmp is empty?

Re: Sharing : Afval kalendar in text sensor

Posted: Monday 14 January 2019 9:16
by jvdz
freijn wrote: Monday 14 January 2019 8:45 Hi Jos,

Found an issue in the logfile :

Code: Select all

2019-01-14 02:11:00.729 Error: EventSystem: in AfvalAlarm: [string "-- AF-PUR module to get the Afval schedule fo..."]:145: bad argument #1 to 'gmatch' (string expected, got nil)
-snip-
Any clue why tmp is empty?
Het lijkt erop dat de gemeente Purmerend een andere Website is gaan gebruiken: https://afvalkalender.purmerend.nl/
Klopt dat?

Jos

Re: Sharing : Afval kalendar in text sensor

Posted: Monday 14 January 2019 10:07
by freijn
Shit. indeed ... #$%#$^%@% just had the scritping fun for 1 week only :-(

they announced an app last week, so i assume they have moved everything...

Re: Sharing : Afval kalendar in text sensor

Posted: Monday 14 January 2019 12:28
by jvdz
Luckily the new website format is the same as the one for West Friesland, so that makes it easy.
I have adapted that script and made a new Purmerend version available in GitHub.
It now also contains the option for the other notification options available in domoticz.

Let me know if there are issue/questions. :)

Jos

Re: Sharing : Afval kalendar in text sensor

Posted: Monday 14 January 2019 13:15
by freijn
oohhh wauw !! incredible speed service! I will download and implement.. and let you know.. Thanks !

Re: Sharing : Afval kalendar in text sensor

Posted: Monday 14 January 2019 16:14
by jvdz
It looks like a lot of gemeentes use the services from http://www.opzet.nl/afvalkalender_digitaal for their garbage collection calendar.
All these sites also have a REST/JSON interface available for the use by the APPs they provide, so I had a look at supporting that process instead of the website scraping I do for some of these currently with:
  • huisvuil-purmerend
  • huisvuil-mijnblink
  • huisvuil-zuidwest-friesland
I am looking at supporting that approach as that will more reliable, flexible and supporting potentially supporting some 2.5 million households. See the above linked page for a list of supported site, or look at your own calendar website and see whether they refer to "Ontwerp & techniek: Opzet"
Anyone interested in this and willing to assist testing?
I would like to get testers for some different gemeentes to test the portability of one script across these "separate" websites.

Jos

Re: Sharing : Afval kalendar in text sensor

Posted: Monday 14 January 2019 21:57
by freijn
BTW Jos, its working in Purmerend and a few hrs ago I also got my Telegram reminder, Thanks !!

Re: Sharing : Afval kalendar in text sensor

Posted: Monday 14 January 2019 22:26
by rron
jvdz wrote: Monday 14 January 2019 16:14 It looks like a lot of gemeentes use the services from http://www.opzet.nl/afvalkalender_digitaal for their garbage collection calendar.
All these sites also have a REST/JSON interface available for the use by the APPs they provide, so I had a look at supporting that process instead of the website scraping I do for some of these currently with:
  • huisvuil-purmerend
  • huisvuil-mijnblink
  • huisvuil-zuidwest-friesland
I am looking at supporting that approach as that will more reliable, flexible and supporting potentially supporting some 2.5 million households. See the above linked page for a list of supported site, or look at your own calendar website and see whether they refer to "Ontwerp & techniek: Opzet"
Anyone interested in this and willing to assist testing?
I would like to get testers for some different gemeentes to test the portability of one script across these "separate" websites.

Jos
Thanks for the quick help.
Ronald

Re: Sharing : Afval kalendar in text sensor

Posted: Wednesday 16 January 2019 15:59
by RR46
Finaly, after several PM's, trail and error, I got today the Pushover notifcation of the next garbage run :mrgreen:

@JVDZ; many thanks for support and help!!