GarbageCalendar (new version) lua scripts

Moderator: leecollings

abc1000
Posts: 17
Joined: Friday 14 October 2016 20:42
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: GarbageCalendar (new version) lua scripts

Post by abc1000 »

Oke, i'v updated and it's 100% again :D

Thanks!
User avatar
jvdz
Posts: 2328
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: GarbageCalendar (new version) lua scripts

Post by jvdz »

Nice, just so other know too:
It seems they stopped using afvalwijzer.nl so I made a new m_rova_api to use their own api available.
This new module is available in github.
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
hoeby
Posts: 531
Joined: Saturday 02 June 2018 11:05
Target OS: Raspberry Pi / ODroid
Domoticz version: V2022.1
Location: Echt, Netherlands
Contact:

Re: GarbageCalendar (new version) lua scripts

Post by hoeby »

The script isn't working anymore.
It works for 1 day after restart domoticz. The next day it reports an issue in the log "These records are missing in your garbagecalenderconfig.lua file, so no notifications will be send"

But what are "These records" because they are not written in the log?
Thin-client --> Docker Domoticz main environment
Pi3A+ --> Google home (GAssistPi)
Pi3B+ --> Docker (P1monitor, Domoticz test environment, Ubiquity controller)
User avatar
jvdz
Posts: 2328
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: GarbageCalendar (new version) lua scripts

Post by jvdz »

The log should show the garbagetype records missing in the config right after that line.
Could you please send me your logs so I can have a look? You've got my email. ;-)

EDIT: Think I found your info again, so this is the outcome of my test run:

Code: Select all

--------------------------------------------------------------------------------------------
--> testing module m_opzet
----------------------------------------
+ 1.08 (1):Zipcode=6x0xEx  Housenr=2x  Street=  Hostname=rwm.nl  Woonplaats=Echt
  RunErr:0  RunWarn:0  WebErr:0  WebWarn:0  WTable:3  Found 16 data records, Schedule: vri 4 apr: gft afval ; din 8 apr: Grijze bak ; don 10 apr: pmd ; vri 11 apr: gft afval ; vri 18 apr: gft afval ; 
Done...
.. and see this in the log:
15:37:18 gc_main: 624: -> Start looping through data to find the first 5 events to show:
15:37:18 gc_main: 671: > first type:gft afval Icon:"nil"
>> GarbageDate:2025-4-4 GarbageType:gft afval; Calc Days Diff=2; *** Notify skipped because active <> on ( ??) in garbagetype_cfg[]!
>> GarbageDate:2025-4-8 GarbageType:restafval; Notify: Active=on Time=15:59 DaysBefore=1 reminder=6 Calc Days Diff=6
>> GarbageDate:2025-4-10 GarbageType:pmd; Calc Days Diff=8; *** Notify skipped because active <> on ( ??) in garbagetype_cfg[]!
>> GarbageDate:2025-4-11 GarbageType:gft afval; Calc Days Diff=9; *** Notify skipped because active <> on ( ??) in garbagetype_cfg[]!
>> GarbageDate:2025-4-18 GarbageType:gft afval; Calc Days Diff=16; *** Notify skipped because active <> on ( ??) in garbagetype_cfg[]!
15:37:18 gc_main: 773: -< End data loop
15:37:18 gc_main: 775: #!# Warning: These records are missing in your garbagecalendarconfig.lua file, so no notifications will be send!
15:37:18 gc_main: 776: #!# Add these records into the garbagetype_cfg table and adapt the schedule, text and icon info to your needs:


["gft afval"] ={hour=19,min=02,daysbefore=1,reminder=0,text="gft afval", icon=nil},
["pmd"] ={hour=19,min=02,daysbefore=1,reminder=0,text="pmd", icon=nil},
["grof tuinafval"] ={hour=19,min=02,daysbefore=1,reminder=0,text="grof tuinafval", icon=nil},

15:37:18 gc_main: 778: #!# -- end ----------------------------
The explanation for the "#!# Warning: These records are missing in your garbagecalendarconfig.lua file, so no notifications will be send!" can be found here.
Send me your logs in a zip when you are seeing some other issue so I can have a look. :-)
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
eddieb
Posts: 335
Joined: Wednesday 04 July 2018 7:48
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Netherlands
Contact:

Re: GarbageCalendar (new version) lua scripts

Post by eddieb »

I installed GarbageCalender inside my docker based testsetup and found that it was not updating...
some debugging showed that "lua" was not availiable inside the domoticz container ???
Anyone with similar experiances ?
I resolved it by manualy

Code: Select all

apt update
apt install lua5.4
inside the container and now the "lua" command is found and it all works.
There must be a cleaner way to do this, lua is availiable on the host
RPI4 Beta / Tasmota / ZigBee2MQTT / P1meter / Haier AC with Node-Red and MQTT / SolarEdge SE3500H modbus_tcp / Opentherm gateway / Plugwise Anna/Smile / ObserverIP weatherstation thru WuDirect
Feeding ADSB https://adsb.im/home
User avatar
jvdz
Posts: 2328
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: GarbageCalendar (new version) lua scripts

Post by jvdz »

eddieb wrote: Saturday 14 June 2025 8:34 There must be a cleaner way to do this, lua is availiable on the host
The script should test for the version of LUA installed and in case it isn't, it will run it in the foreground instead of background.

Code: Select all

LUA: => check LUA not found -> Run foreground to use internal LUA.
The preference is to run the Web-Update part in its own lua process, to avoid hanging the Domoticz event system.

So, what does your logs tell you?
ps: I've tested it in a clean docker/domoticz setup and is working for me.
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
User avatar
jvdz
Posts: 2328
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: GarbageCalendar (new version) lua scripts

Post by jvdz »

While testing the above in a clean docker install, i notices that the ico uploades are failing since the defaut ico has a size of 0 and thats not supported any more since 2025.1 (?)

So, updated the ico generation php script and uploaded the changes required for the set of default iso's
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
eddieb
Posts: 335
Joined: Wednesday 04 July 2018 7:48
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Netherlands
Contact:

Re: GarbageCalendar (new version) lua scripts

Post by eddieb »

WARNING, I might be running an older version !!! (ver="20200211-1430")

log told me following :

Code: Select all

2025-06-14 08:16:00.377  Status: LUA: @GarbageCal(m_opzet_api): #### start garbagecalendar script v20200211-1430
2025-06-14 08:16:00.377  Status: LUA: @GarbageCal(m_opzet_api): #### Debuging with extra messages because "mydebug=true" in garbagecalendarconfig.lua
2025-06-14 08:16:00.377  Status: LUA: @GarbageCal(m_opzet_api): ####    please change it back to "mydebug=false" when done testing to avoid growing a big domoticz log.
2025-06-14 08:16:00.377  Status: LUA: @GarbageCal(m_opzet_api): domoticzjsonpath: /opt/domoticz/userdata/scripts/lua/
2025-06-14 08:16:00.377  Status: LUA: @GarbageCal(m_opzet_api): datafilepath: /var/tmp/
2025-06-14 08:16:00.377  Status: LUA: @GarbageCal(m_opzet_api): scriptpath: /opt/domoticz/userdata/scripts/lua/
:
2025-06-14 08:15:00.370  Status: LUA: @GarbageCal(m_opzet_api): ####    please change it back to "mydebug=false" when done testing to avoid growing a big domoticz log.
2025-06-14 08:15:00.370  Status: LUA: @GarbageCal(m_opzet_api): domoticzjsonpath: /opt/domoticz/userdata/scripts/lua/
2025-06-14 08:15:00.370  Status: LUA: @GarbageCal(m_opzet_api): datafilepath: /var/tmp/
2025-06-14 08:15:00.370  Status: LUA: @GarbageCal(m_opzet_api): scriptpath: /opt/domoticz/userdata/scripts/lua/
2025-06-14 08:15:00.371  Status: LUA: @GarbageCal(m_opzet_api): Loaded /opt/domoticz/userdata/scripts/lua/garbagecalendar/garbagecalendarconfig.lua.
2025-06-14 08:15:00.371  Status: LUA: @GarbageCal(m_opzet_api): Loaded /opt/domoticz/userdata/scripts/lua/garbagecalendar/tablefuncs.lua.
2025-06-14 08:15:00.371  Status: LUA: @GarbageCal(m_opzet_api): Start checking garbagetype_cfg table:
2025-06-14 08:15:00.371  Status: LUA: @GarbageCal(m_opzet_api): -> NotificationTime:16:22  Garbagetype:Plastic, blik en drinkpakken
2025-06-14 08:15:00.371  Status: LUA: @GarbageCal(m_opzet_api): -> NotificationTime:16:22  Garbagetype:Textiel
2025-06-14 08:15:00.371  Status: LUA: @GarbageCal(m_opzet_api): -> NotificationTime:16:22  Garbagetype:Restafval, minicontainers.
2025-06-14 08:15:00.371  Status: LUA: @GarbageCal(m_opzet_api): -> NotificationTime:2:30  Garbagetype:reloaddata
2025-06-14 08:15:00.371  Status: LUA: @GarbageCal(m_opzet_api): -> NotificationTime:7:15  Garbagetype:dummy1
2025-06-14 08:15:00.371  Status: LUA: @GarbageCal(m_opzet_api): -> NotificationTime:16:22  Garbagetype:Groente-, fruit, tuinafval en etensresten
2025-06-14 08:15:00.371  Status: LUA: @GarbageCal(m_opzet_api): -> NotificationTime:16:22  Garbagetype:Papier en karton
2025-06-14 08:15:00.371  Status: LUA: @GarbageCal(m_opzet_api): -> NotificationTime:15:15  Garbagetype:dummy2
2025-06-14 08:15:00.371  Status: LUA: @GarbageCal(m_opzet_api): -> NotificationTime:16:22  Garbagetype:Kerstbomen
2025-06-14 08:15:00.371  Status: LUA: @GarbageCal(m_opzet_api): Start update for text device:
2025-06-14 08:15:00.371  Status: LUA: @GarbageCal(m_opzet_api): Warning: Datafile not found:/var/tmp/garbagecalendar_m_opzet_api.data . Start webupdate now.
2025-06-14 08:15:00.371  Status: LUA: @GarbageCal(m_opzet_api): start foreground webupdate for module m_opzet_api of file /var/tmp/garbagecalendar_m_opzet_api.data
2025-06-14 08:15:00.373  Status: LUA: @GarbageCal(m_opzet_api): lua /opt/domoticz/userdata/scripts/lua/garbagecalendar/m_opzet_api.lua "/opt/domoticz/userdata/scripts/lua/" "9999AA" "99" "" "/var/tmp/garbagecalendar_m_opzet_api.data" "/var/tmp/garbagecalendar_web_m_opzet_api.log" "inzamelkalender.gad.nl" ""
2025-06-14 08:15:00.374  Status: LUA: @GarbageCal(m_opzet_api):  Unable to load the data. please check your setup and runlogfile :/var/tmp/garbagecalendar_run_m_opzet_api.log
2025-06-14 08:15:00.374  Status: LUA: @GarbageCal(m_opzet_api): - End  -----------------
2025-06-14 08:15:00.374  Status: LUA: @GarbageCal(m_opzet_api): ==> found schedule:
2025-06-14 08:15:00.374  Status: LUA: @GarbageCal(m_opzet_api): Update device from:
0
 replace with:
As nothing happened I tried to manually execute

Code: Select all

lua /opt/domoticz/userdata/scripts/lua/garbagecalendar/m_opzet_api.lua "/opt/domoticz/userdata/scripts/lua/" "9999AA" "99" "" "/var/tmp/garbagecalendar_m_opzet_api.data" "/var/tmp/garbagecalendar_web_m_opzet_api.log" "inzamelkalender.gad.nl" ""
from the cli inside the container
that gave me the warning that "lua" was not found.
after I installed lua it worked
RPI4 Beta / Tasmota / ZigBee2MQTT / P1meter / Haier AC with Node-Red and MQTT / SolarEdge SE3500H modbus_tcp / Opentherm gateway / Plugwise Anna/Smile / ObserverIP weatherstation thru WuDirect
Feeding ADSB https://adsb.im/home
User avatar
jvdz
Posts: 2328
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: GarbageCalendar (new version) lua scripts

Post by jvdz »

So you want me to look at the version thats 5 years old or would it be a logica idea to try to latest version? ;)
Answer to question 1:
Spoiler: show
guess you know it already :twisted:
In case you still have issues with the latest then zip up the logs and email them to me so I can check.
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
eddieb
Posts: 335
Joined: Wednesday 04 July 2018 7:48
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Netherlands
Contact:

Re: GarbageCalendar (new version) lua scripts

Post by eddieb »

Of course not ...
It is just a sign of how good that old version is, it just does what is has to do on my prod domoticz...
I will try the new version on my doccker test system
RPI4 Beta / Tasmota / ZigBee2MQTT / P1meter / Haier AC with Node-Red and MQTT / SolarEdge SE3500H modbus_tcp / Opentherm gateway / Plugwise Anna/Smile / ObserverIP weatherstation thru WuDirect
Feeding ADSB https://adsb.im/home
eddieb
Posts: 335
Joined: Wednesday 04 July 2018 7:48
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Netherlands
Contact:

Re: GarbageCalendar (new version) lua scripts

Post by eddieb »

latest version running,
how do I get this icon ?
I added the , icon = 'xxx' part according the example and checked that http://127.0.0.1:8080 is reachable but no icon (yet)

Code: Select all

        ['Groente-, fruit, etensresten en  klein tuinafval'] ={hour=16,min=22,daysbefore=1,reminder=0,text='Groente-, fruit en tuinafval', icon = 'garbagecalendar_green'},
        ['Restafval']                        ={hour=16,min=22,daysbefore=1,reminder=0,text='Restafval', icon = 'garbagecalendar_grey'},
        ['Papier en karton']                 ={hour=16,min=22,daysbefore=1,reminder=0,text='Papier en karton', icon = 'garbagecalendar_blue'},
        ['Plastic, blik en drinkpakken']     ={hour=16,min=22,daysbefore=1,reminder=0,text='Plastic, blik en drinkpakken', icon = 'garbagecalendar_orange'},
        ['Textiel']                          ={hour=16,min=22,daysbefore=1,reminder=0,text='Textiel'},
        ['Kerstbomen']                       ={hour=16,min=22,daysbefore=1,reminder=0,text='Kerstbomen'},
RPI4 Beta / Tasmota / ZigBee2MQTT / P1meter / Haier AC with Node-Red and MQTT / SolarEdge SE3500H modbus_tcp / Opentherm gateway / Plugwise Anna/Smile / ObserverIP weatherstation thru WuDirect
Feeding ADSB https://adsb.im/home
User avatar
jvdz
Posts: 2328
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: GarbageCalendar (new version) lua scripts

Post by jvdz »

Ah...you got it working...nice.
Could it be that there was no update for the text device since you added the icon bit?
Think it will do that part only when it has to do an actual update to it.
The log will tell you the info about the update.
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest