81
1.4.1.
Export logs
Example
Once an hour, make CSV file with all objects logs and send to external FTP server with IP
192.168.1.11, login ‘ftplogin‘, password ‘ftppassword‘.
•
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:[email protected]/%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
inipairs
(
db:getall
(
query
))
do
14.
objects
[
tonumber
(
object.address
)]={
15.
datatype
=
tonumber
(
object.datatype
)
,
16.
name
=
tostring
(
object.name
or
''
)
,
17.
}
18.
end
19.
20.
-- csv buffer
21.
buffer
={
'"date","address","name","value"'
}
Содержание LogicMachine3 Re:actor
Страница 10: ...10 Terminal connection schemes KNX TP...
Страница 12: ...12 24V power supply...
Страница 13: ...13 Analog inputs e g reed contact...
Страница 14: ...14 Analog inputs 0 10V...
Страница 15: ...15 Digital output...
Страница 16: ...16 Resistive sensor input...
Страница 17: ...17 Analog output...
Страница 26: ...26 Make sure that bus status is Online press button in ETS...
Страница 35: ...35 o Then minimize side bar by pressing on left arrow icon to make the map more visible...
Страница 83: ...83 66 if err then 67 alert FTP upload failed s err 68 end...
Страница 107: ...107...
Страница 108: ...108 1 14 Help Documentation for scripting syntaxes is displayed in Help tab...
Страница 122: ...122 4 16 Running processes System running processes can be seen in Status Running processes window...
Страница 126: ...126 Datapoints can be shown also in a way of table which can be later exported as CSV file...
Страница 141: ...141...