Posts: 14
Threads: 5
Joined: May 2023
Reputation:
0
Hi all,
i can try adding scheduler into LM.
This example, there are 3 lamps and 3 sensors. And they a lot of my project in 3 LM. (over 500 objects for scheduler)
how to add schedule each lamp and sensor? One by one ?
Or, Is there a shortcut for scheduler to the object on the page?
Can we automatically add scheduler with a single click, as seen in the picture below?
thanks all you.
Posts: 8125
Threads: 43
Joined: Jun 2015
Reputation:
471
Can be done via a script. This example creates a scheduler for objects from 0/0/1 to 0/0/5.
Code: webrequest = require('webrequest')
for i = 1, 5 do
address = '0/0/' .. i
data = {
object = buslib.encodega(address),
active = 'on',
controlobject = 0,
name = 'Scheduler ' .. address,
start_day = 1,
start_month = 1,
end_day = 31,
end_month = 12,
}
webrequest('schedulers', 'save', { data = data })
end
Posts: 14
Threads: 5
Joined: May 2023
Reputation:
0
Unfortunately this is not suitable for me. Because the addresses do not go in a certain order and the names must also be meaningful. But if it was a visual addition then things would be great. I hope such an option will be added in the future.
Posts: 8125
Threads: 43
Joined: Jun 2015
Reputation:
471
The script can modified to create schedulers for a given tag and use object names as scheduler names. Alternatively a table with group address -> scheduler name mapping can be used to quickly create multiple schedulers.
Posts: 14
Threads: 5
Joined: May 2023
Reputation:
0
(15.07.2024, 06:39)admin Wrote: Can be done via a script. This example creates a scheduler for objects from 0/0/1 to 0/0/5.
Code: webrequest = require('webrequest')
for i = 1, 5 do
address = '0/0/' .. i
data = {
object = buslib.encodega(address),
active = 'on',
controlobject = 0,
name = 'Scheduler ' .. address,
start_day = 1,
start_month = 1,
end_day = 31,
end_month = 12,
}
webrequest('schedulers', 'save', { data = data })
end
how can i add object name for objects from 32/2/1 to 32/2/252.
I don't understand how to use the code below in the code above.
Code: name = grp.find(event.dst).name
i want to use scheduler names as the name of the scheduler.
i added it manually.
Posts: 4986
Threads: 28
Joined: Aug 2017
Reputation:
228
Code: webrequest = require('webrequest')
for i = 1, 252 do
address = '32/2/' .. i
data = {
object = buslib.encodega(address),
active = 'on',
controlobject = 0,
name = grp.find(address).name,
start_day = 1,
start_month = 1,
end_day = 31,
end_month = 12,
}
webrequest('schedulers', 'save', { data = data })
end
------------------------------
Ctrl+F5
Posts: 6
Threads: 1
Joined: Jul 2015
Reputation:
0
I would like to know who do we manage to add sub-items :
- active
- name
- run at (ezg specific time, sunrise, sunset)
- start time
- days of the week (all, Mo, Tu, ... Su)
- week days of the month (all, 1st, 2nd, ...last)
- ...
- value
Posts: 8125
Threads: 43
Joined: Jun 2015
Reputation:
471
Code: webrequest = require('webrequest')
data = {
value = '0', -- value to send
scheduler = 1, -- parent scheduler ID
name = 'new event',
active = 'on', -- 'on' or 'off'
type = '', -- '' (run at specific time), 'sunrise' or 'sunset'
start_hour = 13, -- only for run at specific time
start_min = 0, -- only for run at specific time
offset_hour = -1, -- only for 'sunrise' or 'sunset'
offset_min = 30, -- only for 'sunrise' or 'sunset'
year = 0, -- 0 = all years, specific year otherwise
months = '111111111111', -- Jan to Dec, 1 = on, 0 = off
daysofmonth = '1111111111111111111111111111111', -- 1..31, 1 = on, 0 = off
daysofweek = '1111111', -- Monday to Sunday, 1 = on, 0 = off
dayweeknrs = '111111', -- week 1 to 5 in month, 6th value = Last week of the month, 1 = on, 0 = off
holidays = '', -- '' (don't care), 'y' (run on holidays), 'n' (don't run on holidays)
}
res, err = webrequest('schedulers', 'events-save', { data = data })
log(res, err)
Posts: 14
Threads: 0
Joined: May 2024
Reputation:
0
Hi, i was just wondering how to add entries to the Holiday Schedule via script?
It' the time of the year where it may be cool to create an automatic calculation for Easter etc.
Thanks for your Help!
Posts: 8125
Threads: 43
Joined: Jun 2015
Reputation:
471
Code: webrequest = require('webrequest')
data = {
name = 'new holiday',
type = '', -- '' (specific date) or 'dayweeknr' (day of the week)
day = 1, -- day of the month number
month = 1, -- month number, 1 = Jan, 12 = Dec
year = 0, -- 0 = all years, specific year otherwise
duration = 1, -- duration in days
dayofweek = 1, -- day of the week, 1 = Monday, 7 = Sunday
dayweeknr = 1, -- 1st, 2nd etc day in a month, 6th value = last
}
res, err = webrequest('schedulers', 'holidays-save', { data = data })
log(res, err)
Posts: 16
Threads: 4
Joined: Oct 2023
Reputation:
0
Thanks Admin.
When updating an existing holiday with holidays-save, or an event with events-save, is there a rule that we should send all data elements as the gui seems to do (SE 5500 AC2 v2.1.0), or is it allowed to only send the changed elements?
Cheers
Posts: 8125
Threads: 43
Joined: Jun 2015
Reputation:
471
Should be like this for updating but you need to test it yourself.
- holidays-save: name and type fields are optional, everything else is required
- event-save: active and year fields are required
Posts: 16
Threads: 4
Joined: Oct 2023
Reputation:
0
|