11.01.2021, 16:04
(This post was last modified: 11.01.2021, 16:17 by Rauschentofft.)
I am going use scheduled script. Every 6th hour it should read the meters and store it ftp and then send an mail.
Then i want to delete the file after the email is sent.
I tried with this script and made the changes but i got this error:
Error log:
test 11.01.2021 17:16:00
User script:7: attempt to index global 'event' (a nil value)
stack traceback:
User script:7: in main chunk
--Write data to a file in the local FTP
value = grp.getvalue('16/1/1')
logdate = os.date('%Y.%m.%d %H:%M:%S', os.time())
csv = string.format('%q,%q,%q,%q\r\n', logdate, event.dst, grp.alias(event.dst), tostring(value))
log(csv)
file, error = io.open("/home/ftp/outdoor_temp1.txt","a")
log(file,error)
file:write(csv)
file:close()
Then i want to delete the file after the email is sent.
I tried with this script and made the changes but i got this error:
Error log:
test 11.01.2021 17:16:00
User script:7: attempt to index global 'event' (a nil value)
stack traceback:
User script:7: in main chunk
--Write data to a file in the local FTP
value = grp.getvalue('16/1/1')
logdate = os.date('%Y.%m.%d %H:%M:%S', os.time())
csv = string.format('%q,%q,%q,%q\r\n', logdate, event.dst, grp.alias(event.dst), tostring(value))
log(csv)
file, error = io.open("/home/ftp/outdoor_temp1.txt","a")
log(file,error)
file:write(csv)
file:close()