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.

Read values in scheduled script store in ftp
#23
If you want to send periodical values you can use current object values instead of object logs. In this example all objects with the electricity tag are added to the CSV report.
Code:
buffer = { 'date;name;value' }

objects = grp.tag('electricity')
for _, object in ipairs(objects) do
  logdate = os.date('%Y-%m-%d', math.floor(object.updatetime))
  value = object.value
  if type(value) == 'number' then
    value = tostring(value):gsub('%.', ',')
  end
  buffer[ #buffer + 1 ] = string.format('%s;%s;%s',
    logdate, object.name or '', tostring(value))
end

csv = table.concat(buffer, '\n')
log(csv)
Reply


Messages In This Thread
RE: Read values in scheduled script store in ftp - by admin - 06.05.2021, 06:47

Forum Jump: