EasyManuals Logo

Embedded Systems LogiMachine5 Power User Manual

Embedded Systems LogiMachine5 Power
254 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #107 background imageLoading...
Page #107 background image
107
6.3.1. Export logs
Example
Once an hour, make CSV file with all objects logs and send to external FTP server with IP

In Scripting -> Scheduled add the script which will run once an hour
Add the following code in Script editor for this particular script.
1.
require('socket.ftp')
2.
3.
-- ftp file
4.
ftpfile=string.format('ftp://ftplogin:ftppassword@192.168.1.11/%s.csv', os.date('%Y-%m-
%d_%H-%M'))
5.
-- get past hour data (3600 seconds)
6.
logtime=os.time() - 60*60
7.
8.
-- list of objects by id
9.
objects ={}
10.
11.
-- objects with logging enabled
12.
query ='SELECT address, datatype, name FROM objects WHERE disablelog=0'
13.
for _, object in ipairs(db:getall(query)) do
14.
objects[tonumber(object.address)]={
15.
datatype=tonumber(object.datatype),
16.
name =tostring(object.name or''),
17.
}
18.
end
19.

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Embedded Systems LogiMachine5 Power and is the answer not in the manual?

Embedded Systems LogiMachine5 Power Specifications

General IconGeneral
BrandEmbedded Systems
ModelLogiMachine5 Power
CategoryController
LanguageEnglish