GarbageCalendar (new version) lua scripts

Moderator: leecollings

remko2000
Posts: 165
Joined: Thursday 28 December 2017 14:38
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Broek op Langedijk
Contact:

Re: GarbageCalendar (new version) lua scripts

Post by remko2000 »

Ah, now I understand.
Thanks for the explanation. I'm going to experiment with the dzventz script. It's great that I already have a start.
User avatar
mvveelen
Posts: 686
Joined: Friday 31 October 2014 10:22
Target OS: NAS (Synology & others)
Domoticz version: Beta
Location: Hoorn, The Netherlands
Contact:

Re: GarbageCalendar (new version) lua scripts

Post by mvveelen »

I'm lost.

Yesterday I had to change to another USB drive and after uploading all scripts and uploading the backup DB the only thing I don't see is the garbage utility-thingy. As far as I can see, there is nothing missing and I've changed nothing in the settings files or so. What can I check to get the custom sensor back?
RPi3b+/RFXCOM rfxtrx433E/Shelly/Xiaomi Gateway/Philips HUE Lights/Atag Zone One/2 SunnyBoy inverters/AirconWithMe/P1 smartmeter/Domoticz latest Beta
User avatar
jvdz
Posts: 2206
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 »

mvveelen wrote: Thursday 18 July 2024 12:29 What can I check to get the custom sensor back?
Follow setup steps: https://github.com/jvanderzande/Garbage ... wiki/Setup
Follow Debugging steps: https://github.com/jvanderzande/Garbage ... ki/Testing
Point of last resort: EMail me your Config & Logfiles in a zip. :)
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
User avatar
lsp242
Posts: 54
Joined: Sunday 04 February 2018 8:51
Target OS: Raspberry Pi / ODroid
Domoticz version: 12923
Location: Netherlands
Contact:

Re: GarbageCalendar (new version) lua scripts

Post by lsp242 »

pfff all system crashed, now i got the script running, but no update to the "sensor" in Domoticz.

In Domoticz I get:

Code: Select all

