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.

Knx commands in a for loop
#3
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)
Reply


Messages In This Thread
Knx commands in a for loop - by Ceros2112 - 29.03.2023, 09:17
RE: Knx commands in a for loop - by Daniel - 29.03.2023, 09:18
RE: Knx commands in a for loop - by Ceros2112 - 29.03.2023, 09:32
RE: Knx commands in a for loop - by admin - 29.03.2023, 10:09
RE: Knx commands in a for loop - by Ceros2112 - 29.03.2023, 10:14
RE: Knx commands in a for loop - by admin - 29.03.2023, 10:23
RE: Knx commands in a for loop - by Ceros2112 - 29.03.2023, 10:38

Forum Jump: