Skip to content

Process

Jos van der Zande edited this page Jun 20, 2023 · 7 revisions

How does it work?

The main script "script_time_garbagecalendar.lua" needs to be stored in the "domoticz/scripts/lua" or "domoticz/scripts/dzvents/scripts" directory which will cause it to be triggered each minute.
The main script will load your personal configuration from "garbagecalendar/garbagecalendarconfig.lua", where you have defined all required information as explained in the Setup Wiki page.
It will read the information from the variable "garbagetype_cfg" table to check for the specified update/notification times defined, and when one of these times is equal to the current time, the following things will happen:

  1. When the garbagetype field contains "reloaddata", a background batchjob will be submitted to update the data without holding up the event system. The retrieved data will be stored in file "garbagecalendar_*modulename*.data" and the retrieval process information in "garbagecalendar_*modulename*_run_webupdate_backgound.log". They will both be located in the directory you specified for "datafilepath". This process will be ran in the foreground immediately in case the "garbagecalendar_*modulename*.data" doesn't exist yet and one of the check times is valid, to ensure the data is there to work with.
  2. The next number of events, as defined with ShowNextEvents, will be merged into a text field, with the format as defined with textformat.
  3. Update the defined Domoticz Text Dummy Device with this formatted text.
  4. When it contains a valid Garbage type and the hour & min are equal to the current time, a notification will be send as specified in the garbagecalendarconfig.lua file.
Clone this wiki locally