2024-09-11 21:28:00.218 dzVents: ------ Start external script: script_time_garbagecalendar.lua:, trigger: "Every 1 minutes"
2024-09-11 21:28:00.230 dzVents: 21:28:00 gc_main: 136: Loaded /home/pi/domoticz/scripts/dzVents/scripts/garbagecalendar/garbagecalendarconfig.lua.
2024-09-11 21:28:00.233 dzVents: 21:28:00 gc_main: 152: Loaded /home/pi/domoticz/scripts/dzVents/scripts/garbagecalendar/gc_generalfuncs.lua.
2024-09-11 21:28:00.234 dzVents: 21:28:00 gc_func: 352: -> Loading module JSON
2024-09-11 21:28:00.234 dzVents: 21:28:00 gc_func: 367: -< Loaded JSON.lua. ->moduleobject type:table
2024-09-11 21:28:00.234 dzVents: 21:28:00 gc_main: 172: -> Start processing garbagecalendarconfig.lua information.
2024-09-11 21:28:00.235 dzVents: 21:28:00 gc_main: 234: !> Debuging with extra messages because "mydebug=true" in garbagecalendarconfig.lua
2024-09-11 21:28:00.235 dzVents: 21:28:00 gc_main: 235: !> please change it back to "mydebug=false" when done testing to avoid growing a big domoticz log.
2024-09-11 21:28:00.236 dzVents: 21:28:00 gc_main: 256: -< End processing garbagecalendarconfig.lua information.
2024-09-11 21:28:00.236 dzVents: 21:28:00 gc_main: 908: -> Start checking garbagetype_cfg table whether an action is needed:
2024-09-11 21:28:00.236 dzVents: 21:28:00 gc_main: 988: 1 --- NotificationTime=19:02 Garbagetype=plastic, metaal en drankenkartons
2024-09-11 21:28:00.237 dzVents: 21:28:00 gc_main: 988: 2 --- NotificationTime=19:02 Garbagetype=groente-, fruit- en tuinafval
2024-09-11 21:28:00.237 dzVents: 21:28:00 gc_main: 988: 3 --- NotificationTime=02:31 Garbagetype=updatedomoticzdevice
2024-09-11 21:28:00.237 dzVents: 21:28:00 gc_main: 988: 4 --- NotificationTime=02:30 Garbagetype=reloaddata
2024-09-11 21:28:00.237 dzVents: 21:28:00 gc_main: 988: 5 --- NotificationTime=19:02 Garbagetype=restafval
2024-09-11 21:28:00.238 dzVents: 21:28:00 gc_main: 988: 6 --- NotificationTime=19:02 Garbagetype=textiel
2024-09-11 21:28:00.238 dzVents: 21:28:00 gc_main: 988: 7 --- NotificationTime=04:01 Garbagetype=dummy
2024-09-11 21:28:00.238 dzVents: 21:28:00 gc_main: 988: 8 --- NotificationTime=19:02 Garbagetype=oud papier & karton
2024-09-11 21:28:00.238 dzVents: 21:28:00 gc_main: 994: #> Perform update because mydebug=true.
2024-09-11 21:28:00.239 dzVents: 21:28:00 gc_main: 548: -> Action starting, First check access to required files:
2024-09-11 21:28:00.239 dzVents: 21:28:00 gc_main: 551: Run command:
2024-09-11 21:28:00.239 ls -l /home/pi/domoticz/scripts/dzVents/scripts/garbagecalendar/data/garbagecal*m_opzet_api*:
2024-09-11 21:28:00.247 dzVents: -rwxrw-rw- 1 root root 500 Jun 25 02:30 /home/pi/domoticz/scripts/dzVents/scripts/garbagecalendar/data/garbagecalendar_m_opzet_api.data
2024-09-11 21:28:00.247 -rwxrw-rw- 1 root root 1912 Sep 11 21:28 /home/pi/domoticz/scripts/dzVents/scripts/garbagecalendar/data/garbagecalendar_m_opzet_api_run.log
2024-09-11 21:28:00.247 -rwxrw-rw- 1 root root 4278 Sep 11 21:27 /home/pi/domoticz/scripts/dzVents/scripts/garbagecalendar/data/garbagecalendar_m_opzet_api_run_update.log
2024-09-11 21:28:00.247 -rwxrw-rw- 1 root root 8037 Sep 11 02:30 /home/pi/domoticz/scripts/dzVents/scripts/garbagecalendar/data/garbagecalendar_m_opzet_api_run_webupdate_backgound.log
2024-09-11 21:28:00.247 -rwxrw-rw- 1 root root 1951 Sep 11 02:30 /home/pi/domoticz/scripts/dzVents/scripts/garbagecalendar/data/garbagecalendar_m_opzet_api_run_webupdate.log
2024-09-11 21:28:00.248 dzVents: 21:28:00 gc_main: 869: Access OK: /home/pi/domoticz/scripts/dzVents/scripts/garbagecalendar/data/garbagecalendar_m_opzet_api.data
2024-09-11 21:28:00.248 dzVents: 21:28:00 gc_main: 869: Access OK: /home/pi/domoticz/scripts/dzVents/scripts/garbagecalendar/data/garbagecalendar_m_opzet_api_run.log
2024-09-11 21:28:00.249 dzVents: 21:28:00 gc_main: 584: -> Start update for GarbageCalendar text device "Afvalbak"
2024-09-11 21:28:00.249 dzVents: 21:28:00 gc_main: 611: 4 data records loaded, updated at Tue Jun 25 02:30:01 2024 from Datafile:/home/pi/domoticz/scripts/dzVents/scripts/garbagecalendar/data/garbagecalendar_m_opzet_api.data
2024-09-11 21:28:00.249 dzVents: 21:28:00 gc_main: 627: -> Start looping through data to find the first 3 events to show:
2024-09-11 21:28:00.250 dzVents: 21:28:00 gc_main: 771: ### Warning: No valid records found in the Datafile: /home/pi/domoticz/scripts/dzVents/scripts/garbagecalendar/data/garbagecalendar_m_opzet_api.data
2024-09-11 21:28:00.251 dzVents: 21:28:00 gc_main: 772: ### Please check the garbagecalendar log files for issues : /home/pi/domoticz/scripts/dzVents/scripts/garbagecalendar/data/garbagecalendar_m_opzet_api_run.log
2024-09-11 21:28:00.251 dzVents: 21:28:00 gc_main: 774: -< End data loop
2024-09-11 21:28:00.251 dzVents: 21:28:00 gc_main: 776: #!# Warning: These records are missing in your garbagecalendarconfig.lua file, so no notifications will be send!
2024-09-11 21:28:00.251 dzVents: 21:28:00 gc_main: 777: #!# Add these records into the garbagetype_cfg table and adapt the schedule, text and icon info to your needs:
2024-09-11 21:28:00.252 dzVents:
2024-09-11 21:28:00.252 ["oud papier & karton."] ={hour=19,min=02,daysbefore=1,reminder=0,text="oud papier & karton.", icon=nil},
2024-09-11 21:28:00.252
2024-09-11 21:28:00.252 dzVents: 21:28:00 gc_main: 779: #!# -- end ----------------------------
2024-09-11 21:28:00.252 dzVents: 21:28:00 gc_main: 786: -> found schedule:
2024-09-11 21:28:00.252 dzVents: 21:28:00 gc_main:1006: -< ### DzVents: End garbagecalendar script v20230703-2300
Hopelijk kan je me helpen en is het iets doms (zoals vaker)

en deze... is via ssh en nano leeg:
Also check *garbage.**modulename*data for valid table information looking like this format:
Gadget freak - Domoticz beginner - ios and android user
User avatar
jvdz
Posts: 2206
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 »

lsp242 wrote: Wednesday 11 September 2024 21:36 pfff all system crashed, now i got the script running, but no update to the "sensor" in Domoticz.
Hopelijk kan je me helpen en is het iets doms (zoals vaker)
en deze... is via ssh en nano leeg:
Also check *garbage.**modulename*data for valid table information looking like this format:
Did you look at the logs as indicated in the Wiki and in the log you shown?
As always: I can have a look for you, but you will have to email me a ZIP file containing All the logfiles and the config file, so I can check what is happening for you. :-)
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
User avatar
HansieNL
Posts: 960
Joined: Monday 28 September 2015 15:13
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: GarbageCalendar (new version) lua scripts

Post by HansieNL »

@jvdz MijnAfvalwijzer is gonna be Saver. Can you tell me how I can keep my afvalkalender updated?
Blah blah blah
User avatar
jvdz
Posts: 2206
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 »

It was reported here: https://github.com/jvanderzande/Garbage ... /issues/39
So the solution should be to use these variable settings:

Code: Select all

wmodule=m_opzet
Hostname=saver.nl
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
hoeby
Posts: 530
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 »

There is a file name issue on github

Code: Select all

m_mijnafvalwijzer_API.lua
this needs to be

Code: Select all

m_mijnafvalwijzer_api.lua
This was the error in domoticz log

Code: Select all

2025-01-24 19:29:00.440 Error: LUA: 19:29:00 gc_main: 260: ### Error: module not found: /opt/domoticz/userdata/scripts/lua/garbagecalendar/m_mijnafvalwijzer_api.lua
Our garbage collector is changed with there api.
Any tips or tricks how to find the correct one?
Or is it trail and error, untill there is data?

The scripting worked great the last years, but after 01-01-2025 it stopped. I think because the garbage collector changed the api.
Almost tried all, without luck. Can't find the correct way to debug this.
My garbage collector = https://rwm.nl/wanneer
Thin-client --> Docker Domoticz main environment
Pi3A+ --> Google home (GAssistPi)
Pi3B+ --> Docker (P1monitor, Domoticz test environment, Ubiquity controller)
hoeby
Posts: 530
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 »

Trail and error did the job

RWM is now

Code: Select all

Hostname = 'https://rwm.nl'
websitemodule = "m_opzet_api"
Thin-client --> Docker Domoticz main environment
Pi3A+ --> Google home (GAssistPi)
Pi3B+ --> Docker (P1monitor, Domoticz test environment, Ubiquity controller)
User avatar
jvdz
Posts: 2206
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 »

hoeby wrote: Friday 24 January 2025 19:54 There is a file name issue on github
Should be fixed in github now, where I made all lowercase to avoid these type of issues. Thanks for reporting. :)
hoeby wrote: Friday 24 January 2025 20:05 Trail and error did the job

RWM is now

Code: Select all

Hostname = 'https://rwm.nl'
websitemodule = "m_opzet_api"
Great things work again for you.
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
sloeber70
Posts: 17
Joined: Wednesday 08 July 2020 10:59
Target OS: Linux
Domoticz version: latest
Location: Bruges
Contact:

Re: GarbageCalendar (new version) lua scripts

Post by sloeber70 »

Hi,

Implemented today.. works very nice.
Thx!

Is there a way to let the textbox align from the left side?
Attachments
textbox.jpg
textbox.jpg (22.51 KiB) Viewed 6346 times
Kind regards,
Sloeber70

Linux 12 Bookworm standard edition
Domoticz latest beta
User avatar
jvdz
Posts: 2206
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 »

sloeber70 wrote: Saturday 25 January 2025 16:45 Is there a way to let the textbox align from the left side?
Don't think you are using the standard Domoticz Web front-end... right?
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
sloeber70
Posts: 17
Joined: Wednesday 08 July 2020 10:59
Target OS: Linux
Domoticz version: latest
Location: Bruges
Contact:

Re: GarbageCalendar (new version) lua scripts

Post by sloeber70 »

Hi,

Yes I am using that with Machinon theme. Latest Beta
Kind regards,
Sloeber70

Linux 12 Bookworm standard edition
Domoticz latest beta
User avatar
jvdz
Posts: 2206
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 »

Well you can add formatting to the generated text for the text device when that is supported by the theme.
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
sloeber70
Posts: 17
Joined: Wednesday 08 July 2020 10:59
Target OS: Linux
Domoticz version: latest
Location: Bruges
Contact:

Re: GarbageCalendar (new version) lua scripts

Post by sloeber70 »

Hi,

I can add simple <BR> tags to get a new line. So those tags are working.

Tried already several tags... they are working but they add 2 new linebreaks between each entry in the textbox.

Can you help me and give me some directions?
Kind regards,
Sloeber70

Linux 12 Bookworm standard edition
Domoticz latest beta
User avatar
jvdz
Posts: 2206
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 »

jvdz wrote: Saturday 25 January 2025 18:07 Tried already several tags... they are working but they add 2 new linebreaks between each entry in the textbox.
What happens when you change the config to?:

Code: Select all

textformat = '<p align="left">wd dd mmm: tdesc</p>'
EDIT: Guess that adds those extra line breaks?
I can make a simple modification so you can define a surrounding formatting for the text device:
Update your gc_main.lua line 782 to:

Code: Select all

		-- always update the domoticz device so one can see it is updating and when it was ran last.
		Print_logfile('-> found schedule:' .. devtxt:gsub('\r\n', ' ; '), 1)

		-- add global formatting when defined
		tdevformat = tdevformat or ''
		if tdevformat:match('#') then
			devtxt = tdevformat:gsub('#', devtxt, 1)
			Print_logfile('-> added textdev formatting:' .. devtxt:gsub('\r\n', ' ; '), 1)
		end

		-- close ICAL file when requested

and update this in your garbagecalenderconfig.lua, adding variable tdevformat:

Code: Select all

-- textformat = 'tdesc: wd dd mmm'
textformat = 'wd dd mmm: tdesc'
-- One can also add some html formatting formating to the output when the used interface supports that:eg:
--    textformat = '<font color="red" size=1>tdesc: wd dd mmm</font>'
-- this variable can contain the surrounding text device formatting for the total textbox information
-- # => Generated lines that need to be surrounded. This variable is ignored when it doesn't contain a # character.
tdevformat = '<div align="left">#</div>'
Let me know whether that works so I can commit this to github.
EDIT2:
Updated this in github master & wiki
I have tested this on the default domoticz theme and all changes I make in tdevformat are properly shown in the text device.
eg:

Code: Select all

tdevformat = '<div style="font-size : 8px" align="center">#</div>
results in:
Schermafbeelding 2025-01-26 160331.png
Schermafbeelding 2025-01-26 160331.png (27.93 KiB) Viewed 6311 times
while without formatting, it is shown as:
Schermafbeelding 2025-01-26 160347.png
Schermafbeelding 2025-01-26 160347.png (35.17 KiB) Viewed 6311 times
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
sloeber70
Posts: 17
Joined: Wednesday 08 July 2020 10:59
Target OS: Linux
Domoticz version: latest
Location: Bruges
Contact:

Re: GarbageCalendar (new version) lua scripts

Post by sloeber70 »

Hi,

That is a very good solution !!

I did alter both files and also played a bit with colors and sizes...

my tdevformat line in config :
tdevformat = '<div align="left">#</div>' textformat = '<font color="#40a3ce" size=2em>tdesc: wd dd/mm</font>'

Result :

Dashboard device:
recycle_v2_dashboard.png
recycle_v2_dashboard.png (25.97 KiB) Viewed 6304 times
Utility device:
recycle_v2_utility.png
recycle_v2_utility.png (28.18 KiB) Viewed 6304 times
I am using the machinon theme. I did alter views and the amount of devices shown on the grid... Played with the colors... etc..
But there is one big restriction... For utility devices, the grid is devided into 2 vertical spaces for separation of the icon and the status. So this cannot be changed just like that. I will investigate and try to alter this.

For those who are interested . I've created the icons for the RecycleBE app. I will include the custom image.

Thx!!
Attachments
recycle.zip
(7.65 KiB) Downloaded 5 times
Kind regards,
Sloeber70

Linux 12 Bookworm standard edition
Domoticz latest beta
User avatar
HansieNL
Posts: 960
Joined: Monday 28 September 2015 15:13
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: GarbageCalendar (new version) lua scripts

Post by HansieNL »

@sloeber70 Your icons don't have transparent background. I created icons with transparent background and updated icons.txt. Maybe you like them.
recycle.zip
Recycle! icons (transparent background)
(7.78 KiB) Downloaded 2 times
Blah blah blah
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest