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.

Information about database synchronization, storage, script and others
#5
(11.06.2020, 00:16)Erwin van der Zwart Wrote: Hi,

I was triggered by the request and wanted to see if it was do-able and offcourse as always there is a way and i liked the challenge (:

You need to create sync.lp on the master controller so run the script once in there, now we can request the scheduler data from the main database from another controller.

In the other controllers you need to create a event based script with a trigger or a resident/scheduled script at the desired interval, you also need to create the schedulers and holidays with the exact same names as in the main controller., events can be empty as they are synced anyway.

Events and holidays will by synced from the main controller, all scheduler events and holidays with the same name will be cleared first (after a check that request for data was succesful) and then populated with the data from the main controller. All schedulers events and holidays in the slave controller with another name will stay untouched.

The start/end date from schedulers with the same name as in the main controller will also be syncronised, including the active state. So if you disable the scheduler or events in the main controller, they will be also synced as disabled in the slaves.

Group adrresses for output and disabling the scheduler are not synced so you can attached them to any addresses you like in the slaves.

It works even over the internet, i just uploaded my scheduler events to the LM demo and it was poulated with all events i have at home (:

Here are the 2 files you need:


BR,

Erwin
Hi Erwin,

I'm completing a project where I'm doing a similar task with the exception of changing the scheduler_events.

This is the code I am using to update the dB:
db:update('scheduler_events', { active = 1, start_hour = start_Hour , start_min = start_Min ,  daysofweek = days_Active, holidays =  holidays_Set }, { id = calc_start_ID })

Following this update the values are changed in the scheduler but the event will not trigger.
I have manually changed the start time and it will indeed trigger at this point.
I've also inspected the dB and everything seems right there too.
Any Ideas?

B.W
Reply


Messages In This Thread
RE: Information about database synchronization, storage, script and others - by BrentW - 20.01.2021, 11:43

Forum Jump: