Page 12 of 23

Re: GarbageCalendar (new version) lua scripts

Posted: Wednesday 30 December 2020 22:00
by Freakandel
Hi, my Garbagescript has worked for a long time, but since a couple of day's (a week, maybe) the Domoticz Device is empty and I see the following error in the log of Domoticz:
### Warning: No valid records found in the datafile: /var/tmp/garbagecalendar_m_mijnafvalwijzer.data
I haven't changed anything, and cannot see anything in the /var/tmp/ logfiles.

Is it a common error and easy to fix?

Re: GarbageCalendar (new version) lua scripts

Posted: Wednesday 30 December 2020 23:12
by jvdz
Freakandel wrote: Wednesday 30 December 2020 22:00 Is it a common error and easy to fix?
It is in case you are affected like others and didn't implement the fix available on github for mijnafvalwijzer not supplying the year for some, but ......
I really ( as always) need the logfiles to be sure of what is happening. ;)
Email them in a zip file to me when you like me to have a look or follow the Wiki for troubleshooting: https://github.com/jvanderzande/Garbage ... ki/Testing

Jos

Re: GarbageCalendar (new version) lua scripts

Posted: Friday 08 January 2021 20:19
by wimbre
Hi Jos,

I can't find any log files in the /var/tmp directory but I do have errors in the Domoticz logfile.

2021-01-08 19:23:00.325 Error: EventSystem: Lua script /home/pi/domoticz/scripts/lua/script_time_garbagecalendar.lua did not return a commandArray
2021-01-08 19:24:00.336 Error: LUA: !!! LUA Error: .../pi/domoticz/scripts/lua/script_time_garbagecalendar.lua:66: module 'garbagecalendarconfig' not found:
2021-01-08 19:24:00.336 no field package.preload['garbagecalendarconfig']
2021-01-08 19:24:00.336 no file '/home/pi/domoticz/scripts/lua/garbagecalendar/garbagecalendarconfig.lua'
2021-01-08 19:24:00.336 no file './garbagecalendar/garbagecalendarconfig.lua'
2021-01-08 19:24:00.336 no file '/usr/local/share/lua/5.3/garbagecalendarconfig.lua'
2021-01-08 19:24:00.336 no file '/usr/local/share/lua/5.3/garbagecalendarconfig/init.lua'
2021-01-08 19:24:00.336 no file '/usr/local/lib/lua/5.3/garbagecalendarconfig.lua'
2021-01-08 19:24:00.336 no file '/usr/local/lib/lua/5.3/garbagecalendarconfig/init.lua'
2021-01-08 19:24:00.336 no file '/usr/share/lua/5.3/garbagecalendarconfig.lua'
2021-01-08 19:24:00.336 no file '/usr/share/lua/5.3/garbagecalendarconfig/init.lua'
2021-01-08 19:24:00.336 no file './garbagecalendarconfig.lua'
2021-01-08 19:24:00.336 no file './garbagecalendarconfig/init.lua'
2021-01-08 19:24:00.336 no file '/usr/local/lib/lua/5.3/garbagecalendarconfig.so'
2021-01-08 19:24:00.336 no file '/usr/lib/arm-linux-gnueabihf/lua/5.3/garbagecalendarconfig.so'
2021-01-08 19:24:00.336 no file '/usr/lib/lua/5.3/garbagecalendarconfig.so'
2021-01-08 19:24:00.336 no file '/usr/local/lib/lua/5.3/loadall.so'
2021-01-08 19:24:00.336 no file './garbagecalendarconfig.so'
2021-01-08 19:24:00.336 Error: EventSystem: Lua script /home/pi/domoticz/scripts/lua/script_time_garbagecalendar.lua did not return a commandArray

Do you know why there are no logfiles in the / var / tmp directory?

Re: GarbageCalendar (new version) lua scripts

Posted: Friday 08 January 2021 20:28
by jvdz
Did you copy all the files to the correct place and follow the setup wiki as it seems the garbagecalendarconfig.lua file is missing?
https://github.com/jvanderzande/Garbage ... wiki/Setup

Jos

Re: GarbageCalendar (new version) lua scripts

Posted: Saturday 09 January 2021 10:00
by wimbre
jvdz wrote: Friday 08 January 2021 20:28 Did you copy all the files to the correct place and follow the setup wiki as it seems the garbagecalendarconfig.lua file is missing?
https://github.com/jvanderzande/Garbage ... wiki/Setup

Jos
Removing and reinstalling did the job.

Re: GarbageCalendar (new version) lua scripts

Posted: Saturday 09 January 2021 14:22
by wimbre
Hi Jos,

