Posts: 41
Threads: 14
Joined: Sep 2022
Reputation:
0
Hello,
I'm trying to make a "reset" function for a series of blind shutters, basically I want to read the actual state, and toggle the command in order to make the shutters move back and forth the actual position.
Everything seems to work fine in the script (I set logs and everything is good) except that shutters don't move
So I wonder, is it possible to use knx commands in a for loop or there is some kind of limitation?
Thanks for your help.
Posts: 4572
Threads: 23
Joined: Aug 2017
Reputation:
206
Share your script first.
------------------------------
Ctrl+F5
Posts: 41
Threads: 14
Joined: Sep 2022
Reputation:
0
Code: tapp_addresses = {"1/3/4",
"1/3/8",
"1/3/16",
"1/3/19",
"1/3/23",
"1/3/27",
"1/3/35",
"1/3/39",
"1/3/43",
"1/3/47",
"1/3/54",
"1/3/55"
}
grp.write("32/1/15", true)
tapp1 = grp.getvalue("1/3/6")
tapp2 = grp.getvalue("1/3/10")
tapp3 = grp.getvalue("1/3/18")
tapp4 = grp.getvalue("1/3/21")
tapp5 = grp.getvalue("1/3/25")
tapp6 = grp.getvalue("1/3/29")
tapp7 = grp.getvalue("1/3/37")
tapp8 = grp.getvalue("1/3/41")
tapp9 = grp.getvalue("1/3/45")
tapp10 = grp.getvalue("1/3/49")
tapp11 = grp.getvalue("1/3/52")
tapp12 = grp.getvalue("1/3/57")
tapp_array = {tapp1,
tapp2,
tapp3,
tapp4,
tapp5,
tapp6,
tapp7,
tapp8,
tapp9,
tapp10,
tapp11,
tapp12,}
for i=1,table.getn(tapp_array) do
if tapp_array[i]>0 then
log(tapp_array[i])
log("devo aprire")
log(tapp_addresses[i])
grp.write(tapp_addresses[i], true)
sleep(1)
else
log(tapp_array[i])
log("devo chiudere")
log(tapp_addresses[i])
grp.write(tapp_addresses[i], false)
sleep(1)
end
end
sleep(5)
tapp1 = grp.getvalue("1/3/6")
tapp2 = grp.getvalue("1/3/10")
tapp3 = grp.getvalue("1/3/18")
tapp4 = grp.getvalue("1/3/21")
tapp5 = grp.getvalue("1/3/25")
tapp6 = grp.getvalue("1/3/29")
tapp7 = grp.getvalue("1/3/37")
tapp8 = grp.getvalue("1/3/41")
tapp9 = grp.getvalue("1/3/45")
tapp10 = grp.getvalue("1/3/49")
tapp11 = grp.getvalue("1/3/52")
tapp12 = grp.getvalue("1/3/57")
tapp_array = {tapp1,
tapp2,
tapp3,
tapp4,
tapp5,
tapp6,
tapp7,
tapp8,
tapp9,
tapp10,
tapp11,
tapp12,}
for i=1,table.getn(tapp_array) do
if tapp_array[i]>0 then
log(tapp_array[i])
log("devo aprire")
log(tapp_addresses[i])
grp.write(tapp_addresses[i], true)
sleep(7)
else
log(tapp_array[i])
log("devo chiudere")
log(tapp_addresses[i])
grp.write(tapp_addresses[i], false)
sleep(7)
end
end
grp.write("32/1/15", false)
Posts: 7720
Threads: 42
Joined: Jun 2015
Reputation:
446
What is the datatype for status objects (1/3/6, 1/3/10 etc)?
Posts: 41
Threads: 14
Joined: Sep 2022
Reputation:
0
For tapp_addresses array 1.008
For tapp_array elements 5.001
Posts: 7720
Threads: 42
Joined: Jun 2015
Reputation:
446
Do you see control objects (1/3/4, 1/3/8 etc) change in the UI when the script executes?
Posts: 41
Threads: 14
Joined: Sep 2022
Reputation:
0
29.03.2023, 10:38
(This post was last modified: 29.03.2023, 11:14 by Ceros2112.)
I can't try it right now but last time I checked yes, I will run some tests later.
By the way, the whole system is up and running with a custom visualization in which the same addresses are controlled with buttons and everything works fine.
I ran a test using an array that contains only one "dummy"group address and it works, I wil run the real test later but I expect that everything will work...otherwise I have no idea
|