Logic Machine Forum
Get data times from Schedulers ! - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8)
+--- Thread: Get data times from Schedulers ! (/showthread.php?tid=1399)



Get data times from Schedulers ! - phongvucba - 17.05.2018

Hi everybody ! I have a small problem, do not know if anyone can do it?
In LM5 there are Schedulers section (located next to the Scripting section). This part, we can manually change the timer (outside the interface into the Schedulers).
As shown in the figure, I now want to get (GET) the data in this region 1, and save it to an object such as 1/1/1. For example, take the data of the time "Start time", get the date "Days of the week".
Who can get this data can show me, with a script? I am very very thank you everyone!



RE: Get data times from Schedulers ! - admin - 17.05.2018

See this post: https://forum.logicmachine.net/showthread.php?tid=686


RE: Get data times from Schedulers ! - phongvucba - 17.05.2018

Thank you for helping me ! I have read and accessed a table as follows:
---------------------------------
* table:
  [first]
   * table:
    [start_hour]
     * number: 12
    [start_min]
     * number: 30
    [id]
     * number: 1
  [2]
   * table:
    [start_hour]
     * number: 21
    [start_min]
     * number: 5
    [id]
     * number: 2
----------------------------------
But I do not know how to get this [start_hour], [start_min], [id] to a KNX address.
For example I want to address: 1/1/1; 1/1/2; 1/1/3
grp.write ('1/1/1', [start_hour])! it does not work.
I was a new person ! hope everyone sympathized.


RE: Get data times from Schedulers ! - Erwin van der Zwart - 18.05.2018

Hi,

Try: (change tablename to the name of your table)
Code:
grp.write ('1/1/1', tablename[1].start_hour)
grp.write ('1/1/2', tablename[1].start_min)
grp.write ('1/1/3', tablename[1].id)

grp.write ('1/1/4', tablename[2].start_hour)
grp.write ('1/1/5', tablename[2].start_min)
grp.write ('1/1/6', tablename[2].id)
BR,

Erwin


RE: Get data times from Schedulers ! - admin - 18.05.2018

You will probably need a scheduled script that runs every minute to catch event updates (if any). Change id from 1 to your event ID if needed:
Code:
id = 1
event = db:getrow('SELECT * FROM scheduler_events WHERE id=?', id)

grp.checkwrite('1/1/1', event.start_hour)
grp.checkwrite('1/1/2', event.start_min)
grp.checkwrite('1/1/3', event.id)