Sharing : Afval kalendar in text sensor

Moderator: leecollings

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 »

Strange. could you zip both your time script and your version of the JSON.lua into one zipfile and email it to me so I can have a look if there is anything strange in them?
Spoiler: show
jvdzande----at--yahoo--dot--com
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 »

Uploaded a update for script_time_afvalwijzer.lua to GitHub with the following changes:

Code: Select all

- Changed the logic to always run the update process when debug=true, so don't forget to change it back to 
   "debug = false" for normal operations to avoid updating each minute and generating a lot of log records!

- Added some logic to strip a part of the JSON response before decoding it into a JSON table, 
   because the data sometimes contains base64 encoded images for some gemeentes, 
   which caused an error in the JSON lexing.
The second change was a fix needed for the reported error by @silver323 .

Jos
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
silver323
Posts: 28
Joined: Friday 01 December 2017 18:15
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Sharing : Afval kalendar in text sensor

Post by silver323 »

jvdz wrote: Thursday 07 February 2019 11:35 Uploaded a update for script_time_afvalwijzer.lua to GitHub with the following changes:

Code: Select all

- Changed the logic to always run the update process when debug=true, so don't forget to change it back to 
   "debug = false" for normal operations to avoid updating each minute and generating a lot of log records!

- Added some logic to strip a part of the JSON response before decoding it into a JSON table, 
   because the data sometimes contains base64 encoded images for some gemeentes, 
   which caused an error in the JSON lexing.
The second change was a fix needed for the reported error by @silver323 .

Jos
Jos,

Thanks for your help. I'm glad it works now.
hoeby
Posts: 528
Joined: Saturday 02 June 2018 11:05
Target OS: Raspberry Pi / ODroid
Domoticz version: V2022.1
Location: Echt, Netherlands
Contact:

Re: Sharing : Afval kalendar in text sensor

Post by hoeby »

Nice script you guys made here.

Unfortunally for me, but my city isn't using "mijn afvalwijzer", but "de afval app"
It gives way different information than "mijn afvalwijzer". Would it be possible to add "de afval app" to this nice script?

This is the code to use "de afval app"
zip=6101ea
housnr =21

Code: Select all

http://dataservice.deafvalapp.nl/dataservice/DataServiceServlet?service=OPHAALSCHEMA&land=NL&postcode=6101EA&straatId=0&huisnr=21
The result when running

Code: Select all

GFT;12-01-2018;26-01-2018;09-02-2018;23-02-2018;09-03-2018;23-03-2018;06-04-2018;20-04-2018;04-05-2018;18-05-2018;01-06-2018;15-06-2018;29-06-2018;13-07-2018;27-07-2018;10-08-2018;24-08-2018;07-09-2018;21-09-2018;05-10-2018;19-10-2018;02-11-2018;16-11-2018;30-11-2018;14-12-2018;28-12-2018;11-01-2019;25-01-2019;08-02-2019;22-02-2019;08-03-2019;22-03-2019;05-04-2019;19-04-2019;03-05-2019;17-05-2019;31-05-2019;14-06-2019;28-06-2019;06-07-2019;12-07-2019;09-08-2019;23-08-2019;07-09-2019;20-09-2019;04-10-2019;18-10-2019;01-11-2019;15-11-2019;29-11-2019;13-12-2019;27-12-2019;
KERSTBOOM;12-01-2018;11-01-2019;
PLASTIC;22-01-2018;19-02-2018;19-03-2018;16-04-2018;14-05-2018;11-06-2018;09-07-2018;06-08-2018;03-09-2018;01-10-2018;29-10-2018;26-11-2018;24-12-2018;21-01-2019;18-02-2019;18-03-2019;15-04-2019;13-05-2019;08-06-2019;08-07-2019;05-08-2019;02-09-2019;30-09-2019;28-10-2019;25-11-2019;23-12-2019;
REST;05-01-2018;19-01-2018;02-02-2018;16-02-2018;02-03-2018;16-03-2018;30-03-2018;13-04-2018;28-04-2018;11-05-2018;25-05-2018;08-06-2018;22-06-2018;06-07-2018;20-07-2018;03-08-2018;17-08-2018;31-08-2018;14-09-2018;28-09-2018;12-10-2018;26-10-2018;09-11-2018;23-11-2018;07-12-2018;21-12-2018;04-01-2019;18-01-2019;01-02-2019;15-02-2019;01-03-2019;15-03-2019;29-03-2019;12-04-2019;26-04-2019;10-05-2019;24-05-2019;07-06-2019;21-06-2019;05-07-2019;19-07-2019;02-08-2019;16-08-2019;30-08-2019;13-09-2019;27-09-2019;11-10-2019;25-10-2019;08-11-2019;22-11-2019;06-12-2019;20-12-2019;
SNOEIAFVAL;12-03-2018;26-03-2018;09-04-2018;01-10-2018;15-10-2018;29-10-2018;11-03-2019;25-03-2019;08-04-2019;30-09-2019;14-10-2019;28-10-2019;
Thin-client --> Docker Domoticz main environment
Pi3A+ --> Google home (GAssistPi)
Pi3B+ --> Docker (P1monitor, Domoticz test environment, Ubiquity controller)
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 »

Returned data for that site looks pretty straightforward.
Will have a look to create a separate script for this and publish it.
PM me your email address please so we do some testing before it gets published.

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 »

The script script_time_huisvuil-echt.lua is added to my GitHub for the gemeentes Echt-Susteren.

Jos
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
hoeby
Posts: 528
Joined: Saturday 02 June 2018 11:05
Target OS: Raspberry Pi / ODroid
Domoticz version: V2022.1
Location: Echt, Netherlands
Contact:

Re: Sharing : Afval kalendar in text sensor

Post by hoeby »

jvdz wrote: Sunday 10 February 2019 10:25 The script script_time_huisvuil-echt.lua is added to my GitHub for the gemeentes Echt-Susteren.

Jos
i testes it and works beautifull. thanks Jos.

it is made for "de afval app"
when searching on the website of de afval app, more gemeentes could be working. could be possible minor changed need to be made.

these gemeentes i found on there website:
Bergeijk
Bladel
Boekel
Boxmeer
Buren
Cuijk
Culemborg
Echt-Susteren
Eersel
Geldermalsen
Grave
Helmond
Lingewaal
Maasdriel
Mill en Sint Hubert
Neder-BetuweNeerijnen
Oirschot
Reusel-De Mierden
Sint Anthonis
Someren
Son en Breugel
Terneuzen
Tiel
West Maas en Waal
Zaltbommel
Thin-client --> Docker Domoticz main environment
Pi3A+ --> Google home (GAssistPi)
Pi3B+ --> Docker (P1monitor, Domoticz test environment, Ubiquity controller)
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 »

Good to know... so I made these changes to the GitHub version:

Code: Select all

- Renamed huisvuil-echt to huisvuil-deafvalapp because this site supports a long list of gemeentes.
- Also made a change to the script to properly list the missing afvaltypes  in the table.
Jos
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
hoeby
Posts: 528
Joined: Saturday 02 June 2018 11:05
Target OS: Raspberry Pi / ODroid
Domoticz version: V2022.1
Location: Echt, Netherlands
Contact:

Re: Sharing : Afval kalendar in text sensor

Post by hoeby »

there is a letter forgotten in text GFT.

the script says "tuinfval"
should be "tuinAfval"

but the script works, including the forgotten letter :D
Thin-client --> Docker Domoticz main environment
Pi3A+ --> Google home (GAssistPi)
Pi3B+ --> Docker (P1monitor, Domoticz test environment, Ubiquity controller)
dnacid
Posts: 2
Joined: Thursday 08 October 2015 11:10
Target OS: Windows
Domoticz version:
Contact:

Re: Sharing : Afval kalendar in text sensor

Post by dnacid »

Thanks for the great script!
Working without a problem in gemeente "De wolden".

Little tip for "Domoticz-on-windows" users:

Change the line in which trhe script searches for the JSON.lua file to

Code: Select all

 JSON = (loadfile "C:\\Program Files (x86)\\Domoticz\\scripts\\lua\\JSON.lua")()  -- Use default Domoticz JSON.lua 
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 »

hoeby wrote: Tuesday 12 February 2019 19:23 there is a letter forgotten in text GFT.

the script says "tuinfval"
should be "tuinAfval"
Thanks for letting me know.... I see I did a great Cut&Paste job as it was wrong at multiple places. :)
Fixed in GitHub.
hoeby wrote: Tuesday 12 February 2019 19:23 but the script works, including the forgotten letter :D
Good to hear!

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 »

Hey Jos,

My notifications are not working anymore

THis is from the logfile
2019-03-04 21:46:00.617 Error: EventSystem: in AfvalAlarm: [string "---------------------------------------------..."]:113: attempt to index global 'notificationtitle' (a nil value)

this is line 113
notificationtitle = notificationtitle:gsub('@DAG@',dag)

this is my config
myAfvalDevice = 'Afval Kalender' -- The Text devicename in Domoticz
hostname = "afvalkalender.purmerend.nl" -- Specify the hostname of your afvalwebsite. eg: "afvalkalender.purmerend.nl", "afvalkalender.sudwestfryslan.nl", "mijnblink.nl" ..etc
ShowNextEvents = 3 -- indicate the next x events to show in the TEXT Sensor in Domoticz
Postcode = '1448xx' -- Postcode
Housenr = 'xx' -- Huisnummer zonder toevoeging
Housenrtoev='' -- Huisnummer toevoeging
NotificationEmailAdress = '[email protected]' -- Specify your Email Address for the notifications. Leave empty to skip email notification
Notificationsystem = 'telegram' -- Specify notification system eg "telegram/pushover/.." leave empty to skip

The ''xx" are dummies

from the log so website works...

2019-03-04 21:50:00.493 Status: EventSystem: Script event triggered: script_time_humidity
2019-03-04 21:50:00.518 Status: LUA: @AFOpzet::afvaltype_cfg :Dummy2;2;2
2019-03-04 21:50:00.518 Status: LUA: @AFOpzet::afvaltype_cfg :Dummy1;2;2
2019-03-04 21:50:00.518 Status: LUA: @AFOpzet::afvaltype_cfg :Plastic, Metaal en Drankkartons;19;2
2019-03-04 21:50:00.518 Status: LUA: @AFOpzet::afvaltype_cfg :Kerstbomen;19;22
2019-03-04 21:50:00.518 Status: LUA: @AFOpzet::afvaltype_cfg :Restafval;21;46
2019-03-04 21:50:00.518 Status: LUA: @AFOpzet::afvaltype_cfg :GFT;19;2
2019-03-04 21:50:00.518 Status: LUA: @AFOpzet::afvaltype_cfg :Papier en karton;19;2
2019-03-04 21:50:00.518 Status: LUA: @AFOpzet::Scheduled time(s) not reached yet, so nothing to do!

Any Clue ??

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

Did you remove/comment these lines under the Table?:

Code: Select all

notificationtitle = '@AFW: @DAG@ de @AFVALTEXT@ aan de weg zetten!'
notificationtext  = '@DAG@ wordt de @AFVALTEXT@ opgehaald!'
.. else just PM or Email me your script and I will have a look. ;)

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 »

Hi Jos,

Sorry for the slow response.. Busy with work :-(

I am using the script script_time_opzet.lua

and do not see the lines : (from the latest Github)
notificationtitle = '@AFW: @DAG@ de @AFVALTEXT@ aan de weg zetten!'
notificationtext = '@DAG@ wordt de @AFVALTEXT@ opgehaald!'

in the script : script_time_afvalwijzer.lua
I do see them.

Can you please check and confirm its missing in the Github and should be added ?

Cheers,

Frank
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: Thursday 07 March 2019 18:08 and do not see the lines : (from the latest Github)
notificationtitle = '@AFW: @DAG@ de @AFVALTEXT@ aan de weg zetten!'
notificationtext = '@DAG@ wordt de @AFVALTEXT@ opgehaald!'
Shoot, those are indeed missing in the latest commit and only show when sending a notifications.
Sorry about that and thanks for reporting.... the github version should be fixed now. :)

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 »

Thank !! YOU !!! sir for making these scripts and fast support!!!!

Cheers,

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

You're welcome and glad things are working.

Jos
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
Heelderpeel
Posts: 15
Joined: Sunday 26 April 2015 21:56
Target OS: Raspberry Pi / ODroid
Domoticz version: V2020.2
Location: Nederland
Contact:

Re: Sharing : Afval kalendar in text sensor

Post by Heelderpeel »

Hello,

Very nice script, works perfectly, tomorrow I know if I have set the notification on the phone correctly, we will see.

But I would like to add the weekday to the script so that it becomes visible in Domoticz. I have no knowledge about lua, :cry: but had looked a bit in other scripst and earlier versions, but I still can't get it done.
Can anyone help me?

(I use the: script_time_afvalwijzer.lua script)

Greetings,
Maurice
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 »

What weekday ??

All is in already ?
Attachments
Capture.JPG
Capture.JPG (19.89 KiB) Viewed 2037 times
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 »

How would like to see the text change?
Could you post the current content of the TEXT device and how you like to have it changed?
freijn wrote: Wednesday 13 March 2019 12:30 What weekday ??
All is in already ?
That depends on the information available for that particular Gemeente.

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