I'm trying to get the notifications (mail) up and running, but tbh I can't figure out the right format.

According to the setup:
NotificationEmailAdress = {' ',' '} -- Specify multiple Email Addresses for the notifications. Leave empty to skip email notification

Actual content of my file:
NotificationEmailAdress = {'.com'} -- Specify multiple Email Addresses for the notifications. Leave empty to skip email notification

Logfile:
/var/tmp/garbagecalendar_m_mijnafvalwijzer.data
2021-01-09 14:14:00.184 Status: LUA: 14:14:00 ==> GarbageDate:2021-1-14 GarbageType:gft; Notify: Active=on Time=13:10 DaysBefore=5 reminder=0 Calc Days Diff=5
2021-01-09 14:14:00.184 Status: LUA: 14:14:00 ----> Notification Email send for gft |GarbageCalendar: over 5 dagen de Groen aan de weg zetten!#Groen wordt over 5 dagen opgehaald! (herinnering)#.com|

However, I am not receiving an email.

Thanks in advance.

Wim Bre

Re: GarbageCalendar (new version) lua scripts

Posted: Saturday 09 January 2021 14:27
by jvdz
Have you configured Domoticz EMail in Setup and is that working as that is what the script is using?

Jos

Re: GarbageCalendar (new version) lua scripts

Posted: Saturday 09 January 2021 15:25
by wimbre
Have you configured Domoticz EMail in Setup and is that working as that is what the script is using?

:o Solved!

Re: GarbageCalendar (new version) lua scripts

Posted: Sunday 24 January 2021 16:47
by edezwaan82
Hi all,

I`m trying to configure my situation but couldn`t find the companyCode for https://mijn.circulus-berkel.nl/afvalkalender/. Does anyone knows the code for Circules-berkel. I`m living in Apeldoorn.

Thanks.

Re: GarbageCalendar (new version) lua scripts

Posted: Sunday 24 January 2021 18:14
by jvdz
That Garbage website isn't supported by any of the existing modules so will require a new module to be written.

Scratch that: Think you need to use module OPZET.

Jos

Re: GarbageCalendar (new version) lua scripts

Posted: Sunday 31 January 2021 21:55
by PatrickG
Hi Jos,

Is it possible to include the following service in your code?

https://inzamelwijzer.suez.nl/

I think this will cover (at least) the Arnhem region.

BR
Patrick

Re: GarbageCalendar (new version) lua scripts

Posted: Sunday 31 January 2021 23:21
by Thuis
Hello, i have been using this great feature for a while now. I just took my domotica experience to the next level using google home and node red.
I would like to habe google tell me when to put the garbage out. I know in the garbagecalendarconfig.lua is a notification setting.
Now, i can do notification of a switch, i can select google_devices. Would it be possible to do this also inside the garbagecalendarconfig.lua ?

Now i have: Notificationsystem = 'telegram;kodi;' inside the garbagecalendarconfig.lua.
So i thought very simple, to add the same notification as the switches inside domoticz.
I put in the garbagecalendarconfig.lua: Notificationsystem = 'telegram;kodi;google_devices'

Perhaps it is too simple of me, but would that be possible? Or does anyone have an idea how to let the notification speak thru my nest mini?
Or it could be an idea to implement it in the script? The notification system: google_devices ? Just like the switches notification settings?

Image

It speaks what ever i put in the notification in dutch language :-) Would be awesome to have garbagecalendar speak to me too.

Re: GarbageCalendar (new version) lua scripts

Posted: Monday 01 February 2021 10:07
by jvdz
PatrickG wrote: Sunday 31 January 2021 21:55 Hi Jos,

Is it possible to include the following service in your code?

https://inzamelwijzer.suez.nl/

I think this will cover (at least) the Arnhem region.

BR
Patrick
Patrick,
I believe the proper module is: m_opzet_api.
PM/Email me a valid zipcode/housenr combo to test in case it doesn't work, so I can see what it would take to make it work?

Cheers,
Jos

Re: GarbageCalendar (new version) lua scripts

Posted: Monday 01 February 2021 10:20
by jvdz
Thuis wrote: Sunday 31 January 2021 23:21 It speaks what ever i put in the notification in dutch language :-) Would be awesome to have garbagecalendar speak to me too.
You can put in the config any supported Domoticz notification system, but I believe that Google notification is the Google Cloud notification, not casting to a Home device.
I am currently have a different approach to make Domoticz talk to me:
  • Created 2 Dummy text devices which will be updated with the text to be spoken by Google Home/Nest. I use 2 dummy devices to make the max lenght of the spoken text 2 * 63 characters.
  • Nodered process, which monitor's MQTT Domoticz/out for the dummy devices and cast the text to the home device using module "node-red-contrib-cast"
In this way I can send messages from any event to my Google Home.

Jos

Re: GarbageCalendar (new version) lua scripts

Posted: Monday 01 February 2021 10:44
by sammyke007
Hi Jos!

According to "Gianni" the Belgian recycleapp changed once again... It stopped receiving data indeed and text is blanco since last week:

"Gianni" posted this:
recycleapp has changed the street names

Now it's get the name fron the id of https://data.vlaanderen.be/

https://data.vlaanderen.be/doc/straatnaam/xxxxxx in my case

https://recycleapp.be/api/app/v1/collec ... 3&size=100

Re: GarbageCalendar (new version) lua scripts

Posted: Monday 01 February 2021 10:54
by jvdz
I indeed see it is failing now. So what exactly is the sequence of web calls now as the listed links doesn't contain all required info?
You can of course always make the update for yourself and make a pull request in GitHub with the changes. ;)

Jos

Re: GarbageCalendar (new version) lua scripts

Posted: Monday 01 February 2021 11:34
by sammyke007
jvdz wrote: Monday 01 February 2021 10:54 I indeed see it is failing now. So what exactly is the sequence of web calls now as the listed links doesn't contain all required info?
You can of course always make the update for yourself and make a pull request in GitHub with the changes. ;)

Jos
Testing new code is no problem for me, but I don't have the knowledge to change the code myself :oops: :) .
In the dashticz garbage module (managed by Lokonli) I see they are looking for a solution too.

Re: GarbageCalendar (new version) lua scripts

Posted: Monday 01 February 2021 11:56
by jvdz
The issue seems to be that they have moved away from an hardcoded secret but now put that into a mainxxxxxx.js file.
I have updated the script and added 2 extra steps to get the name of the mainxxxx.js file, retrieve that file and get the secret key from it.
After this the rest works again. The script now does 6 API calls to get the calendar info 8-)

Please give the development version a try and let me know it works for you too, so I can move it to Master.
https://raw.githubusercontent.com/jvand ... app-be.lua

Jos

Re: GarbageCalendar (new version) lua scripts

Posted: Monday 01 February 2021 12:54
by sammyke007
Updated "m_recycleapp-be" with your updated version and set debug to true:
Log:

Code: Select all

2021-02-01 12:52:00.394 Status: LUA: @GarbageCal(m_recycleapp-be): #### Mon Feb 1 12:52:00 2021 ### Start garbagecalendar script v20200613-1800
2021-02-01 12:52:00.394 Status: LUA: @GarbageCal(m_recycleapp-be): #### Debuging with extra messages because "mydebug=true" in garbagecalendarconfig.lua
2021-02-01 12:52:00.394 Status: LUA: @GarbageCal(m_recycleapp-be): #### please change it back to "mydebug=false" when done testing to avoid growing a big domoticz log.
2021-02-01 12:52:00.394 Status: LUA: @GarbageCal(m_recycleapp-be): domoticzjsonpath: /home/pi/domoticz/scripts/lua/
2021-02-01 12:52:00.394 Status: LUA: @GarbageCal(m_recycleapp-be): datafilepath: /var/tmp/
2021-02-01 12:52:00.394 Status: LUA: @GarbageCal(m_recycleapp-be): scriptpath: /home/pi/domoticz/scripts/lua/
2021-02-01 12:52:00.394 Status: LUA: @GarbageCal(m_recycleapp-be): Loaded /home/pi/domoticz/scripts/lua/garbagecalendar/garbagecalendarconfig.lua.
2021-02-01 12:52:00.396 Status: LUA: @GarbageCal(m_recycleapp-be): Loaded /home/pi/domoticz/scripts/lua/garbagecalendar/generalfuncs.lua.
2021-02-01 12:52:00.397 Status: LUA: @GarbageCal(m_recycleapp-be): Start checking garbagetype_cfg table:
2021-02-01 12:52:00.397 Status: LUA: @GarbageCal(m_recycleapp-be): -> NotificationTime:19:2 Garbagetype:snoeiafval
2021-02-01 12:52:00.397 Status: LUA: @GarbageCal(m_recycleapp-be): -> NotificationTime:19:22 Garbagetype:pmd
2021-02-01 12:52:00.397 Status: LUA: @GarbageCal(m_recycleapp-be): -> NotificationTime:19:2 Garbagetype:p-k
2021-02-01 12:52:00.397 Status: LUA: @GarbageCal(m_recycleapp-be): -> NotificationTime:19:2 Garbagetype:papier-karton
2021-02-01 12:52:00.397 Status: LUA: @GarbageCal(m_recycleapp-be): -> NotificationTime:19:22 Garbagetype:gft
2021-02-01 12:52:00.397 Status: LUA: @GarbageCal(m_recycleapp-be): -> NotificationTime:19:2 Garbagetype:restafval
2021-02-01 12:52:00.397 Status: LUA: @GarbageCal(m_recycleapp-be): -> NotificationTime:2:30 Garbagetype:reloaddata
2021-02-01 12:52:00.397 Status: LUA: @GarbageCal(m_recycleapp-be): -> NotificationTime:2:31 Garbagetype:dummy1
2021-02-01 12:52:00.397 Status: LUA: @GarbageCal(m_recycleapp-be): -> NotificationTime:19:2 Garbagetype:glas
2021-02-01 12:52:00.397 Status: LUA: @GarbageCal(m_recycleapp-be): Start update for text device:
2021-02-01 12:52:00.398 Status: LUA: @GarbageCal(m_recycleapp-be): - Start looping through data from the website to find the first 3 event to show: /var/tmp/garbagecalendar_m_recycleapp-be.data
2021-02-01 12:52:00.398 Status: LUA: @GarbageCal(m_recycleapp-be): ### Warning: No valid records found in the datafile: /var/tmp/garbagecalendar_m_recycleapp-be.data
2021-02-01 12:52:00.398 Status: LUA: @GarbageCal(m_recycleapp-be): ### Please check the garbagecalendar log files for issues : /var/tmp/garbagecalendar_web_m_recycleapp-be.log and /var/tmp/garbagecalendar_run_m_recycleapp-be.log
2021-02-01 12:52:00.398 Status: LUA: @GarbageCal(m_recycleapp-be): - End -----------------
2021-02-01 12:52:00.398 Status: LUA: @GarbageCal(m_recycleapp-be): ==> found schedule:
2021-02-01 12:52:00.398 Status: LUA: @GarbageCal(m_recycleapp-be): Update device from:
2021-02-01 12:52:00.398 0
2021-02-01 12:52:00.398 replace with:
2021-02-01 12:52:00.398
2021-02-01 12:52:00.399 Status: LUA: @GarbageCal(m_recycleapp-be): #### 12:52:00 End garbagecalendar script v20200613-1800
2021-02-01 12:52:00.408 Status: EventSystem: Script event triggered: /home/pi/domoticz/scripts/lua/script_time_garbagecalendar.lua
garbagecalendar_web_m_recycleapp-be.log

Code: Select all

@m_ophaalkalender-be: #### Mon Feb  1 02:30:00 2021 ### Start garbagecalendar module m_ophaalkalender-be (v20200606-1300)
@m_ophaalkalender-be: Loaded JSON.lua.
@m_ophaalkalender-be: !!! perform background update to /var/tmp/garbagecalendar_m_recycleapp-be.data for Zipcode 9120 - 21  (optional) Hostname:
@m_ophaalkalender-be: ---- web update ----------------------------------------------------------------------------
@m_ophaalkalender-be: sQuery=curl -k  -H "x-secret: Qp4KmgmK2We1ydc9Hxso5D6K0frz3a9raj2tqLjWN5n53TnEijmmYz78pKlcma54sjKLKogt6f9WdnNUci6Gbujnz6b34hNbYo4DzyYRZL5yzdJyagFHS15PSi2kPUc4v2yMck81yFKhlk2aWCTe93" -H "x-consumer: recycleapp.be" https://recycleapp.be/api/app/v1/access-token 2>/var$
@m_ophaalkalender-be: ---- web data ----------------------------------------------------------------------------
@m_ophaalkalender-be: {"host":"http://api-http:8080","identifier":"9abae848-fa67-4fb7-bedc-4cb44a421570","timestamp":"2021-02-01T01:30:00.433Z","status":401,"name":"Unauthorized","message":"Missing authorization"}
@m_ophaalkalender-be: ---- web err ------------------------------------------------------------------------
@m_ophaalkalender-be: Web_Err=  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
^M  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0^M  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0^M100   191  100   191    0     0   1067      0 --:--:-- --:--:-- --:--:--  1067

@m_ophaalkalender-be: ---- end web data ------------------------------------------------------------------------
@m_ophaalkalender-be: ### Error: No accessToken retrieved...  stopping execution.
@m_ophaalkalender-be: => Write data to /var/tmp/garbagecalendar_m_recycleapp-be.data

Re: GarbageCalendar (new version) lua scripts

Posted: Monday 01 February 2021 13:39
by jvdz
You haven't done a webupdate!
Delete the data file and run again or update this to force the update process:

Code: Select all

mydebug      = true  -- (true/false)
testdataload = true  -- (true/false)