Sharing : Afval kalendar in text sensor

Moderator: leecollings

Post Reply
EddyG
Posts: 1042
Joined: Monday 02 November 2015 5:54
Target OS: -
Domoticz version:

Re: Sharing : Afval kalendar in text sensor

Post by EddyG »

Tnx, at the end you left a "needupdate = true" to many.
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 »

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?
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 »

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
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 »

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
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 »

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
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 »

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
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
JuanUil
Posts: 497
Joined: Friday 22 May 2015 12:21
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.11083
Location: Asten NB Nederland
Contact:

Re: Sharing : Afval kalendar in text sensor

Post 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!!
Your mind is like a parachute,
It only works when it is opened!

RPI4 several Fibaro, KaKu, Neocoolcam switches, Z-Wave, Zigbee2Mqtt, Ikea bulbs and remote, Zigbee temp nodes
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 »

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
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
JuanUil
Posts: 497
Joined: Friday 22 May 2015 12:21
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.11083
Location: Asten NB Nederland
Contact:

Re: Sharing : Afval kalendar in text sensor

Post 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.
Your mind is like a parachute,
It only works when it is opened!

RPI4 several Fibaro, KaKu, Neocoolcam switches, Z-Wave, Zigbee2Mqtt, Ikea bulbs and remote, Zigbee temp nodes
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 »

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
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
JuanUil
Posts: 497
Joined: Friday 22 May 2015 12:21
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.11083
Location: Asten NB Nederland
Contact:

Re: Sharing : Afval kalendar in text sensor

Post by JuanUil »

Thnx Jos,

that did the trick!! ;)
Your mind is like a parachute,
It only works when it is opened!

RPI4 several Fibaro, KaKu, Neocoolcam switches, Z-Wave, Zigbee2Mqtt, Ikea bulbs and remote, Zigbee temp nodes
freijn
Posts: 536
Joined: Friday 23 December 2016 16:40
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: Netherlands Purmerend
Contact:

Re: Sharing : Afval kalendar in text sensor

Post 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?
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 »

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
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
freijn
Posts: 536
Joined: Friday 23 December 2016 16:40
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: Netherlands Purmerend
Contact:

Re: Sharing : Afval kalendar in text sensor

Post 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...
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 »

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
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
freijn
Posts: 536
Joined: Friday 23 December 2016 16:40
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: Netherlands Purmerend
Contact:

Re: Sharing : Afval kalendar in text sensor

Post by freijn »

oohhh wauw !! incredible speed service! I will download and implement.. and let you know.. Thanks !
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 »

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
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
freijn
Posts: 536
Joined: Friday 23 December 2016 16:40
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: Netherlands Purmerend
Contact:

Re: Sharing : Afval kalendar in text sensor

Post by freijn »

BTW Jos, its working in Purmerend and a few hrs ago I also got my Telegram reminder, Thanks !!
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 »

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
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 »

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!!
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest