This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Scheduled script: reliability of operation
#1
Dear all,
I need set a scheduled script which runs only one time at a specific time the first day of the month. Script runs to reset a value of a group address of a energy data consumption. 

In case for any reason (example LM is off in that moment) script can not be done, how can manage the script in order to be sure to erase the data?

Thank you for your suggestion.

Regards.

BR
Reply
#2
Just set minute, hour and day of the month as you need. All months and every day of the week.
------------------------------
Ctrl+F5
Reply
#3
(10.12.2024, 10:23)Daniel Wrote: Just set minute, hour and day of the month as you need. All months and every day of the week.hI dN

Thank you David but probably I have not been cleared.

Group address I want to erase is related to energy consumption energy. I mean that the first day of the month its value is 0 and after 1 month energy consumption will show.

This is the reason why script to erase the data must run just for one time at the beginning of the month. 

Have you any idea?

Thanks.
Reply
#4
Set the scheduled script to run as often as needed. Add this code block so the reset procedure runs only once per month.
Code:
curr_date = tonumber(os.date('%Y%m'))
prev_date = storage.get('reset_date', 0)

if prev_date < curr_date then
  log('reset')
  storage.set('reset_date', curr_date)
end
Reply


Forum Jump: