Page 14 of 18

Re: Sharing : Afval kalendar in text sensor

Posted: Thursday 26 December 2019 11:26
by jvdz
Did you copy&paste your old table into the new script and by doing that remove the reminder field from the record?

Code: Select all

   ["pmd"]           ={hour=19,min=01,daysbefore=1,reminder=0,text="Oranje Container met Plastic en Metalen"},
Just check and add that to the table when missing. The purpose is the get and extra reminder when you want that:
-- reminder ==> Will send a second reminder after x hours. 0=no reminder (needs to be in the same day!)
I did do an update in github to test for the presence of this variable and if not then assume 0 to avoid the error.

Jos

Re: Sharing : Afval kalendar in text sensor

Posted: Thursday 26 December 2019 11:42
by JuanUil
I have put my old table in it in which there was no reminder.

Now I added this :

Code: Select all

local afvaltype_cfg = {
   ["Restafval"]                       	        ={hour=8,min=30,daysbefore=1,text=" de Grijze Container met Restafval"},
   ["GFT Bak"]                         	        ={hour=8,min=32,daysbefore=1,text=" de Groene Container met Tuinafval"},
   ["Plastic, Metaal en Drankkartons"] ={hour=8,min=34,daysbefore=1,text=" de PMD zak"},
   ["PMD Zak"] 					={hour=8,min=34,daysbefore=1,reminder=0,text=" de PMD zak"},
   ["Papier en karton"]                	={hour=8,min=36,daysbefore=1,text=" Het Oud papier"},
   ["Papier"]                			={hour=8,min=36,daysbefore=1,text=" Het Oud papier"},
   ["onbekend1"]                       		={hour=19,min=02,daysbefore=3,text="Snoeiafval op afspraak"},
   ["onbekend2"]                       		={hour=19,min=02,daysbefore=3,text="Snoeiafval op afspraak"},
   ["Dummy1"]                          		={hour=02,min=02,daysbefore=0,text="dummy"},   -- dummy is used to force update while testing
   ["Dummy2"]                          		={hour=02,min=02,daysbefore=0,text="dummy"}}   -- dummy is used to update the textsensor at night for that day

and get this:

Code: Select all

019-12-26 11:39:56.059 (Elektra verbruik) YouLess Meter (KWh meter)
2019-12-26 11:40:00.500 Error: EventSystem: in /home/pi/domoticz/scripts/lua/script_time_huisvuil2.lua: /home/pi/domoticz/scripts/lua/script_time_huisvuil2.lua:31: unexpected symbol near '['
2019-12-26 11:40:04.086 (RFXcom) Temp + Humidity (Werkkamer Temperatuur)
2019-12-26 11:40:06.070 (Elektra verbruik) YouLess Meter (KWh meter)
2019-12-26 11:40:13.810 (Z-WAVE Usb) General/kWh (kWh Meter2)


SORRY MADE A MISTAKE MYSELF!
All working well again,
Thnx for the help again!

Re: Sharing : Afval kalendar in text sensor

Posted: Tuesday 31 December 2019 16:35
by Mdieli
Great script, thank you for creating, sharing and maintaining!

However, I received an error when using the script (version 20191221-2300):
Error: EventSystem: in /home/domoticz/domoticz/scripts/lua/script_time_afvalwijzer.lua: ...omoticz/domoticz/scripts/lua/script_time_afvalwijzer.lua:328: 'then' expected near '='
I needed to add an extra "=" to this line to get it to work:

Old:

Code: Select all

   if afvaltype_cfg[avtype].reminder = nil then
New:

Code: Select all

   if afvaltype_cfg[avtype].reminder == nil then
After this edit, it works like a charm

Re: Sharing : Afval kalendar in text sensor

Posted: Tuesday 31 December 2019 16:40
by jvdz
Thanks for your input @mdieli !
I just checked and had it correctly in my test script but made the error in the production versions, so updated GITHUB with this fix.

Jos

Re: Sharing : Afval kalendar in text sensor

Posted: Monday 06 January 2020 20:50
by arnaudarduino
Hello
I like to have the garbagecalender to.
For the script i need the link to the HVCgroep.

local sQuery = 'curl "https://www.hvcgroep.nl/zelf-regelen/op ... toevoeging" 2>nul'

this returned in 2020-01-06 20:52:00.508 Error: LUA: @AFW Error: returned information does not contain the ophaaldagenNext section. stopping process

(every minut because i have debug = true)

Can't find it.
Txs

Re: Sharing : Afval kalendar in text sensor

Posted: Monday 06 January 2020 21:14
by jvdz
Are you sure they are using the site "mijnafvalwijzer" you installed the script for, as at first glance it looks like they have their own site?
You can't expect it magically to work when they have a total different datafeed. ;)
Provide me with some details about postcode/address so I can have a more detailed look at the datafeed they provide.

Jos

Re: Sharing : Afval kalendar in text sensor

Posted: Tuesday 14 January 2020 18:44
by arnaudarduino
Hello Jos, script you send me still works great.

Re: Sharing : Afval kalendar in text sensor

Posted: Tuesday 14 January 2020 18:58
by jvdz
Great to hear!
Just for all to understand what happened here: this website is also driven by OPZET, but the website scraping script published in github doesn't work with this website, so I pulled the API version for OPZET, i started lastyear, from my local archives which is working fine. Will commit that to github in a couple of weeks when all keeps working well.

Jos

Re: Sharing : Afval kalendar in text sensor

Posted: Monday 20 January 2020 21:01
by sammyke007
Anyone willing to add support for Belgium please? :D

I found a HASS version (Python) script for Belgium but no Domoticz one...
The HASS version can be found here:
https://github.com/pippyn/Home-Assistan ... /sensor.py

Our Belgian "ophaalkalender" API works like this:
With https://www.ophaalkalender.be/Calendar/ ... pcode=9120 you receive an ID (6644), that ID is necessary for the next call https://www.ophaalkalender.be/api/rides ... pcode=9120. This gives the correct data for my test adress.

Tnx in advance!

Re: Sharing : Afval kalendar in text sensor

Posted: Monday 20 January 2020 22:26
by jvdz
sammyke007 wrote: Monday 20 January 2020 21:01 Anyone willing to add support for Belgium please? :D
Should be pretty straightforward. Please send me an Email to my github emailaddress and I will have a look in the next couple of days and mail you a testversion back. :)

Jos

Re: Sharing : Afval kalendar in text sensor

Posted: Monday 20 January 2020 22:59
by sammyke007
jvdz wrote:
sammyke007 wrote: Monday 20 January 2020 21:01 Anyone willing to add support for Belgium please? :D
Should be pretty straightforward. Please send me an Email to my github emailaddress and I will have a look in the next couple of days and mail you a testversion back. :)

Jos
I will do so tomorrow! I'm not a complete noob so I'll help as much as I can, tnx!

Verstuurd vanaf mijn ONEPLUS A6003 met Tapatalk


Re: Sharing : Afval kalendar in text sensor

Posted: Thursday 30 January 2020 15:22
by Thuis
Would it be possible to add garbage calendars from other counties ? Like this, for instance ? I see they have a different kind of way to show data, but maybe there is a possibility?

https://webadapter.watsoftware.nl/afvalkalender.html

It is used by the county goeree-overflakkee and there are some options, i just do not have any knowledge of using them: https://webadapter.watsoftware.nl/

Very nice feature though, thanks.

Re: Sharing : Afval kalendar in text sensor

Posted: Thursday 30 January 2020 16:21
by jvdz
Thuis wrote: Thursday 30 January 2020 15:22 Would it be possible to add garbage calendars from other counties ?
Not sure I understand the question. All but the last one I made is used in the Netherlands and you seem to point to a Dutch website.
So what exactly would you like to know?

Jos

Re: Sharing : Afval kalendar in text sensor

Posted: Thursday 30 January 2020 16:36
by Thuis
Sorry for misunderstanding, yes i typed counties, i mean "gemeentes" by that, not Count(r)ies.
i was in the hopes that it would be possible to add the garbage scheme from another county (gemeente), but i think i am a bit confused, as there are several garbage scripts. I see all these url's from different "gemeentes" so i thought maybe mine could also be added. I just do not know how to do that, thought i would ask, nicely.

Re: Sharing : Afval kalendar in text sensor

Posted: Thursday 30 January 2020 17:20
by jvdz
Ah... ok, just let me know the website you use and your postal code so I can have a look to see what the response looks like.
Just PM the info to me.

Think I have the above covert, so send me an Email to my github emailaddress with your postal code so I can confirm my tests en I will send you a test script you can try in your setup. ;)

Jos

Re: Sharing : Afval kalendar in text sensor

Posted: Friday 31 January 2020 11:33
by jvdz
sammyke007 wrote: Monday 20 January 2020 21:01 Our Belgian "ophaalkalender" API works like this:
With https://www.ophaalkalender.be/Calendar/ ... pcode=9120 you receive an ID (6644), that ID is necessary for the next call https://www.ophaalkalender.be/api/rides ... pcode=9120. This gives the correct data for my test adress.
This script is now also available in GITHUB. :)

Jos

Re: Sharing : Afval kalendar in text sensor

Posted: Friday 31 January 2020 14:10
by sammyke007
jvdz wrote: Friday 31 January 2020 11:33
This script is now also available in GITHUB. :)

Jos
You are amazing Jos, tnx for the quick help!

Re: Sharing : Afval kalendar in text sensor

Posted: Friday 31 January 2020 16:41
by bvansteyn
Hi Jos,

The script is working for me, but I see a lot of error in my log file;

Code: Select all

2020-01-31 16:35:00.815 Error: LUA: @AFW Error: No valid date found in i_afvaltype_date: 2020- -
2020-01-31 16:35:00.815 Error: LUA: @AFW Error: No valid date found in i_afvaltype_date: 2020- -
2020-01-31 16:35:00.815 Error: LUA: @AFW Error: No valid date found in i_afvaltype_date: 2020- -
2020-01-31 16:35:00.815 Error: LUA: @AFW Error: No valid date found in i_afvaltype_date: 2020- -
2020-01-31 16:35:00.815 Error: LUA: @AFW Error: No valid date found in i_afvaltype_date: 2020- -
2020-01-31 16:35:00.816 Error: LUA: @AFW Error: No valid date found in i_afvaltype_date: 2020- -
2020-01-31 16:35:00.816 Error: LUA: @AFW Error: No valid date found in i_afvaltype_date: 2020- -
2020-01-31 16:35:00.816 Error: LUA: @AFW Error: No valid date found in i_afvaltype_date: 2020- -
2020-01-31 16:35:00.816 Error: LUA: @AFW Error: No valid date found in i_afvaltype_date: 2020- -
2020-01-31 16:35:00.816 Error: LUA: @AFW Error: No valid date found in i_afvaltype_date: 2020- -
My text sensor is updated, so it seems to be working. But I don't know how to solve the i_afvaltype_date error. I used the 'script_time_afvalwijzer' and only edited the text sensor name, my postcode (3862 LP) and my house number. Can I ignore the error or is there something I forgot?

Re: Sharing : Afval kalendar in text sensor

Posted: Friday 31 January 2020 17:18
by jvdz
bvansteyn wrote: Friday 31 January 2020 16:41 The script is working for me, but I see a lot of error in my log file;
-snip-
Can I ignore the error or is there something I forgot?
The returned data for your postcode actually looks wrong and does contain that invalid data. Here is the last part of the invalid data and the first correct part:

Code: Select all

{"nameType":"gft","type":"gft","date":"2020-  -  "},
{"nameType":"gft","type":"gft","date":"2020-  -  "},
{"nameType":"gft","type":"gft","date":"2020-  -  "},
{"nameType":"gft","type":"gft","date":"2020-  -  "},
{"nameType":"pmd","type":"pmd","date":"2020-  -K0"},
{"nameType":"gft","type":"gft","date":"2020-  -P0"},
{"nameType":"kerstbomen","type":"kerstbomen","date":"2020-01-06"},
{"nameType":"gft","type":"gft","date":"2020-01-13"},
{"nameType":"kca","type":"kca","date":"2020-01-20"},
You can suppress the warning line when you want for now by commenting that print() line like this:

Code: Select all

   if (afvalday == nil or afvalmonth == nil or afvalyear == nil) then
      -- print ('@AFW Error: No valid date found in i_afvaltype_date: ' .. i_afvaltype_date)
      return
   end
Jos

Re: Sharing : Afval kalendar in text sensor

Posted: Friday 31 January 2020 17:43
by bvansteyn
jvdz wrote: Friday 31 January 2020 17:18
bvansteyn wrote: Friday 31 January 2020 16:41 The script is working for me, but I see a lot of error in my log file;
-snip-
Can I ignore the error or is there something I forgot?
The returned data for your postcode actually looks wrong and does contain that invalid data. Here is the last part of the invalid data and the first correct part:

Code: Select all

{"nameType":"gft","type":"gft","date":"2020-  -  "},
{"nameType":"gft","type":"gft","date":"2020-  -  "},
{"nameType":"gft","type":"gft","date":"2020-  -  "},
{"nameType":"gft","type":"gft","date":"2020-  -  "},
{"nameType":"pmd","type":"pmd","date":"2020-  -K0"},
{"nameType":"gft","type":"gft","date":"2020-  -P0"},
{"nameType":"kerstbomen","type":"kerstbomen","date":"2020-01-06"},
{"nameType":"gft","type":"gft","date":"2020-01-13"},
{"nameType":"kca","type":"kca","date":"2020-01-20"},
You can suppress the warning line when you want for now by commenting that print() line like this:

Code: Select all

   if (afvalday == nil or afvalmonth == nil or afvalyear == nil) then
      -- print ('@AFW Error: No valid date found in i_afvaltype_date: ' .. i_afvaltype_date)
      return
   end
Jos
Ok, thnx! Will use the commenting. Is the wrong data something I can solve?