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.

Dynamically change the Scheduled program time parameters from visualization
#1
Hello

I should be able to change the weekly scheduling data from Visu to be able to pilot scenarios, is this possible? I found an example in the forum but it refers only to one day, I would need a weekly schedule, is there the possibility to do it in visu without having to modify the scripts?

BR
Reply
#2
Why don't you create event script and use normal scheduler to trigger it? This way you will have the editing sorted.
------------------------------
Ctrl+F5
Reply
#3
(14.10.2020, 13:57)Daniel. Wrote: Why don't you create event script and use normal scheduler to trigger it? This way you will have the editing sorted.

Hi

I have to use scripted switching at 4 different times of the day, I would like to give the user the possibility to change the times from view, placing them on virtual date / time objects in order to then set the times in the scheduled scripts but I don't know if it is possible.

BR
Reply
#4
You can change the running time for a scheduled script via db queries.
This event script is attached to the time/day object and you need to change 3 to your scheduled script id (see this: https://forum.logicmachine.net/showthrea...0#pid19070):
Code:
id = 3 -- scheduled script id
value = event.getvalue()
params = string.format('%d %d * * *', value.minute, value.hour)
db:update('scripting', { params = params }, { id = id })
script.reloadsingle({ type = 'scheduled' })
Reply
#5
(26.11.2020, 07:35)admin Wrote: You can change the running time for a scheduled script via db queries.
This event script is attached to the time/day object and you need to change 3 to your scheduled script id (see this: https://forum.logicmachine.net/showthrea...0#pid19070):
Code:
id = 3 -- scheduled script id
value = event.getvalue()
params = string.format('%d %d * * *', value.minute, value.hour)
db:update('scripting', { params = params }, { id = id })
script.reloadsingle({ type = 'scheduled' })


Perfect thank's
Reply
#6
(26.11.2020, 07:35)admin Wrote: You can change the running time for a scheduled script via db queries.
This event script is attached to the time/day object and you need to change 3 to your scheduled script id (see this: https://forum.logicmachine.net/showthrea...0#pid19070):
Code:
id = 3 -- scheduled script id
value = event.getvalue()
params = string.format('%d %d * * *', value.minute, value.hour)
db:update('scripting', { params = params }, { id = id })
script.reloadsingle({ type = 'scheduled' })

Wow this looks very simple, is there a manual for things like this?
it is working for me, but im wondering how you know this.

i made next script with knowing how to use it.
Code:
Airco_status = event.getvalue()

if Airco_status == true  then
id = 110 -- scheduled script id
params = string.format('5 * * * *')            --starts every 5 minutes
db:update('scripting', { params = params }, { id = id })
script.reloadsingle({ type = 'scheduled' })
else
        
id = 110 -- scheduled script id
params = string.format('* 1 * * *')            --starts every hour
db:update('scripting', { params = params }, { id = id })
script.reloadsingle({ type = 'scheduled' })
end
Reply
#7
Internal functions are not documented because it's easy to use them incorrectly leading to some system parts not working at all.
Reply
#8
oké i understand, thanks for the answer.
but it's communicate to some people, who have the knowledge how to work with a LM? or just to trail and error to find out?

just interesting how people know these things.
im just a beginner and curious
Reply
#9
Well they are pretty much all available in the different forum threats..

So read and learn (:
Reply
#10
I'm looking for a script that turn on an off a schedule.
I know about the option with a groupadress to enable and disable it, but if it is possible i would do it with a script.
Reply
#11
What for?
https://forum.logicmachine.net/showthrea...17#pid1917
------------------------------
Ctrl+F5
Reply
#12
Thanks Daniel, but it looks like it don't work.

Why, i would directly control the scheduled with more scripts.
Reply
#13
Map a virtual object to scheduler on/off an use grp.update. You can use object name like "Scheduler A on/off" instead of a group address to make the code more readable.
Reply
#14
I'm afraid i was wrong.
I meant to asking if there a script like
Code:
id = 3 -- scheduled script id
value = event.getvalue()
params = string.format('%d %d * * *', value.minute, value.hour)
db:update('scripting', { params = params }, { id = id })
script.reloadsingle({ type = 'scheduled' })

But not changing the time, but just enable and disable it?

I think I have to change line 4, but don't know what to use.
------------------------------------------------------------------------------
I was still trying to solve my problem, but he always set the Scheduled script off, never on, also when the input value was true

Code:
verl_aanrecht_TM = grp.getvalue('1/4/5')            --'0 verl. aanrechtblad (tm)'

if verl_aanrecht_TM == true then
script.set('12.01 Check if Light can turn Off', enable)
elseif verl_aanrecht_TM == false  then
script.set('12.01 Check if Light can turn Off', disable)
end

Someone who knows what i do wrong?
Reply
#15
Use this:
Code:
state = grp.getvalue('1/4/5')
script.set('12.01 Check if Light can turn Off', state)

In your case enable/disable variables are not defined (nil) so both script.set calls disable the script.
Reply
#16
Thank you, at my side it wasn't working, maybe because my object '1/4/5' was a switch 01.001 data type?

I changed it to
Code:
if state == true
then script.set('12.01 Check if Light can turn Off', true)
else
then script.set('12.01 Check if Light can turn Off', false)
end
to get this working.
Reply
#17
grp.getvalue returns true/false for all Boolean sub-datatypes so it does not matter.
Reply
#18
I had that idea too, but it looks like it didn't work.
Reply
#19
I have a  scheduled script which changes the value of a group address to 0 and then I have a second scheduled script which puts the value back to 1. The first script has ID=112 and the second 113.

Now, I want to change the time that both scripts are performed, using a script. I want that the first script is performed at 23 o'clock and the second script at 24h. I changed the code to:

Code:
id = 112 -- scheduled script id
value = event.getvalue()
params = string.format('00 23 * * *', value.minute, value.hour)
db:update('scripting', { params = params }, { id = id })
script.reloadsingle({ type = 'scheduled' })
--
id = 113 -- scheduled script id
value = event.getvalue()
params = string.format('00 24 * * *', value.minute, value.hour)
db:update('scripting', { params = params }, { id = id })
script.reloadsingle({ type = 'scheduled' })

But, nothing is changing. What am I doing wrong?
Reply
#20
(29.02.2024, 19:26)Amelie Wrote: I have a  scheduled script which changes the value of a group address to 0 and then I have a second scheduled script which puts the value back to 1. The first script has ID=112 and the second 113.

Now, I want to change the time that both scripts are performed, using a script. I want that the first script is performed at 23 o'clock and the second script at 24h. I changed the code to:

Code:
id = 112 -- scheduled script id
value = event.getvalue()
params = string.format('00 23 * * *', value.minute, value.hour)
db:update('scripting', { params = params }, { id = id })
script.reloadsingle({ type = 'scheduled' })
--
id = 113 -- scheduled script id
value = event.getvalue()
params = string.format('00 24 * * *', value.minute, value.hour)
db:update('scripting', { params = params }, { id = id })
script.reloadsingle({ type = 'scheduled' })

But, nothing is changing. What am I doing wrong?

I think you use it on a wrong way.
Go to scripting and then Scheduled, create a new script here, fill in when it has to run.
* = every minutes/hours
not forget to activate.
click on editor (green note on the right side) and put there the script you want to run, what you want to set to 0 and set to 1, not the script of above here.
not sure what you want but 0 and 1 are not allowed for a Boolean, so maybe you have to change it in true or false, but this you can try when you run the script manual.

the script in this topic is for changing a scheduled script, for when it has to run. (the time).
Reply


Forum Jump: