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 whether you accept or reject these cookies being set.

Create Groupadress on runtime
#1
I have a problem with the following script.
It works fine, up until the point where it should write data to the KNX bus.
But it doesn't do that, but it doesn't give an error either.
Has anybody a clue what I'm doing wrong here?


for i = 1, 8, 1 do
  log (data.daily[i])
 
  dailyResult = {}    -- new array

  dailyResult[0] = data.daily[i].humidity
  dailyResult[1] = data.daily[i].uvi
  dailyResult[2] = data.daily[i].wind_gust
  dailyResult[3] = data.daily[i].pressure
  dailyResult[4] = data.daily[i].moonrise
  dailyResult[5] = data.daily[i].dt
  dailyResult[6] = data.daily[i].feels_like.day
  dailyResult[7] = data.daily[i].feels_like.night
  dailyResult[8] = data.daily[i].feels_like.eve
  dailyResult[9] = data.daily[i].feels_like.morn
  dailyResult[10] = data.daily[i].dew_point
  dailyResult[11] = data.daily[i].rain
  dailyResult[12] = data.daily[i].sunrise
  dailyResult[13] = data.daily[i].wind_speed
  dailyResult[14] = data.daily[i].pop
  dailyResult[15] = data.daily[i].moon_phase
  dailyResult[16] = data.daily[i].temp.day
  dailyResult[17] = data.daily[i].temp.night
  dailyResult[18] = data.daily[i].temp.morn
  dailyResult[19] = data.daily[i].temp.max
  dailyResult[20] = data.daily[i].temp.eve
  dailyResult[21] = data.daily[i].temp.min
  dailyResult[22] = data.daily[i].sunset
  dailyResult[23] = data.daily[i].wind_deg
  dailyResult[24] = data.daily[i].weather[1].main
  dailyResult[25] = data.daily[i].weather[1].id
  dailyResult[26] = data.daily[i].weather[1].icon
  dailyResult[27] = data.daily[i].weather[1].description
  dailyResult[28] = data.daily[i].clouds
  dailyResult[29] = data.daily[i].moonset

  for k = 0, 29, 1 do
    grpAdress = '31/' .. tostring(i) .. '/' .. tostring(k)
    log(grpAdress)
    grp.checkwrite(grpAdress,dailyResult[k])
  end
end
Reply
#2
Have you created the required objects beforehand?
Reply
#3
(28.04.2021, 09:54)admin Wrote: Have you created the required objects beforehand?

Yes they are created.
Reply
#4
Log what checkwrite returns:
Code:
res, err = grp.checkwrite(grpAdress,dailyResult[k])
log(grpAdress, res, err)

Your first loop goes up to 8, while the middle group address part cannot be larger than 7. So 31/8/X becomes 31/0/X.
Reply


Forum Jump: