Sunteți pe pagina 1din 109

HomeLYnk

Product Manual




2
Contents
1 Quick start up guide ........................................................................................................................ 6
1.1 Default configuration .............................................................................................................. 8
1.2 Discover HomeLYnk IP address ............................................................................................. 1
1.! "irm#are upgrade ................................................................................................................. 11
1.$ HomeLYnk for %&'()I* net#ork configuration management #it+ ),-! ............................. 12
1.. %&' and IP /outer settings ................................................................................................... 12
1.6 0reate visuali1ation for iPad(P0 ............................................................................................ 1!
1.6.1 Import o23ects ............................................................................................................... 1!
1.6.2 0reate 42uilding(floor5 structure and add o23ects to t+e map .................................... 1$
1.6.! 6dd o23ects to ne#l7 created visuali1ation map .......................................................... 16
1.6.$ Launc+ing visuali1ation on -martp+one device 8iPod in t+is case9............................... 16
1.6.. Launc+ing vis. on P0: ,a2let or an7 ot+er touc+ device #it+ large screen................... 1;
2 6dvanced guide ............................................................................................................................. 18
2.1 <tilities .................................................................................................................................. 18
2.1.1 Import )-" file ............................................................................................................... 18
2.1.2 /eset (clean=up ............................................................................................................. 18
2.1.! "actor7 reset ................................................................................................................. 18
2.1.$ Date and time................................................................................................................ 1>
2.1.. Install updates ............................................................................................................... 1>
2.1.6 *ackup ........................................................................................................................... 1>
2.1.; /estore .......................................................................................................................... 1>
2.1.8 0onfiguration ................................................................................................................ 1>
2.1.> -7stem ........................................................................................................................... 21
2.2 ?23ects .................................................................................................................................. !!
2.2.1 ?23ect parameters ........................................................................................................ !$
2.2.2 -et value ........................................................................................................................ !$
2.2.! ?23ect visuali1ation parameters ................................................................................... !.
2.2.$ 0ustom te@t value ......................................................................................................... !6
2.2.. ?23ect control 2ar ......................................................................................................... !6
2.2.6 "ilter o23ects.................................................................................................................. !6
2.! ?23ect Logs ............................................................................................................................ !;
2.$ -c+edulers ............................................................................................................................. !8
2.$.1 6dd ne# sc+eduler........................................................................................................ !8
2.$.2 -c+eduler events ........................................................................................................... !>
2.$.! -c+eduler +olida7s ........................................................................................................ !>

!
2.. ,rend logs .............................................................................................................................. $
2...1 6dd ne# trend log ......................................................................................................... $
2.6 Ais. structure ......................................................................................................................... $1
2.6.1 Levels ............................................................................................................................. $1
2.6.2 -econd level .................................................................................................................. $1
2.6.! Plans .............................................................................................................................. $2
2.6.$ La7out ............................................................................................................................ $2
2.6.. Bidgets ......................................................................................................................... $!
2.6.6 Aisuali1ation structure e@ample .................................................................................... $$
2.6.; Plan ................................................................................................................................ $$
2.6.8 La7out ............................................................................................................................ $.
2.6.> Bidget ........................................................................................................................... $.
2.; Aisuali1ation .......................................................................................................................... $6
2.;.1 -tructure ....................................................................................................................... $6
2.;.2 Aisuali1ation Cap .......................................................................................................... $;
2.;.! Plan )ditor ..................................................................................................................... $;
2.;.$ ?23ect ............................................................................................................................ $8
2.;.. Plan link ......................................................................................................................... .
2.;.6 0amera .......................................................................................................................... .
2.;.; Drap+............................................................................................................................. .2
2.;.8 ,e@t la2el ....................................................................................................................... .2
2.;.> Image ............................................................................................................................. .$
2.;.1 Dauge ............................................................................................................................ .$
2.;.11 "rame ............................................................................................................................ ..
2.8 Ais. grap+ics .......................................................................................................................... .6
2.> -cripting ................................................................................................................................ .;
2.>.1 )vent 2ased ................................................................................................................... .8
2.>.2 /esident ........................................................................................................................ .>
2.>.! -c+eduled ...................................................................................................................... .>
2.>.$ <ser li2raries ................................................................................................................. 6
2.>.. 0ommon functions ........................................................................................................ 6
2.>.6 -tart=up script ............................................................................................................... 6
2.>.; ,ools .............................................................................................................................. 6
2.>.8 Deneral scripting description ........................................................................................ 61
2.>.> -cript )ditor ................................................................................................................... 62
2.1 6lerts ..................................................................................................................................... 6$

$
2.11 Logs ....................................................................................................................................... 6.
2.12 )rror Log ................................................................................................................................ 66
2.1! Help ....................................................................................................................................... 66
! Cod2us(/-=$8. ............................................................................................................................ 6;
!.1 0+aracteristics ....................................................................................................................... 6;
!.1.1 Cod2us /,< Interface .................................................................................................. 6;
!.1.2 Cod2us ,0P Interface ................................................................................................... 68
!.2 0onfiguration commands ...................................................................................................... 68
!.! "unction codes 8..12;9 ......................................................................................................... ;1
!.$ Caster mode functions ......................................................................................................... ;8
!.. -lave mode functions ............................................................................................................ ;>
$ /-=2!2 ........................................................................................................................................... 8
$.1 0+aracteristics ....................................................................................................................... 8
$.2 0onfiguration commands ...................................................................................................... 8
. <-* 2. .......................................................................................................................................... 81
..1 0+aracteristics ....................................................................................................................... 81
..2 0onfiguration commands ...................................................................................................... 81
6 L<6 E Programming Language ...................................................................................................... 8!
6.1 ?23ect functions .................................................................................................................... 8!
6.2 Droup communication functions .......................................................................................... 8!
6.! /eturned o23ect functions .................................................................................................... 8$
6.$ Data t7pe functions ............................................................................................................... 8$
6.. Data t7pes ............................................................................................................................. 8$
6.6 Data storage functions .......................................................................................................... 8.
6.; 6lert functions ....................................................................................................................... 86
6.8 Log functions ......................................................................................................................... 8;
6.> ,ime functions ...................................................................................................................... 8;
6.1 -tring functions ..................................................................................................................... 88
6.11 Input and output functions ................................................................................................... >!
6.12 -cript control function .......................................................................................................... >!
6.1! 0onversions ........................................................................................................................... >!
6.1$ *it operators ......................................................................................................................... >$
6.1. Input and output facilities ..................................................................................................... >$
6.16 Cat+ematical functions ........................................................................................................ >.
6.1; ,a2le manipulation ............................................................................................................... >;
6.18 ?perating s7stem facilities .................................................................................................... >8

.
6.1> )@tended function li2rar7 ..................................................................................................... >>
; -cript e@amples ........................................................................................................................... 11
;.1 *inar7 filter .......................................................................................................................... 11
;.2 *inar7 gate #it+ 2it gate ..................................................................................................... 11
;.! Date #it+ 27te gate............................................................................................................. 11
;.$ ?r = Port 82 in 1 ut9 ............................................................................................................ 12
;.. 6nd = Port 82 in 1 ut9 .......................................................................................................... 12
;.6 ?r = Port 8. in 2 ut9 ............................................................................................................ 1!
;.; 6nd = Port 8. in 2 ut9 .......................................................................................................... 1!
;.8 ,elegram transformer 8(1 2it to =2.. 27te9 .................................................................... 1$
;.> 0ompare value .................................................................................................................... 1$
;.1 -ave -cene 1 8/D* value9 .................................................................................................... 1.
;.11 0all -cene 1 8/D* value ....................................................................................................... 1.
;.12 H7steresis ............................................................................................................................ 1.
;.1! /andom 27te value ............................................................................................................. 1.
;.1$ 07clic /epeater 8dela7 6 seconds9 ..................................................................................... 16
;.1. -tepper ( 0ounter Positive input ........................................................................................ 16
;.16 -tepper ( 0ounter &egative input ....................................................................................... 16
;.1; /eset -tepper ( 0ounter ..................................................................................................... 16
;.18 ?n Dela7 82utton set to Fupdate onl7 internalF9 ................................................................ 1;
;.1> 6verage ............................................................................................................................... 1;
;.2 ?ff Dela7 ............................................................................................................................. 1;
;.21 -tare case timer 8#it+ varia2le time o23ect9 ....................................................................... 1;
;.22 Aalue memor7 8#rite to storage9 ........................................................................................ 1;
;.2! Aalue memor7 8get from storage9 ...................................................................................... 1;
;.2$ Cultiple@er 81 in ( ! out9 &oticeG ?23ect t7pe needs to 2e t+e same ................................. 1;
;.2. /ound function using 0ommon functions .......................................................................... 1;
;.26 Brite data and time to %&' group addresses .................................................................... 18
;.2; Brite data to groups #it+ tags ........................................................................................... 18



Quick start up guide


6
1 Quick start up guide

Count t+e device on DI& rail

0onnect t+e 2us ca2les 8%&': Cod*us: /-2!29 or flas+ drive

0onnect 2$A po#er suppl7 to t+e device
82$A D0 conductor to t+e red clamp: D&D conductor to t+e 2lue clamp9

/ecommended accessor7 = po#er suppl7 /)D(2$A D0(:$6: article &o.G MTN693003

0onnect )t+ernet ca2le from t+e P0.

0+ange t+e IP address of t+e computer to e.g. 1>2.168..>: mask 2...2...2...

/un Doogle 0+rome or Co1illa "irefo@ 8if ?- Bindo#s9 -afari 8if i?-9 and go for
1>2.168..1.

Note Internet )@plorer is not supported.


















PC/Tablet visua
designed #it+ visuali1ation maps #it+ o23ects:
1HH9.
Smartphone visualization
Aisuali1ation designed for iP+one(iPod(iPad(6ndroid sm
small resolution9. 6ll o23ects #+ic+ are added in
visi2le in t+is -martp+one visuali1ation 8if t+ere is no

Scheduler
manage sc+eduler tasks: for e@ample: specif7 t+ermostat values depending on t+e da7 of t+e
#eek: time and +olida7s

Trends
a2ilit7 to compare data fr

Con!igurator
under t+is icon. 6ccess is onl7 for admin user.

Quick start up guide

;

PC/Tablet visualization E <nder t+is icon is a visuali1ation
designed #it+ visuali1ation maps #it+ o23ects: for P0: iPads: 6ndroid ta2lets 8prefera2l7
Smartphone visualization E<nder t+is icon navigate is a
Aisuali1ation designed for iP+one(iPod(iPad(6ndroid smartp+ones( 6ndroid ta2lets8;HH and
small resolution9. 6ll o23ects #+ic+ are added in HomeLYnk configurator 27 default are
visi2le in t+is -martp+one visuali1ation 8if t+ere is no Hide in Smartphone
Scheduler E ,+is Icon navigate to user friendl7 interface for end
manage sc+eduler tasks: for e@ample: specif7 t+ermostat values depending on t+e da7 of t+e
#eek: time and +olida7s
Trends E ,+is icon navigate to user friendl7 displa7 of ,rend logs #it+ t+e
a2ilit7 to compare data from 2 different dates. It can displa7 trends up to 1 7ears.
Con!igurator E 6ll programming and configurations can 2e performed
under t+is icon. 6ccess is onl7 for admin user.

<nder t+is icon is a visuali1ation
for P0: iPads: 6ndroid ta2lets 8prefera2l7
<nder t+is icon navigate is a
artp+ones( 6ndroid ta2lets8;HH and
configurator 27 default are
Hide in Smartphone option ena2led9.
friendl7 interface for end=user to
manage sc+eduler tasks: for e@ample: specif7 t+ermostat values depending on t+e da7 of t+e
,+is icon navigate to user friendl7 displa7 of ,rend logs #it+ t+e
om 2 different dates. It can displa7 trends up to 1 7ears.
6ll programming and configurations can 2e performed
Quick start up guide


8
1"1 #e!ault con!iguration

HomeLYnk Configurator

Login Pass#ord
admin admin
PC/Tablet visualization/Smartphone
visualization( -c+edulers( ,rends

6ccess rig+t Login Pass#ord
/ead=onl7G
BriteG
Brite I admin level
$is$ie%
$iscontrol
$isadmin

$is$ie%
$iscontrol
$isadmin
IP address on L6& 19&"16'"0"10
&et#orks mask on L6& 2...2...2...
C(ange )P settings

In Configurator Utilities System
Network nterfaces #indo# click on t+e
specific interface to c+ange t+e IP settings.










ProtocolE -pecific protocol used for addressing
Static P E -tatic IP address. *7 defaul
!"CP E DH0P protocol used to fetc+ IP configuration.
P address IP address received from t+e DH0P server. ,+is field appears onl7 if t+e IP address
is given or else it is +idden.
Network mask &et#ork mask. *7 default 2...2...2... 8(2$9
#ateway P Date#a7 IP address
!NS server D&- server IP address
$TU Ca@imum ,ransmission <nit:
in t+e communication protocol. *7 default 1.
B+en c+anges are done: t+e follo#ing icon appears
s+ould 2e applied for c+anges to take effect. +omeLYnk #ill automaticall7 re2oot after t+ese
c+anges are applied

Quick start up guide

>
-pecific protocol used for addressing
-tatic IP address. *7 default 1>2.168..1
DH0P protocol used to fetc+ IP configuration.
IP address received from t+e DH0P server. ,+is field appears onl7 if t+e IP address
is given or else it is +idden.
&et#ork mask. *7 default 2...2...2... 8(2$9
Date#a7 IP address
D&- server IP address
Ca@imum ,ransmission <nit: t+e largest si1e of t+e packet #+ic+ could 2e passed
in t+e communication protocol. *7 default 1.
B+en c+anges are done: t+e follo#ing icon appears in t+e top
s+ould 2e applied for c+anges to take effect. +omeLYnk #ill automaticall7 re2oot after t+ese

IP address received from t+e DH0P server. ,+is field appears onl7 if t+e IP address
t+e largest si1e of t+e packet #+ic+ could 2e passed
in t+e top=rig+t corner. ,+is
s+ould 2e applied for c+anges to take effect. +omeLYnk #ill automaticall7 re2oot after t+ese
Quick start up guide


1
1"& #isco$er HomeLYnk )P address

*indo%s PC

)asiest #a7 is 27 using t+e utilit7 +er$ice
,ro%ser #+ic+ can 2e do#nloaded +ereG

+ttpG((marknelson.us(211(1(2.(dns=service=
discover7=on=#indo#s(

+ttpG((marknelson.us(attac+ments(211(2on3o
ur=#indo#s(-ervice*ro#ser)@e.1ip

&oteG Cake sure t+at 7our fire#all is not
2locking ,0P connection port G2$8



Linu- PC


,+e utilit7 called .$a(i: can 2e
do#nloaded +ereG
###.ava+i.org








.ndroid


,+e freel7 availa2le app called /eroCon!
,ro%ser: can 2e do#nloaded in Pla StoreG

+ttpG((pla7.google.com(store(apps(detailsJidKc
om.grokkt.andriod.2on3ourL+lKen









Quick start up guide


11
i0+1Mac 0+


,+e freel7 availa2le app called #isco$er2
3on4our 3ro%ser can 2e do#nloaded in !pp
StoreG
+ttpsG((itunes.apple.com(en(app(discover7=
2on3our=2ro#ser(id!.$$11;JmtK8


"or iPad install t+e iP+one(iPod version of t+e
utilit7.







1"3 5irm%are upgrade
Note *efore eac+ upgrade please 2ackup t+e visuali1ation: scripts and o23ect in Configurator
Utilities %ackup6 as t+e data2ase is cleaned during t+e upgrade. During t+e upgrade t+e device
#ill not respond as it #ill 2e re2ooting.
Note 6fter eac+ upgrade: it is strongl7 recommended to clean t+e 2ro#ser cac+e.
<se #e2 2ro#ser to perform upgrade of t+e soft#are of +omeLYnk. "irm#are is availa2le in a form
of images and can 2e do#nloaded from t+e support page of -) office (Planet tool"

Complete s2stem upgrade

Configurator Utilities System System
Upgrade firmware












Quick start up guide


12
1"7 HomeLYnk !or 8N91:), net%ork con!iguration management %it( :T+3
In order to use HomeLYnk #it+ %&'net(IP functionalit7 and to program #it+ ot+er %&' 2us devices:
t+e device s+ould 2e added into t+e &TS Connection $anager"

&'tras (ptions Communication
Configure interfaces

Put some freel7 c+osen "ame for t+e
connection
0+oose Type ; )N*net/P
Press +escan 2utton and t+en c+oose from t+e
drop do#n menu found HomeLYnk
Press ()
*ack in (ptions Communication #indo#
select ne#l7 created interface as
Communication nterface from t+e drop=do#n
menu.
,o test t+e communication #it+ ),-: press Test
2utton


Cake sure t+at 2us status is ?nline E press
2utton in ),-.






1"< 8N9 and )P =outer settings

%&' specific configuration is located in
Configurator Utilities System Network
)N* connection

















Quick start up guide


1!
>eneral ta3
$ode
TP#$!%T
&'(net/'P Tunneling
&'(net/'P %outing
%&' connection mode. +omeLYnk +as ,P<6/, interface 27 default 2uilt=in.
Parameter %&' corresponding interface in ?- of t+e s7stem
)N* address %&' p+7sical address of t+e device
)N* P features <se t+is device #it+ %&' IP features e.g. for %&'net(IP net#ork configuration
$ulticast interface Culticast interface can 2e used #+en sending %&' telegrams to
ot+er %&' net#orks over <DP(IP
$ulticast P Culticast IP address
$a'imum telegrams in ,ueue 0ount of ma@imum telegrams in t+e Mueue
Note If no %&' ,P is connected to t+e device: +outing mode s+ould 2e used so t+at t+e group
addresses can 2e updated correctl7. If t+e +outing mode is used: Parameter field s+ould 2e left
empt7. -7stem s+ould 2e re2ooted 8System +eboot9 after eac+ setting c+ange in )"* connection.

1"6 Create $isuali?ation !or iPad1PC
1"6"1 )mport o34ects


0omplete ),- pro3ect generate .)-"N file from
),- via
5ile :-tract data &'port to 0PC ser$er
Import N.)-" file to
Con!igurator Utilities mport &S- file
















?r connect +omeLYnk to t+e 2us and it #ill
detect o23ects automaticall7 in +b,ects ta2 once
t+e7 are activated. ,+is option is
)na2led(Disa2led Con!igurator @tilities
Con!iguration #isco$er ne% o34ects"
?23ects can 2e added manuall7 as #ell.




1"6"& Create A3uilding1!loorB structure and add o34ects to t(e map


Do to Con!igurator .is/structure
Ais. -tructure allo#s creating all 2uildings levels
and visuali1ations plans. 6dditionall7 it can
create La7outs and Bidgets for visuali1ation
plans.

-tarting ne# pro3ects: onl7 La2outs and
*idgets folders are visi2le. 6dding ne# level
allo#s defining specific Plan of OflatH. La2outs
and *idgets are additional tools #+ic+ are not
mandator7 for 2asic visuali1ationsP can define
and implemented in man7 ot+er Plans"

Quick start up guide

1$
?r connect +omeLYnk to t+e 2us and it #ill
ta2 once
@tilities








Create A3uilding1!loorB structure and add o34ects to t(e map
Ais. -tructure allo#s creating all 2uildings levels
lans. 6dditionall7 it can
create La7outs and Bidgets for visuali1ation
folders are visi2le. 6dding ne# level
La2outs
e not
mandator7 for 2asic visuali1ationsP can define

Le$els
,o add ne# Level press at
name: additional levels can 2e added later.




+econd le$el
If additional levels are needed press on








-elect 6dd second level and provide name and sort order.
)ac+ level can 2e duplicated #it+ su2levels and plans 27 pressing duplicate
icon ne@t to t+e level.

" Cain level usuall7 is t+e pro3ect


ne@t to t+e main level
-elect 6dd second level and provide name and sort order.
)ac+ level can 2e duplicated #it+ su2levels and plans 27 pressing duplicate

Plans
,o add Plans press on ne@t to a level und
#+ic+ anot+er plan is to 2e added and select
6dd plan.


Name &ame of t+e plan
0ayout La7out for t+e plan. 6ll
t+e plan including 2ackground color and plan image if t+e7 are not
de
PC/Tablet visualization 1Show2 Show and make default2 "ide3
Aisi2ilit7 for t+is particular plan in P0(,a2let visuali1ation
Smartphone visualization 1Show2 Show and make default2 "ide3
Aisi2ilit7 for t+is particular plan in -martp+one
%ackground image -elect 2ackground previousl7 added to Ais. grap+ics
#
%ackground color 0+oose 2ackground color of t+e plan
+epeat background image ,o s+o# t+e image once or repeat it and fill t+e #+ole plan
Sort order -ort order for t+e plan: t+is is dependent on #+ere t+e particular
plan is located on t+e specific level
4dmin only access )na2le admin onl7 access for t+e floor 8visadmin user9
Note )ac+ Plan can 2e duplicated toget+er #it+ all components on a pl
ne@t to t+e plan

Quick start up guide

1.
ne@t to a level under
#+ic+ anot+er plan is to 2e added and select





















&ame of t+e plan
La7out for t+e plan. 6ll +b,ects from t+e La7out #ill 2e duplicated on
t+e plan including 2ackground color and plan image if t+e7 are not
defined separatel7.
1Show2 Show and make default2 "ide3
Aisi2ilit7 for t+is particular plan in P0(,a2let visuali1ation
1Show2 Show and make default2 "ide3
Aisi2ilit7 for t+is particular plan in -martp+one visuali1ation
-elect 2ackground previousl7 added to Ais. grap+ics
#- 'mages/(ackgrounds
0+oose 2ackground color of t+e plan
,o s+o# t+e image once or repeat it and fill t+e #+ole plan
-ort order for t+e plan: t+is is dependent on #+ere t+e particular
plan is located on t+e specific level
)na2le admin onl7 access for t+e floor 8visadmin user9
)ac+ Plan can 2e duplicated toget+er #it+ all components on a plan 27 pressing duplicate icon
from t+e La7out #ill 2e duplicated on
t+e plan including 2ackground color and plan image if t+e7 are not
Aisi2ilit7 for t+is particular plan in P0(,a2let visuali1ation
visuali1ation
-elect 2ackground previousl7 added to Ais. grap+ics
,o s+o# t+e image once or repeat it and fill t+e #+ole plan
-ort order for t+e plan: t+is is dependent on #+ere t+e particular
)na2le admin onl7 access for t+e floor 8visadmin user9
an 27 pressing duplicate icon

1"6"3 .dd o34ects to ne%l2 created $isuali?ation map

Do to Con!igurator Cisuali?ation
6fter t+e Level and planHs structure are defined in
.isualization ta2. 0ontrolled and monitored o23ects can 2e added and managed in t+is section. *ot+
t+e side 2ars can 2e minimi1ed 27 pressing t+e left(rig+t arro# icon #+ic+ #ill make t+e map appear
more visi2le especiall7 on small displa7s.









)@isting o23ects can 2e added to t+e map 27 clicking on
?nce t+e o23ect parameters are defined: press
#ill appear. ,+is o23ect can 2e moved to t+e desired location 2ut #+ilst in editing mode
#ill not #ork. B+en all t+e necessar7 o23ects are added: press
t+at t+e o23ects can 2e visuali1ed.
1"6"7 Launc(ing $isuali?ation on +martp(one de$ice DiPod in t(is caseE
Cake sure t+e iPod is connected #irelessl7
E #ireless router9.

In t+e 2ro#ser enter HomeLYnkHs IP 8default 1>2.168..19.

0lick on t+e -martp+one
(s+ortcut in t+e iPod.









Quick start up guide

16
.dd o34ects to ne%l2 created $isuali?ation map
Cisuali?ation
6fter t+e Level and planHs structure are defined in .is/ structure ta2: it can 2e visuali1ed in
olled and monitored o23ects can 2e added and managed in t+is section. *ot+
t+e side 2ars can 2e minimi1ed 27 pressing t+e left(rig+t arro# icon #+ic+ #ill make t+e map appear
more visi2le especiall7 on small displa7s.
to t+e map 27 clicking on Unlock current floor plan
?nce t+e o23ect parameters are defined: press !dd ne0 ob,ect 2utton and a ne#l7 created o23ect
#ill appear. ,+is o23ect can 2e moved to t+e desired location 2ut #+ilst in editing mode
B+en all t+e necessar7 o23ects are added: press Save and reload floor plan
t+at t+e o23ects can 2e visuali1ed.
Launc(ing $isuali?ation on +martp(one de$ice DiPod in t(is caseE
Cake sure t+e iPod is connected #irelessl7 to t+e HomeLYnk 8t+roug+ separate access point
In t+e 2ro#ser enter HomeLYnkHs IP 8default 1>2.168..19.
0lick on t+e -martp+one visualization icon . -ave t+e application as permanent

ta2: it can 2e visuali1ed in t+e
olled and monitored o23ects can 2e added and managed in t+is section. *ot+
t+e side 2ars can 2e minimi1ed 27 pressing t+e left(rig+t arro# icon #+ic+ #ill make t+e map appear
plan for editing 2utton.
2utton and a ne#l7 created o23ect
#ill appear. ,+is o23ect can 2e moved to t+e desired location 2ut #+ilst in editing mode t+e o23ect
Save and reload floor plan 2utton so
to t+e HomeLYnk 8t+roug+ separate access point
. -ave t+e application as permanent

1"6"< Launc(ing $is" on PC6 Ta3let or an2 ot(er touc( de$ice %it( large screen

Cake sure t+e P0(,a2let device is a2le to access HomeLYnk and enter itHs IP in t+e 2ro#ser
8default 1>2.168..19.
0lick on t+e P0(,a2let visualization

,+en minimi1e side 2ar 27 pressing on left







Quick start up guide

1;
s" on PC6 Ta3let or an2 ot(er touc( de$ice %it( large screen
Cake sure t+e P0(,a2let device is a2le to access HomeLYnk and enter itHs IP in t+e 2ro#ser

visualization and enter t+e 4plan5 7ou #ant to see.
,+en minimi1e side 2ar 27 pressing on left=arro# icon to make t+e map more visi2le.

s" on PC6 Ta3let or an2 ot(er touc( de$ice %it( large screen
Cake sure t+e P0(,a2let device is a2le to access HomeLYnk and enter itHs IP in t+e 2ro#ser
and enter t+e 4plan5 7ou #ant to see.
arro# icon to make t+e map more visi2le.

& .d$anced guide
&"1 @tilities
<tilities availa2le in t+e ta2G
&"1"1 )mport :+5 !ile

Imports t+e ),- o23ect file. It is essential to set
correct data t7pes for imported o23ects. )@isting
o23ects #ould not 2e over#ritten. ?23ects #it+
t+e same name are considered duplicates and
mig+t not 2e imported.




&"1"& =eset 1cleanFup

Deletes all o23ects from t+e HomeLYnk: including
visuali1ation







&"1"3 5actor2 reset

Deletes all configuration and resets to factor7
default settings. ,+is feature is identical to t+e
dou2le long pressing of t+e /)-), pus+ 2utton.


6dvanced guide | <tilities

18
.d$anced guide
Imports t+e ),- o23ect file. It is essential to set
for imported o23ects. )@isting
o23ects #ould not 2e over#ritten. ?23ects #it+
t+e same name are considered duplicates and











Deletes all o23ects from t+e HomeLYnk: including

Deletes all configuration and resets to factor7
default settings. ,+is feature is identical to t+e
dou2le long pressing of t+e /)-), pus+ 2utton.




&"1"7 #ate and time

&et#ork time protocol 8&,P9 is implemented.
Bit+ internet connection HomeLYnk #ill
automaticall7 update time from serversG

.europe.pool.ntp.org
1.europe.pool.ntp.org
2.europe.pool.ntp.org
!.europe.pool.ntp.org

&oteG It is important to select correct time 1one.
&"1"< )nstall updates

Install HomeLYnk update file N.lmup. HomeLYnk
#ill re2oot after successful update
&"1"6 ,ackup
*ackups all t+e o23ects :trends: logs and
visuali1ation
&"1"G =estore

/estores configuration from 2ackup

&"1"' Con!iguration

*7 clicking on t+e arro#: )"* Connection
$ser !ccess settings can 2e accessed. *7 clicking
on t+e Configuration button: s7stem general
settings appear.

nterface language 1 interface language.

0ist items per page 1count of lines per page e.g.
+b,ects2 +b,ect logs2 !lerts etc/

!iscover new ob5ectsE %&' o23ect sniffer is
ena2led. If Y)- is selected: once triggered all ne#
o23ects #ould automaticall7 appear in t+e
6dvanced guide | <tilities

1>
&et#ork time protocol 8&,P9 is implemented.
Ynk #ill
G It is important to select correct time 1one.












. HomeLYnk




)"* Connection and
accessed. *7 clicking
: s7stem general
count of lines per page e.g.
%&' o23ect sniffer is
ena2led. If Y)- is selected: once triggered all ne#
o23ects #ould automaticall7 appear in t+e



















?23ects list.

(b5ect log size E ma@ count of o23ect logs.

!efault log policyE log status for all o23ects or
onl7 for c+ecked o23ects can 2e selected.

4lert log size 1 ma@ count of alerts logged

0og sizeE ma@ count of logs

&rror log sizeE ma@ count of errors logged

PC/Tablet full screen 1 defines if t+e $ser mode
visualization is vie#ed in full screen mode
#it+out an7 side 2ars.

PC/Tablet view = 6lign plans to top left: no si1e
limit. 0entre plans: limit si1e: 0entre plans
ena2le auto si1ing

NoteH 6uto si1ing #ill #ork onl7 in #e2 2ro#sers
#it+ Be2 %it engine 80+rome: -afari9 and "irefo@

Show alerts in PC/Tablet 1 once ne0 !lerts are
triggered it 0ill pop#up in PC/Tablet visualization/

Note

HomeLYnk re2oot is reMuired #+en
c+anging FList items per pageF or
FLanguageF parameter.
8Clear 3ro%ser cac(eE

HomeLYnk #ill keep log o23ects a2ove
t+e limit for 1. minutesP after t+is time
elapse all records a2ove t+e limit #ill 2e
cleared. It is necessar7 to take it in to
account #+ile logging too man7 data in
time.

)@cessive o23ect logging degrades
performance

6dvanced guide | <tilities

2

log status for all o23ects or
$ser mode
is vie#ed in full screen mode
o top left: no si1e
limit. 0entre plans: limit si1e: 0entre plans=
6uto si1ing #ill #ork onl7 in #e2 2ro#sers
#it+ Be2 %it engine 80+rome: -afari9 and "irefo@
once ne0 !lerts are
p in PC/Tablet visualization/
HomeLYnk re2oot is reMuired #+en
c+anging FList items per pageF or
HomeLYnk #ill keep log o23ects a2ove
1. minutesP after t+is time
+e limit #ill 2e
cleared. It is necessar7 to take it in to
account #+ile logging too man7 data in
)@cessive o23ect logging degrades




















































6dvanced guide | <tilities


21
&"1"9 +2stem

-7stem allo#s managing router functionalit7 on %&'()I* HomeLYnk as #ell as access control
management and firm#are upgrade.




Hostname

Defines +ost name for HomeLYnk










Packages

Sstem Packages s+o#s t+e packages installed
in t+e s7stem. Package is functional 2lock of t+e
device. 6 ne# package can 2e added 27 pressing
on I





















+(ortcut 1

$ser !ccess

,+e login and pass#ord configuration #indo#
is located in Sstem 34$' login.


6ccess control is separated in 2 ta2sG

4dmin/+emote E access parameters for
HomeLYnk2 "et0ork2 %SS and *5L






.isualization E access parameters for
PC/Tablet and Smartphone visualization









$pgrade firm0are

Sstem $pgrade firm0are is used to
perform complete upgrade of t+e s7stem
82ot+ ?- as #ell as HomeLYnk part9.


NoteH 6fter eac+ upgrade: it is strongl7
recommended to clean t+e 2ro#ser cac+e.

NoteH During firm#are upgrade t+e devic
not respond as HomeLYnk #ould 2e re2ooting
several times.

%eboot

*7 e@ecuting Sstem %eboot command
HomeLYnk #ould restart.

6dvanced guide | <tilities

22
,+e login and pass#ord configuration #indo#
access parameters for




































perform complete upgrade of t+e s7stem
recommended to clean t+e 2ro#ser cac+e.
During firm#are upgrade t+e device #ill
not respond as HomeLYnk #ould 2e re2ooting









command

6dvanced guide | <tilities


2!
Shutdo0n

*7 e@ecuting Sstem Shutdo0n command
HomeLYnk #ould s+ut do#n.

NoteH It is strongl7 advised to s+utdo#n t+e
s7stem 2efore t+e unit is po#ered off so t+at
t+e data2ase can 2e saved securel7.


6dvanced guide | <tilities


2$
Net%ork
'nterfaces

)t+ernet interface is listed in t+e first ta2. ,+ere
are possi2ilities to disa2le(ena2le or to take a
look at t+e traffic flo# grap+ using special icons
on t+e rig+t side.
*7 clicking on t+e interface 7ou get to t+e
configuration

ProtocolE specific protocol used for addressing

NoneE &o protocol is used

Static P E -tatic IP address. *7 default
1>2.168..1

!"CP E <se DH0P protocol to get IP
configuration.

Current P6 ,+e IP address got from
DH0P server. ,+is field appears onl7 if
t+e IP address is given ot+er#ise its
+idden

Network mask E net#ork mask. *7 default
2...2...2... 8(2$9

#ateway P E gate#a7 IP address

!NS server E D&- server IP address

$TUE ma@imum transmission unit: t+e largest
si1e of t+e packet #+ic+ could 2e passed in t+e
communication protocol. *7 default 1.

:t(ernet inter!ace data put t(roug( grap(

?n t+e main #indo# of t+e )t+ernets ta2: if 7ou
click on t+e 2utton: a ne# #indo# is opened.
It dra#s a real=time grap+ of t+e traffic flo#
passing t+e interface 82ot+ In and ?ut9. ,+ere is a
possi2ilit7 to s#itc+ t+e units of measurement E
27tes(s or 27tes(s.



%outes

-7stem routing ta2le is located in "et0ork
%outes menu. ,+e #indo# is divided in t#o parts
E -tatic routes and D7namic route.






6dvanced guide | <tilities


2.

6namic routes

nterface E Interface name

!estinationE Destination IP address

#ateway E Date#a7 IP address

Network mask E &et#ork mask

Static routes

nterface E Interface name

!estinationE Destination IP address

#ateway E Date#a7 IP address

Network mask E &et#ork mask
























6dvanced guide | <tilities


26
!%P table

6ddress /esolution Protocol ta2le is listed in
"et0ork !%P table.
















)"* connection

%&' specific configuration is located in
0onfigurator =Q <tilities =Q "et0ork"et0ork
)"* connection #indo#.
>eneral

Mode TP#$!%T / &'(net 'P Tunnelling 7"!T mode8
and 'P %outing9 E %&' connection mode.
HomeLYnk +as ,P<6/, interface 27 default 2uilt=
in.

ParameterE%&' corresponding interface in ?- of
t+e s7stem.

8N9 address E %&' p+7sical address of t+e
device.

8N9 )P !eatures E <se t+is device #it+ %&' IP
features e.g. for %&'net(IP net#ork
configuration. If not active: t+en all IP
communication from %&' is 2locked.

Multicast )P E multicast IP address.

Multicast TTL E default value is 1P it allo#s
communication 2et#een different su2 net#orks.

Multicast inter!ace E multicast interface to use
#+en sending %&' telegrams to ot+er %&'
net#orks over <DP(IP: default 22$..2!.12.

Ma-imum telegrams in Iueue E count of
ma@imum telegrams in t+e Mueue.

Note If %&' ,P is not connected to t+e device:
%outing mode s+ould 2e used in order t+e group






































6dvanced guide | <tilities


2;
addresses are updated correctl7. ?nce %outing
mode is used: Parameter field s+ould 2e empt7.
Please perform s7stem re2oot 8Sstem
%eboot9 after eac+ setting c+ange in )"*
connection.







6dvanced guide | <tilities


28
+=C !ilter

-ource filter accepts or drops received telegrams
from defined %&' devices(p+7sical addresses. 6ll
outgoing telegrams are not filtered.

+=C polic2 :"o filter / !ccept selected individual
addresses / 6rop selected individual addresses9 E
polic7 to appl7 to t+e list of source addresses.

.ddress list E list of individual or group
addresses. ?ne address per line. <se N 8e.g. 1.1.N
or 1(1(N9 to filter all addresses in t+e given line.

Note )"* 'P features s+ould 2e on for filter to
#ork
,+is applies to incoming telegrams onl7R


#+T group !ilter

Destination group filter accepts or drops received
telegrams 2elonging to one group as 1(2(! or
su2group as 1(2(N. 6ll outgoing telegrams are not
filtered.

!ST group filter :"o filter / !ccept selected
individual addresses / 6rop selected individual
addresses9 E polic7 to appl7 to t+e list of
destination group addresses.

6ddress list Elist of group addresses.
?ne address per line .<se N8e.g. 1(1(N9 to filter all
addresses in t+e given line.

Note %&' IP features s+ould 2e on for filter to
#ork.


#+T indi$" !ilter

Destination individual filter accepts or drops
received telegrams from defined %&'
devices(p+7sical addresses. 6ll outgoing
telegrams are not filtered.

!ST indiv/ filter :"o filter / !ccept selected
individual addresses / 6rop selected individual
addresses9 E polic7 to appl7 to t+e list of
destination addresses.















6dvanced guide | <tilities


2>


































+ecure tunnel

,o make a secure tunnel 2et#een t#o %&'
net#orks. In comparison #it+ standard tunnels:
#+ic+ use <DP protocol: t+is tunnelling uses ,0P
#+at makes it ver7 relia2le t+anks to package
deliver7 ackno#ledgement. ,+is ensures t+at
sender al#a7s kno#s if t+e package is delivered
to t+e recipient.

+ecure tunnel :6isabled / Client / Server9 E -ecure
tunnel mode.

+er$er )P E In case of secure client: server IP
s+ould 2e specified +ere.

0ocal PE Local IP address.

Network mask E &et#ork mask.

PasswordE Pass#ord.






+er$ices

"TP Client


&et#ork ,ime Protocol 8clock s7nc+roni1ation9
-ervers 1=$
Define server #+ere from date and time is
do#nloaded from


;TP server

",P server of HomeLYnk can 2e accessed 27
ena2ling -ervice ;TP Server.

Server status E secure tunnel mode
Port E port of t+e service
Username 7 login name: ftp
Password E pass#ord: lengt+ $=2 s7m2ol
Passive mode min port7 minimum port of
passive mode
Passive mode ma' port E ma@imum port of
passive mode

Sstem monitoring

Definition of s7stem auto c+eck and auto
re2oot












6dvanced guide | <tilities

!
&et#ork ,ime Protocol 8clock s7nc+roni1ation9
Define server #+ere from date and time is


",P server of HomeLYnk can 2e accessed 27
2 s7m2ol
imum port of
ma@imum port of









































6dvanced guide | <tilities


!1
+tatus

System status

4eneral
5emor usage
Partitions


Network status



Network utilities

Ping
Traceroute


6dvanced guide | <tilities


!2
System log

Running processes


Help
-B license description of t+e "las+-Y-.


&"& 034ects
List of %&' net#ork o23ects appear in
#a7G
= -niffing t+e 2us for telegrams from unkno#n group addresses 8if ena2led in
= 6dding manuall7
= Importing )-" file 8in $tilities

?23ects can 2e sorted #it+ t+e follo#ing parameters
value2 Tags2 Comments and $pdated at


6dvanced guide | ?23ects

!!
List of %&' net#ork o23ects appear in +b,ects menu. ,+e o23ect appears in t+e list in t+e follo#i
-niffing t+e 2us for telegrams from unkno#n group addresses 8if ena2led in
$tilities9
?23ects can 2e sorted #it+ t+e follo#ing parametersE "ame2 4roup address2 6ata tpe2 Current
$pdated at.
menu. ,+e o23ect appears in t+e list in t+e follo#ing
-niffing t+e 2us for telegrams from unkno#n group addresses 8if ena2led in $tilities9
"ame2 4roup address2 6ata tpe2 Current

&"&"1 034ect parameters

,o c+ange t+e settings for e@isting or ne#
o23ects: press on t+e specific list entr7.

(b5ect name E &ame for t+e o23ect

#roup address E Droup address of t+is o23ect

!ata type E %&' data t7pe for t+e o23ect. ,+is
+as to 2e set once t+e HomeLYnk sniffs t+e
ne# o23ect for actual #ork.

Unit/suffi' E 6dd unit(suffi@ to value of
o23ect. <nits #+ic+ cannot 2e created from
ke72oard can 2e created in e@ternal editor
and pasted in to t+e 2ro#ser

0og E )na2le logging for t+is o23ect. Logs #ill
appear in +b,ects logs ta2.

&'port E Cake o23ect visi2le 27 remote 'CL
reMuests

Poll interval 8seconds9 E Perform automatic
o23ect read after t+e selected time interval

Tags E 6ssign t+is o23ect to some tag #+ic+
can 2e later used in #riting scripts: for
e@ample: !ll<lights<first<floor. 8Please refer to
t+e -cript li2rar7 for use cases9

Current valueE 0urrent value of t+e o23ect

(b5ect comments E 0omment for t+e o23ect

&"&"& +et $alue

In t+e o23ect list: 27 pressing on
t+e 2utton : t+e state of t+e o23ect can 2e
c+anged.
,+e appearance of t+e "e0 value depends on
#+at visuali1ation parameters are set for
specific o23ect.

6dvanced guide | ?23ects

!$
,o c+ange t+e settings for e@isting or ne#
Droup address of t+is o23ect
%&' data t7pe for t+e o23ect. ,+is
+as to 2e set once t+e HomeLYnk sniffs t+e
6dd unit(suffi@ to value of
o23ect. <nits #+ic+ cannot 2e created from
ke72oard can 2e created in e@ternal editor
t+is o23ect. Logs #ill
Cake o23ect visi2le 27 remote 'CL
Perform automatic
o23ect read after t+e selected time interval
6ssign t+is o23ect to some tag #+ic+
d in #riting scripts: for
. 8Please refer to
0urrent value of t+e o23ect
0omment for t+e o23ect


: t+e state of t+e o23ect can 2e
depends on
#+at visuali1ation parameters are set for










&"&"3 034ect $isuali?ation parameters

*7 pressing on t+e 2utton of t+e
corresponding o23ect specific visuali1ation
parameters for t+is t7pe of o23ect can 2e set.

1 2it

Control type E t7pe of t+e visual
control element

o ,oggle


o 0+eck2o@



$ 2it 8! 2it controlled9


Step size E step si1e e@ample for 2linds control
2 2it 81 2it controlled9: 1 27te unsigned integer
8scale9: 1 27te signed integer: 2 27te unsigned
integer: 2 27te signed integer: 2 27te floating
point 8temperature9: $ 27te unsigned integer:
$ 27te signed integer: $ 27te floating point

0ontrol t7pe E t7pe of t+e visual control
element

-lider

Direct input ( -tep

I(=


$inimum value

$a'imum value

Step size E If defined value #ill c+ange depend
of defined step





6dvanced guide | ?23ects

!.
034ect $isuali?ation parameters
2utton of t+e
cific visuali1ation
parameters for t+is t7pe of o23ect can 2e set.
t7pe of t+e visual
step si1e e@ample for 2linds control
rolled9: 1 27te unsigned integer
8scale9: 1 27te signed integer: 2 27te unsigned
integer: 2 27te signed integer: 2 27te floating
point 8temperature9: $ 27te unsigned integer:
$ 27te signed integer: $ 27te floating point
If defined value #ill c+ange depend


&"&"7 Custom te-t $alue

In t+e o23ect list: 27 pressing on t+e 2utton:
custom te@t can 2e added to t+e o23ect
values.
0ustom te@t values can 2e set onl7 to *oolean
and integer values.

!efault te't E ,e@t #+ic+ #ill 2e displa7ed if
value is not defined

(b5ect value E !dd custom value: select
+b,ect value and define 6ispla te=t





&"&"< 034ect control 3ar

4dd new ob5ect E Canuall7 add ne# o23ect to
t+e list

4uto update enabled E-pecifies eit+er t+e
o23ect list is updated automaticall7 or not

Clear E 0lear t+e list of group addresses

Ne't/Previous page E Cove to ne@t or
previous page

+efresh E /efres+ t+e o23ect list

&"&"6 5ilter o34ects

?n t+e left side of t+e o23ect list t+ere is
filtering possi2le. ,o perform t+e filtering t7pe
t+e name: group address: tag or specif7 t+e
data t7pe of t+e o23ect and press on ;ilter
2utton.






6dvanced guide | ?23ects

!6
In t+e o23ect list: 27 pressing on t+e 2utton:
t+e o23ect
0ustom te@t values can 2e set onl7 to *oolean
,e@t #+ic+ #ill 2e displa7ed if
: select

Canuall7 add ne# o23ect to
-pecifies eit+er t+e
o23ect list is updated automaticall7 or not


?n t+e left side of t+e o23ect list t+ere is
filtering possi2le. ,o perform t+e filtering t7pe
t+e name: group address: tag or specif7 t+e
;ilter














&"3 034ect Logs
?23ect +istorical telegrams are availa2le in
+istorical and future data #ill 2e logged in.

"iltering is availa2le #+en t+ere is a need to find specific period information.
Start date E start date and time for log filtering
&nd date E start date and time for log filtering
Name or group address
.alue E specific o23ect value
Source address E specific source address
6ll logs can 2e cleared 27 pressing
Note Logging memor7 is set up in t+e



6dvanced guide | ?23ect Logs

!;
?23ect +istorical telegrams are availa2le in +b,ect logs. ?nce logging is ena2led for o23ect: all t+e
+istorical and future data #ill 2e logged in.
"iltering is availa2le #+en t+ere is a need to find specific period information.
rt date and time for log filtering
start date and time for log filtering
E specific name or group address of o23ect
specific o23ect value
specific source address
6ll logs can 2e cleared 27 pressing on Clear 2utton.
Logging memor7 is set up in t+e $tilities Configurations
. ?nce logging is ena2led for o23ect: all t+e

&"7 +c(edulers

-c+edulers allo# t+e end user to control %&' group address values 2ased on t+e date or da7 of t+e
#eek.


&"7"1 .dd ne% sc(eduler

0b5ect E ,+e o23ect group address #+ic+ #ill 2e
controlled 27 t+e sc+eduler

4ctive E Define #+et+er a sc+eduler is active or not

Name E &ame of t+e sc+eduler

Start date E -tart date of t+e sc+eduler

&nd date E )nd date of t+e sc+eduler


6dvanced guide | -c+edulers

!8
-c+edulers allo# t+e end user to control %&' group address values 2ased on t+e date or da7 of t+e
ress #+ic+ #ill 2e
Define #+et+er a sc+eduler is active or not



-c+edulers allo# t+e end user to control %&' group address values 2ased on t+e date or da7 of t+e

&"7"& +c(eduler e$ents

)vent can 2e added 2ot+ in administrator interface
as #ell as 27 t+e end user in t+e special $ser mode
schedulers interface.

4ctive E Define t+e event to 2e active or not

.alue E Aalue to send to t+e group address #+en
t+e event #ill 2e triggered

Start time E -tart time for t+e event

!ays of the week E Da7s of t+e #eek #+en t+e
event #ill 2e triggered.

"ol E Holida7s #+ic+ are defined in Holidas ta2
&"7"3 +c(eduler (olida2s

?nce t+e event #ill 2e marked to run in Hol: Holida7
entries #ill 2e activated

6dvanced guide | -c+edulers

!>
2ot+ in administrator interface
$ser mode
Aalue to send to t+e group address #+en
Da7s of t+e #eek #+en t+e
ta2






















: Holida7



&"< Trend logs
,rends logs or so called data logging allo#s t+e end user to store selected data and compare
different t+e time periods from t+e past.








&"<"1 .dd ne% trend log

(b5ect E 0+oose from list of o23ect t+e one to
make trends for

Name E &ame of t+e trend

0og type E ,7pe of t+e log.
Counter t7pe is used to count t+e date
!bsolute value E saves t+e actual readings

-loating point precision E If t+e o23ect is floating
t7pe: t+en precision needs to 2e selected. )@ample
1.1111 K precision is $

: minute data E 6verage value of 1 minute for
specific time interval data #ill 2e s+o#n on t+e
trend. ).g. if 1 +our E trend step #ill 2e 1 +our #it+
average 6 readings data

"ourly data E 6verage value of +ourl7 data for
specific time interval

!aily data E 6verage value of dail7 data for specific
time interval

$onthly data E 6verage value of mont+l7 data for
specific time interval

0og size E Define total trend log si1e of t+e o23ect.
,rend logs are stored on !.2 D* internal flas+
memor7


6dvanced guide | ,rend logs

$
,rends logs or so called data logging allo#s t+e end user to store selected data and compare
different t+e time periods from t+e past.
0+oose from list of o23ect t+e one to
If t+e o23ect is floating
t7pe: t+en precision needs to 2e selected. )@ample
6verage value of 1 minute for
specific time interval data #ill 2e s+o#n on t+e
trend step #ill 2e 1 +our #it+
6verage value of +ourl7 data for
6verage value of dail7 data for specific
6verage value of mont+l7 data for
Define total trend log si1e of t+e o23ect.
internal flas+

,rends logs or so called data logging allo#s t+e end user to store selected data and compare
6dvanced guide

&"6 Cis" structure
Ais. -tructure is used for creating all 2uildings levels and visuali1ations plans. 6dditionall7 it can
create La7outs and Bidgets for t+e plans visuali1ation.
-tarting ne# pro3ects: onl7 La2outs
user to define specific Plan of t+e flat.
mandator7 for 2asic visuali1ationsP t+e7 can 2e defined and implemented in ot+er

&"6"1 Le$els
,o add ne# Level press on "
level usuall7 is t+e pro3ect name. 6dditional levels
can 2e added later.

&"6"& +econd le$el

-econd level could 2e used in 2uildings #it+ man7
floors.
If 7ou need additional levels press on ne@t to
7our main level.

-elect 6dd second level and give it a name and sort
order.

)ac+ level can 2e duplicated toget+er #it+
su2levels and plans via pressing duplicate icon ne@t
to t+e level.


6dvanced guide | Aisuali1ation structure

$1
Ais. -tructure is used for creating all 2uildings levels and visuali1ations plans. 6dditionall7 it can
create La7outs and Bidgets for t+e plans visuali1ation.
La2outs and *idgets folders are visi2le. 6dding ne# level all
of t+e flat. La2outs and *idgets are additional tools #+ic+ are not
mandator7 for 2asic visuali1ationsP t+e7 can 2e defined and implemented in ot+er
" Cain
s t+e pro3ect name. 6dditional levels

-econd level could 2e used in 2uildings #it+ man7
ne@t to
ame and sort
su2levels and plans via pressing duplicate icon ne@t



















Ais. -tructure is used for creating all 2uildings levels and visuali1ations plans. 6dditionall7 it can
folders are visi2le. 6dding ne# level allo#s t+e end
are additional tools #+ic+ are not
mandator7 for 2asic visuali1ationsP t+e7 can 2e defined and implemented in ot+er Plans.
















6dvanced guide

&"6"3 Plans

6 Plan could 2e eit+er one room from flat or one
function 8as lig+ting or +eating9 for t+e #+ole flat.
,o add Plans press on ne@t to a level under
#+ic+ t+e plan is to 2e added and select 6dd plan.

Name E &ame for t+e plan.

0ayout E La7out for t+is specific plan. 6ll o23ects
from La7out #ill 2e duplicated on t+is particular
plan including 2ackground colour and plan image if
t+e7 are not defined separatel7 for t+is specific
plan. La7out need to 2e created 2efore 2eing
added to t+e Plan.

PC/Tablet visualization
1Show2 Show and make default2 "ide3 EAisi2ilit7
for t+is particular plan in t+e P0(,a2let
visuali1ation

Smartphone visualization
1Show2 Show and make default2 "ide3 E Aisi2ilit7
for t+is particular plan in t+e -martp+one
visuali1ation
%ackground image E -elect 2ackground previousl7
added to Ais. grap+ics =Q Images(*ackgrounds

%ackground color E 0+oose 2ackground color of
t+e plan.

+epeat background image E )it+er to s+o# t+e
image once or repeat it and fill t+e #+ole plan.

Sort order E -ort order for t+e plan: depends
#+ere t+is particular plan #ill 2e located among
ot+er in a specific level.

4dmin only access E )na2le admin onl7 access for
t+is floor 8visadmin user9
)ac+ Plan can 2e duplicated toget+er #it+ all
components on a plan via pressing duplicate icon
ne@t to t+e plan

Content of this Plan is to be defined under
Visualization tab
&"6"7 La2out
,o add La7out pres on ne@t to a La7out
folder.

)ac+ La7out can 2e duplicated toget+er #it+
all components via pressing duplicate icon
ne@t to t+e La7out .

6dvanced guide | Aisuali1ation structure

$2
6 Plan could 2e eit+er one room from flat or one
le flat.
ne@t to a level under
#+ic+ t+e plan is to 2e added and select 6dd plan.
La7out for t+is specific plan. 6ll o23ects
from La7out #ill 2e duplicated on t+is particular
ground colour and plan image if
t+e7 are not defined separatel7 for t+is specific
plan. La7out need to 2e created 2efore 2eing
Aisi2ilit7
Aisi2ilit7
-elect 2ackground previousl7
Q Images(*ackgrounds
0+oose 2ackground color of
)it+er to s+o# t+e
image once or repeat it and fill t+e #+ole plan.
-ort order for t+e plan: depends
#+ere t+is particular plan #ill 2e located among
)na2le admin onl7 access for
)ac+ Plan can 2e duplicated toget+er #it+ all
components on a plan via pressing duplicate icon
ne@t to a La7out
)ac+ La7out can 2e duplicated toget+er #it+
all components via pressing duplicate icon











6dvanced guide

0ontent of t+is la7out is to 2e defined under
Aisuali1ation ta2.



&"6"< *idgets

Bidget is a small popup #e2 page #+ic+ can
2e attac+ed to a 2utton.
,o add #idgets press on ne@t to #idgets
folder. )ac+ #idget can 2e duplicated
toget+er #it+ all components via pressing
duplicate icon ne@t to t+e #idget . 0ontent
of t+is #idget is to 2e defined under
Aisuali1ation ta2.

NoteH Bidget si1e al#a7s +as to 2e smaller
t+an plan on #+ic+ it is placed on.





















6dvanced guide | Aisuali1ation structure

$!
0ontent of t+is la7out is to 2e defined under














Bidget is a small popup #e2 page #+ic+ can
ne@t to #idgets
toget+er #it+ all components via pressing
0ontent
Bidget si1e al#a7s +as to 2e smaller










6dvanced guide | Aisuali1ation structure


$$


&"6"6 Cisuali?ation structure e-ample


&"6"G Plan


6dvanced guide | Aisuali1ation structure


$.
&"6"' La2out




&"6"9 *idget





&"G Cisuali?ation
,+is ta2 is split in a tree sectionG
= +tructure E &avigation tree for levels: plans: #idgets #+ic+ #ere created under visuali1ation
structure ta2.
= Cisuali?ation map E 6ctual visuali1ation field #+ere 7ou can add all visuali1ation
components
= Plan :ditor E all parameters of t+e component are set up +ere.
















*ot+ side 2ars can 2e minimi1ed 27 pressing on
small displa7s.
&"G"1 +tructure
,o navigate 2et#een plans: la7outs and #idgets using navigati
During editing mode in 2ottom t+e 2elo# additional parameters are availa2le
-i1e of plans: la7outs and #idgets.
Position of eac+ component is also displa7ed +ere
Note -i1e of t+e plan s+ould 2e positioned correctl7 agains
Bidget si1e al#a7s +as to 2e smaller t+an plan on #+ic+ it is placed on.
6l#a7s use component position to align o23ects.
6dvanced guide | Aisuali1ation

$6

&avigation tree for levels: plans: #idgets #+ic+ #ere created under visuali1ation
6ctual visuali1ation field #+ere 7ou can add all visuali1ation
all parameters of t+e component are set up +ere.
*ot+ side 2ars can 2e minimi1ed 27 pressing on icon making t+e plan more visi2le especiall7 on
,o navigate 2et#een plans: la7outs and #idgets using navigation tree in structure vie#.
During editing mode in 2ottom t+e 2elo# additional parameters are availa2le
-i1e of plans: la7outs and #idgets.
Position of eac+ component is also displa7ed +ere

-i1e of t+e plan s+ould 2e positioned correctl7 against t+e 2ackground.
Bidget si1e al#a7s +as to 2e smaller t+an plan on #+ic+ it is placed on.
6l#a7s use component position to align o23ects.
&avigation tree for levels: plans: #idgets #+ic+ #ere created under visuali1ation
6ctual visuali1ation field #+ere 7ou can add all visuali1ation
icon making t+e plan more visi2le especiall7 on
on tree in structure vie#.


&"G"& Cisuali?ation Map
)ac+ added o23ect #ill 2e placed in top left corner of plan. Cove ever7 ne# o23ect to t+e correct
position via dragging it. ,o delete o23ect select it and press
rig+t corner of ever7 o23ect.
&"G"3 Plan :ditor

Plan editor is located on t+e rig+t side of t+e visuali1ation map. )diting mode can 2e accessed 27
pressing $nlock current plan for editing








6dvanced guide | Aisuali1ation

$;
)ac+ added o23ect #ill 2e placed in top left corner of plan. Cove ever7 ne# o23ect to t+e correct
osition via dragging it. ,o delete o23ect select it and press #+ic+ is al#a7s positioned in top
is located on t+e rig+t side of t+e visuali1ation map. )diting mode can 2e accessed 27
ock current plan for editing.
)ac+ added o23ect #ill 2e placed in top left corner of plan. Cove ever7 ne# o23ect to t+e correct
#+ic+ is al#a7s positioned in top

is located on t+e rig+t side of t+e visuali1ation map. )diting mode can 2e accessed 27

&"G"7 034ect

)ver7 control or monitoring o23ects is
configured under t+is ta2. Different data tapes
+ave different parameters.

$ain ob5ect E List of e@isting group addresses
on %&'()I* 2us: t+e ones availa2le for
configuration in +b,ects ta2. In order to speed
up selection it is recommended to start #riting
group address.

Status ob5ect E List of status o23ects on %&'()I*
2us. 0ontrol o23ect can also 2e used as status.

Custom name E &ame for t+e o23ect. 0ustom
name is important for -martp+one
Aisuali1ationP if t+e name is left 2lank group
address name is used instead.

+ead6only E ,+e o23ect is read=onl7: no #rite
permission.

"ide in SmartphoneE Do not s+o# t+is o23ect in
Smartphone .isualization/

Sort orderE -ort num2er for -martp+one
visuali1ation.

"ide backgroundE Hide icon 2ackground.

Send fi'ed valueE 6llo#s sending specific value
to t+e 2us eac+ time t+e o23ect is pressed.

No bus write E Aalue #ould not 2e #ritten in to
%&' 2us. <se full for triggering scripts #it+ 2us
load limitation.

Pin code E Aia adding a pin 7ou can protect
o23ect. )ac+ time value #ill 2e c+ange pin code
#ill 2e reMuested to #rite.

;idget EBidget can 2e attac+ed to a 2utton
#+ic+ needs to 2e created 2efore. Bidget
cannot 2e tested under editor modeP onl7
under P0(,a2let Aisuali1ation can it 2e tested.

!isplay mode 1icon and value< icon< value3
+o# to displa7 t+e o23ect

!efault conE Default icon of scale=t7pe o23ects
6dvanced guide | Aisuali1ation

$8
configured under t+is ta2. Different data tapes
List of e@isting group addresses
on %&'()I* 2us: t+e ones availa2le for
ta2. In order to speed
up selection it is recommended to start #riting
List of status o23ects on %&'()I*
2us. 0ontrol o23ect can also 2e used as status.
&ame for t+e o23ect. 0ustom
rtant for -martp+one
Aisuali1ationP if t+e name is left 2lank group
onl7: no #rite
Do not s+o# t+is o23ect in
for -martp+one
Hide icon 2ackground.
6llo#s sending specific value
to t+e 2us eac+ time t+e o23ect is pressed.
Aalue #ould not 2e #ritten in to
t+ 2us
Aia adding a pin 7ou can protect
o23ect. )ac+ time value #ill 2e c+ange pin code
Bidget can 2e attac+ed to a 2utton
#+ic+ needs to 2e created 2efore. Bidget
itor modeP onl7
under P0(,a2let Aisuali1ation can it 2e tested.
1icon and value< icon< value3 E
t7pe o23ects



(n icon 1 ?n state icon for 2inar7=t7pe o23ects

(ff icon 1 ?ff state icon for 2inar7=t7pe o23ects

Show control 1 If ena2led an7 control 2utton
#ill 2e al#a7s open. Aisi2le onl7 in P0(,a2let
Aisuali1ation


"or value=t7pe o23ects: additional 2utton #ould
appear #+ile specif7ing parameters E !dditional
icons/ Different icons for different o23ect values
can 2e defined in t+e #indo#.

"or value displa7 te@t st7le can 2e defined

?nce t+e o23ect parameters are defined: press
!dd to floor plan 2utton and a ne#l7 created
o23ect #ould appear. ,+e o23ect can 2e moved
to t+e an7 location of t+e plan. &ote t+at #+ile
2eing in editing mode: t+e o23ect #ill not #ork.
B+en all necessar7 o23ects are added: press
Save and reload floor plan 2utton so t+at t+e
o23ects starts functioning.

You can edit )ac+ added o23ect can 2e edited
#+ile clicking on it in t+e )diting mode. Press
t+e -ave 2utton after eac+ c+ange.

)ac+ o23ect can 2e duplicated via pressing
duplicate 2utton.

/eset 2utton #ell set o23ect parameters to
default settings.
6dvanced guide | Aisuali1ation

$>
t7pe o23ects
t7pe o23ects
If ena2led an7 control 2utton
#ill 2e al#a7s open. Aisi2le onl7 in P0(,a2let
t7pe o23ects: additional 2utton #ould
!dditional
ons for different o23ect values
"or value displa7 te@t st7le can 2e defined
?nce t+e o23ect parameters are defined: press
2utton and a ne#l7 created
o23ect #ould appear. ,+e o23ect can 2e moved
location of t+e plan. &ote t+at #+ile
2eing in editing mode: t+e o23ect #ill not #ork.
B+en all necessar7 o23ects are added: press
2utton so t+at t+e
You can edit )ac+ added o23ect can 2e edited
le clicking on it in t+e )diting mode. Press
after eac+ c+ange.
)ac+ o23ect can 2e duplicated via pressing
/eset 2utton #ell set o23ect parameters to

&"G"< Plan link

In order to make visuali1ation more convenient:
t+ere are plan links integrated. -pecial icons on
t+e map can 2e added #+ic+ #ould act as a link
to ot+er plans.

Plan E -elect plan link

Custom name E&ame for t+e link

"ide backgroundE Hide icon 2ackground


con E Icon #+ic+ #ill 2e s+o#ed in
visuali1ation. If onl7 te@t is selected: te@t
parameters are selected.

4ctive state icon E If icon is selected active plan
icon is availa2le.

-ont size E -i1e of font

Te't style E ,e@t st7le E 2old: italic: underscore

Custom font E "ont name

-ont color E "ont color

Note It is recommended to use La7out for
menu and plan link creation. You can save time
#+ile adding it to different plans and later #+en
making c+anges. *7 adding it to different plans
it #ould save time and 2e 2eneficial #+e
c+anges are reMuired.

&"G"6 0amera

HomeLYnk supports t+ird part7 IP #e2 camera
integration into its visuali1ation.

Note ?nl7 cameras #+ic+ support H,,P CSP)D
streaming in #e2 2ro#ser.

Source url E -ource address of t+e video
stream.

;idth E -u2=#indo# #idt+ for displa7ing of
picture.

"eightE -u2=#indo# +eig+t for displa7ing of
6dvanced guide | Aisuali1ation

.
n more convenient:
t+ere are plan links integrated. -pecial icons on
t+e map can 2e added #+ic+ #ould act as a link

If icon is selected active plan
2old: italic: underscore
It is recommended to use La7out for
menu and plan link creation. You can save time
#+ile adding it to different plans and later #+en
making c+anges. *7 adding it to different plans
it #ould save time and 2e 2eneficial #+en

HomeLYnk supports t+ird part7 IP #e2 camera
?nl7 cameras #+ic+ support H,,P CSP)D
o# #idt+ for displa7ing of
#indo# +eig+t for displa7ing of


picture.

Custom name E &ame for t+e o23ect.

4uto open window E automaticall7 open video
#indo#.

"ide backgroundE Hide icon 2ackground.

Sort order E ?rder cameras for touc+
visuali1ation

Note
If IP camera reMuires user name and
pass#ord: enter t+e url in form
http=//US&+=P4SS;(+!>P

HomeLYnk is onl7 redirecting stream
from camera to t+e 2ro#ser. If stream
does not #ork it is #e2 2ro#ser issue
not HomeLYnk.

If t+ere is cameras issue please c+eck if
video stream is availa2le in 2ro#ser

If camera #ants to 2e availa2le from
e@ternal: IP of camera need to 2e port
for#arded troug+ t+e router. B+ile
adding e@ternal camera: IP #it+ correc
port +as to 2e used 8IPGport9. If local IP
is used t+en camera #ould not 2e
availa2le from e@ternal

0ontact ,ec+nical support of camera
manufacturer if direct video stream is
+idden 27 t+e manufacturer.

0amera image 8N.png onl7R9 can 2e
c+anged via replacing camera image
under Ais. grap+ics ta2. &ame of image
+as to 2e OcameraH.

6dvanced guide | Aisuali1ation

.1
automaticall7 open video

If IP camera reMuires user name and
HomeLYnk is onl7 redirecting stream
from camera to t+e 2ro#ser. If stream
ser issue
If t+ere is cameras issue please c+eck if
video stream is availa2le in 2ro#ser
If camera #ants to 2e availa2le from
e@ternal: IP of camera need to 2e port
for#arded troug+ t+e router. B+ile
adding e@ternal camera: IP #it+ correct
port +as to 2e used 8IPGport9. If local IP
is used t+en camera #ould not 2e
0ontact ,ec+nical support of camera
manufacturer if direct video stream is
0amera image 8N.png onl7R9 can 2e
placing camera image
under Ais. grap+ics ta2. &ame of image

&"G"G >rap(

/eal=time grap+s can 2e integrated into
visuali1ation s7stem to monitor t+e current and
old value of scale=t7pe o23ects. Cake sure
logging is ena2led for t+e o23ect in +b,ect
#+ic+ values is planned to 2e s+o#n in t+e
grap+.

!ata ob5ect E Droup address of t+e o23ect.

Custom name E &ame of t+e o23ect.

conE Icon to launc+ t+e grap+.

;idth E -u2=#indo# #idt+ for displa7ing t+e
grap+.

"eightE -u2=#indo# +eig+t for displa7ing t+e
grap+

Number of points E &um2er of data points to
s+o# in t+e grap+.

4uto open window E Drap+ #indo# is
automaticall7 opened.

"ide background E Hide icon 2ackground

?nce t+e grap+ parameters are defined: press
!dd to plan 2utton and ne#l7 created o23ect
#ill appear. ,+e o23ect can 2e moved to t+e
desired location. &ote t+at #+ile 2eing in
editing mode: t+e o23ect #ill not #ork. Press on
Save and reload plan 2utton so t+at t+e o23ects
starts functioning.

&"G"' Te-t la3el

,e@t la2els can 2e added and moved across t+e
visuali1ation map.

Te't E La2el te@t

-ont size E La2el font si1e

Te't style E st7le of t+e te@t E 2old: italic:
underscored.

Custom font E font name.

6dvanced guide | Aisuali1ation

.2
visuali1ation s7stem to monitor t+e current and
t7pe o23ects. Cake sure
ta2
#+ic+ values is planned to 2e s+o#n in t+e
Droup address of t+e o23ect.
#indo# #idt+ for displa7ing t+e
r displa7ing t+e
&um2er of data points to

?nce t+e grap+ parameters are defined: press
#l7 created o23ect
#ill appear. ,+e o23ect can 2e moved to t+e
desired location. &ote t+at #+ile 2eing in
editing mode: t+e o23ect #ill not #ork. Press on
2utton so t+at t+e o23ects

e added and moved across t+e

6dvanced guide | Aisuali1ation


.!
-ont colorE la2el font color

?nce t+e la2el parameters are defined: press
!dd ne0 ob,ect 2utton and ne#l7 created
o23ect #ill appear on t+e map. ,+e o23ect can
2e moved to t+e desired location. Press on Save
and reload floor plan 2utton so t+e o23ects
starts functioning.
Last t#o ro#s in t+e color palette refer to t+e
predefined -c+neider )lectric corporate colors.

&"G"9 )mage

Image section allo#s adding images from Local
storage or from t+e internet into t+e
visuali1ation map. )@ternal image is useful for
e@ample: to gra2 d7namic #eat+er cast images.


mage source 10ocal2 +emote3 7 -elect image
source

Select image 7 -elect image previousl7 added to
Ais. grap+ics =Q Images(*ackgrounds

mage url E -ource </L of t+e image

;idth E Bidt+ of t+e image

"eight E Heig+t of t+e image

&'ternal link E )@ternal link </L #+en pressin
on t+e image

?nce t+e image parameters are defined: press
!dd to plan 2utton and ne#l7 created o23ect
#ill appear on t+e map. ,+e o23ect can 2e
moved to t+e desired location. Press on
and reload plan 2utton so t+e o23ects starts
functioning. Image can 2e freel7 resi1ed via
catc+ing edge of image and move.

&"G"10 >auge

Dauge allo#s d7namic #a7 of visuali1ation and
c+anging o23ect value in t+e gauge.

!ata ob5ect E %&' group address

Size E si1e of t+e gauge

Custom name E custom name for t+e o23ect

+ead only E make t+e gauge read onl7

?nce t+e gauge parameters are defined: press
!dd to plan 2utton and ne#l7 created o23ect
#ill appear on t+e map. ,+e o23ect can 2e
moved to t+e desired location. Press on Save
and reload plan 2utton so t+at t+e o23ects
starts functioning.
6dvanced guide | Aisuali1ation

.$
Image section allo#s adding images from Local
visuali1ation map. )@ternal image is useful for
e@ample: to gra2 d7namic #eat+er cast images.
-elect image
-elect image previousl7 added to
)@ternal link </L #+en pressing
?nce t+e image parameters are defined: press
2utton and ne#l7 created o23ect
#ill appear on t+e map. ,+e o23ect can 2e
moved to t+e desired location. Press on Save
2utton so t+e o23ects starts
can 2e freel7 resi1ed via










Dauge allo#s d7namic #a7 of visuali1ation and
o23ect
?nce t+e gauge parameters are defined: press
2utton and ne#l7 created o23ect
#ill appear on t+e map. ,+e o23ect can 2e
Save
o23ects


&"G"11 5rame

"rame allo#s displa7ing internal or e@ternal
#e2page in visuali1ation. Schedulers and
Trends are integrated in to t+e frame.

Source E -elect -c+eduler: ,rend log or e@ternal
</L
UrlG = -ource </L of e@ternal #e2page

;idth E #idt+ of frame

"eight E +eig+t of frame

?nce t+e "rame parameters are defined: press
!dd to plan 2utton and ne#l7 created o23ect
#ill appear on t+e map. ,+e o23ect can 2e
moved to t+e desired location. Press on Save
and reload plan 2utton so t+e o23ects starts
functioning. "rame can 2e freel7 resi1ed via
catc+ing edge of "rame and move.

Note
-ome #e2 pages +ave 3ava script #+ic+
prevent from using frame: if t+is is
implemented #e2page #ill open in full
screen rat+er in frame

It is recommended to stretc+ t+e frame
to ma@imum #idt+ if -c+eduler or
,rend is used. /ecommended minimum
#idt+ is 12$.

"rame is onl7 visi2le under P0(,a2let
Aisuali1ation.

Do not allo# -c+eduler or ,rend to 2e
vie#ed from -martp+one visuali1ation.
-ettings are availa2le in Ais. structure
under dedicated plan.


6dvanced guide | Aisuali1ation

..
"rame allo#s displa7ing internal or e@ternal
-elect -c+eduler: ,rend log or e@ternal
?nce t+e "rame parameters are defined: press
2utton and ne#l7 created o23ect
#ill appear on t+e map. ,+e o23ect can 2e
Save
e o23ects starts
functioning. "rame can 2e freel7 resi1ed via
-ome #e2 pages +ave 3ava script #+ic+
prevent from using frame: if t+is is
implemented #e2page #ill open in full
to stretc+ t+e frame
to ma@imum #idt+ if -c+eduler or
,rend is used. /ecommended minimum
"rame is onl7 visi2le under P0(,a2let
Do not allo# -c+eduler or ,rend to 2e
vie#ed from -martp+one visuali1ation.
e in Ais. structure

6dvanced guide | Aisuali1ation grap+ics


.6

&"' Cis" grap(ics
,+is ta2 is split into t#o sections: icons #+ere all o23ect icons are located and Images(*ackgrounds.














Press on !dd ne0 icon 2utton to add a ne# entr7. ,+e s7stem accepts an7 si1e of icon.
Speg: Dif and P&D formats are supported. &ame can contain letters: num2ers: underscore and minus
sign
TIP arc+ive containing multiple grap+ics can 2e uploaded: eac+ item cannot e@ceed 2C*: and #+ole
arc+ive si1e cannot e@ceed 16C*.









Name 8optional9 E ,+e name of t+e icon. It #ill appear in t+e list #+en adding ne# o23ect. It can
contain letters: num2ers: underscore and minus sign

-ile E Icon file location
0-- st7le can 2e c+anged via uploading ne# file. 0-- define all control 2uttons: -martp+one
visuali1ation: -c+eduler and ,rend. "or more information +o# to modif7 0-- file please contact 7our
local front office for additional document.
NoteH Please clear cac(e o! t(e 3ro%ser a!ter uploading ne% css !ile"

6dvanced guide | -cripting


.;
&"9 +cripting
-cripting menu allo#s adding and managing various scripts: depending on t+e t7pe of t+e script. Lua
programming language is used to implement user scripts. Cost of t+e Lua language aspects are
covered in t+e first edition of FProgramming in LuaF #+ic+ is freel7 availa2le at +ttpG((lua.org(pil(
Note 6ata format > in most cases data is stored and transferred bet0een HomeLYnk parts using
he=#encoded strings 7? btes per @ bte of data8/

&"9"1 :$ent 3ased

,+ese are scripts t+at are e@ecuted #+en a
group event occurs on t+e 2us. <suall7 used
#+en real=time response is reMuired.
B+en pressing on t+e arro# on t+e lo#er side
of t+e &vent#based2 %esident or Scheduled
2uttons: t#o options appearG

0ist view E -ort scripts in list vie#

4dd new script E 6dd ne# script to t+e list

,+e follo#ing fields s+ould 2e filled #+en
adding a ne# scriptG

Script name E ,+e name of t+e script

&vent group address E 6llo#s to enter onl7
digits from .> and ( as a separator. B+en
icon appears on t+e rig+t side of t+e te@t
#rong address form is used. 0orrect form of t+e
group=address is: for e@ample: 1(1(1.

Tag E -cript can run on tags. If group addresses
+as tag attac+ed to and script is using tag t+en
an7 telegram #+ic+ is send to t+e group #it+
t+is tag #ill e@ecute script.

4ctiveE -pecifies #+et+er t+e script is active
8green circle9 or disa2led 8red circle9

&'ecute on group readE -pecifies #+et+er t+e
script is e@ecuted on %&' group read telegram.

Category E 6 ne# or e@isting name of t+e
categor7 t+e script #ill 2e included. ,+is #ill not
affect on script action: +elps onl7 27 grouping
t+e scripts and #atc+ing 27 categories in Tools
Print script listings page.

!escriptionE description of t+e script

&oteR If t+e script is to 2e run onl7 on read
reMuest :use follo#ing script e@ampleG
if event.t7pe KK UgroupreadU t+en
## script here
end
6dvanced guide | -cripting

.8
,+ese are scripts t+at are e@ecuted #+en a
group event occurs on t+e 2us. <suall7 used
B+en pressing on t+e arro# on t+e lo#er side
Scheduled
dd ne# script to t+e list
,+e follo#ing fields s+ould 2e filled #+en
6llo#s to enter onl7
digits from .> and ( as a separator. B+en
te@t=2o@:
#rong address form is used. 0orrect form of t+e
-cript can run on tags. If group addresses
+as tag attac+ed to and script is using tag t+en
an7 telegram #+ic+ is send to t+e group #it+
-pecifies #+et+er t+e script is active
-pecifies #+et+er t+e
script is e@ecuted on %&' group read telegram.
6 ne# or e@isting name of t+e
t #ill 2e included. ,+is #ill not
affect on script action: +elps onl7 27 grouping
Tools 3
If t+e script is to 2e run onl7 on read

6dvanced guide | -cripting


.>
&"9"& =esident

Script name E ,+e name of t+e script

Sleep interval 8seconds9 E Interval after #+ic+
t+e script #ill 2e e@ecuted.

4ctiveE -pecifies #+et+er t+e script is active
8green circle9 or disa2led 8red circle9

Category E 6 ne# or e@isting name of t+e
categor7 t+e script #ill 2e included. ,+is #ill not
affect on script action: +elps onl7 27 grouping
t+e scripts and #atc+ing 27 categories in Tools 3
Print script listings page

!escriptionE Description of t+e script

&"9"3 +c(eduled

Script name E ,+e name of t+e script

$inute E Cinute

"our E Hour

!ay of the month E Da7 of t+e mont+

$onth of the year E Cont+ of t+e 7ear

!ay of the week E Da7 of t+e #eek

4ctiveE -pecifies #+et+er t+e script is active
8green circle9 or disa2led 8red circle9.

Category E 6 ne# or e@isting name of t+e
categor7 t+e script #ill 2e included. ,+is #ill not
affect on script action: +elps onl7 27 grouping
t+e scripts and #atc+ing 27 categories in Tools 3
Print script listings page.

!escriptionE description of t+e script


6dvanced guide | -cripting


6
&"9"7 @ser li3raries

<ser li2raries usuall7 contain user defined
functions #+ic+ are later called from ot+er
scripts.

-ecure t+e code

,+ere is an option keep source availa2le for user
li2raries. ?nce disa2led: t+e code is compiled in
t+e 2inar7 form and canHt 2e seen for furt+er
editing. If t+is option is ena2led: t+e source
code is seen in t+e editor.
Include t+e li2rar7 in t+e scripts

,o use functions defined in user li2rar7: t+e7
s+ould 2e included in t+e 2eginning of t+e
script: for e@ample: user li2rar7 #it+ t+e name
OtestH s+ould 2e included as 2elo# G
reAuire7Buser/testB8

&"9"< Common !unctions

Common functions contains li2rar7 of glo2all7
used functions. ,+e7 can 2e called from an7
script: an7 time: #it+out special including like
#it+ user libraries. "unctions like
sunrise(sunset: )mail are included 27 default in
0ommon functions.



&"9"6 +tartFup script

Init script is used for initiali1ation on specific
s7stem or 2us values on s7stem start. Init script
is run eac+ time after s7stem is restarted
8po#er up: re2oot in t+e -B or via /)-), pus+
2utton9.

&"9"G Tools

&'port helpers E )@port scripting +elpers

mport helpers E Import scripting +elpers

+estore helpers E /estore default scripting
+elpers

%ackup user scripts E *ackup all scripts in N.g1
file

6dvanced guide | -cripting


61
+estore from archive E /estore script from
arc+ive 8N.g19 file #it+ t#o possi2ilitiesG

/emove e@isting scripts and import from
2ackup.
6ppend keeping e@isting 8s9 scripts

Print script listings E s+o#s all scripts #it+
codes in list format sorted 27 0ategories.


&"9"' >eneral scripting description









,+ere are five actions 7ou can do #it+ eac+ of t+e scriptG
!uplicate E Duplicate t+e script #it+ its source code
&ditor E )nter scripting editor to #rite specific code for t+e particular program
4ctive E Cake script active 8green9 or deactivate it 8red9
&dit E )dit script name: description: categor7 and ot+er parameters
!elete E Delete t+e script. B+en pressing t+is icon t+e confirmation is asked to accept t+e delete.

6dvanced guide | -cripting


62
&"9"9 +cript :ditor

B+en a script is added icon appears in
&ditor column t+at allo#s opening a script in
scripting editor and re=#orking it #it+ 2uilt=in
code snippets. 0ode snippets save time and
make t+e coding convenient. 6fter clicking on
appropriate snippet: it automaticall7 adds code
to t+e editor field.
%e72oard s+ortcuts are implemented for +elp
#it+ script #riting

Ctrl ? - E "ind s7nta@ in a code: te@t #ill 2e
+ig+lig+ted in 7ello#.

Ctrl ? # E after finding a te@t via 0trlI" #e can
use 0trl ID to select ne@t s7nta@ in a script.

Shift ? Ctrl ? # E select previous s7nta@.

Shift ? Ctrl ? - E replace s7nta@ in a script 27
anot+er one. You #ill 2e allo# to c+ose one 27
one if 7ou #ant to c+ange it.

Shift ? Ctrl ? + = replace all s7nta@es in a script
27 anot+er one at once.

Ctrl ? Space E +elps to auto detect code and
#rite for 7ou. Press 0trl I -pace and #rite first
letter of a command t+en select correct one
from t+e list

,+ere are five main groups of -cript editorG

"elpers E Predefined code snippets: like if=t+en
statement. Helpers consist of t+ree main su2=
groupsG
Conditionals E If )lse If: If ,+en etc.
Loops and iterators E 6rra7: /epeat...<ntil etc
5ath E /andom value: 0eiling: 62solute value:
/ound etc.
+b,ects/)"* bus E Det o23ect value: Droup
read: Droup #rite: <pdate interval etc.
Storage E Det data from storage: -ave data to
storage
Script control E Det ot+er script status: ena2le
or disa2le ot+er scripts
!lerts and logs E 6lert: Log varia2les: "ormatted
alert
Time functions E Dela7 script e@ecution
5iscellaneous E -unrise(sunset etc.

6dvanced guide | -cripting


6!
Serial E 0ommunication t+roug+ internal
HomeLYnk I? ports
5odbus E 0reate /,<(,0P connection: Brite
register: /ead register etc.
65* E 0ommunication #it+ DC' devices
#roup addresses E e@isting group addresses on
t+e %&' 2us
(b5ects by name E 0+ose o23ect 27 name
Tags E 0+oose o23ect 27 tag
!ata types E 0+oose o23ect 27 data t7pe.


6dvanced guide | 6lerts

&"10 .lerts

In !lerts ta2 a list of alert messages defined #it+ alert function in scripts is located. ,+e messages
are stored in t+e main data2ase.









alert8message2 1var:2 1var@2 1varA3339
-tores alert message and current s7stem time in t+e main data2ase
&'ample
temperature K 2..!

if temperature Q 2$ t+en
## resulting messageC BTemperature levels are too highC ?D/EB
alert8U,emperature level is too +ig+G V.1fU: temperature9
end


6dvanced guide | Logs

&"11 Logs

Logs can 2e used for scripting code de2ugging. ,+e log messages appear defined 27 log function.
















log8var:2 1var@2 1varA2 ///339
0onverts varia2les to +uman=reada2le form and stores t+em.

:-ample
## log function accepts Lua nil2 boolean2 number and table 7up to D nested levels8 tpe variables
a KW ke71 KUvalue1U: ke72 K2X
2 KUtestU
c K12!.$.
## logs all passed variables
log8a: 2: c9


6dvanced guide | )rror log | Help

&"1& :rror Log

)rror messages from scripts are displa7ed in )rror log ta2.

&"13 Help



6dvanced guide | Cod2us(/-=$8.

3 Mod3us1=+F7'<
3"1 C(aracteristics

,+e Cod2us open standard allo#s 7ou to receive a more in=dept+ anal7sis of consumption in all
areas of 7our 2uilding.
You can connect up to !1 Cod2us devices(slaves of t+e follo#ing t7pes of meters 2ased on Cod2us
remote terminal unit 8/,<9 #it+in one Cod2us lineG

Y -c+neider )lectric energ7 meters
Y -c+neider )lectric po#er meters
Y -c+neider )lectric -mart Interface Codules 8-IC1C module9
Y &on=-c+neider )lectric Cod2us ,0P(/,< devices 8offering 7ou greater fle@i2ilit79

Bit+ t+e information #+ic+ t+e +omeLYnk provides 7ou can visuali1e energ7 or media consumption.
,+is can also 2e used to reduce consumption t+roug+ t+e use of control strategies #it+in t+e %&'(IP
net#ork.

Cod2us /,< is supported over /-$8. interface. Cod2us ,0P is supported over )t+ernet port.
Cod2us communication is done directl7 from scripts 8usuall7 resident script is used to read Cod2us
value after some specific time interval and #rite t+em into %&' o23ect or visuali1ation9.

?nce script is added: 7ou can add t+e code in t+e -cript )ditor. ,+ere are lots of predefined code
2locks in t+e Helpers.
4pplication &'ample

/eMuirements
Y measure and visuali1e +o# muc+ energ7 is used lig+ting an office 2uilding
Y measure t+e gas and #ater consumption in t+e 2uilding
Y monitor t+e Mualit7 of t+e net#ork to ensure t+e operational safet7 of I, eMuipment

-olution
Y install an i)C!1. meter to record t+e energ7 consumed 27 t+e lig+ting
Y install an i)C!2.. meter to determine t+e po#er mains Mualit7
Y install a -IC1C module to measure gas and #ater consumption via impulse
Y connect t+e devices to eac+ ot+er via Cod2us
3"1"1 Mod3us =T@ )nter!ace

Cod2us(/,< Caster
Cod2us(/,< -lave
Date#a7 Cod2us ,0P ( /,< ( %&' ,P1( %&' IP
0opper )t+ernet interface 1C2: 1C2
Be2 server
-upported "unction 0odesG Z1: Z2: Z!: Z$: Z.: Z6: Z;: Z": Z1
6dvanced guide | Cod2us(/-=$8.


68

3"1"& Mod3us TCP )nter!ace

Cod2us(,0P=IP 0lient
Cod2us(,0P=IP -erver
Date#a7 Cod2us ,0P ( /,< ( %&' ,P1( %&' IP
0opper )t+ernet interface 1C2: 1C2
DH0P support
Be2 server
Ca@. open ,0P connections 1
-upported "unction 0odesG Z1: Z2: Z!: Z$: Z.: Z6: Z;: Z": Z1
Drounding=Isolation
/-$8. interface is not isolatedR
Cetal cover of t+e /S$. socket is connected to device ground

3"& Con!iguration commands

Create 5odbus TCP ob,ect

reMuire8Uluamod2usU9
m2 K luamod2us.tcp89

Create 5odbus %T$ ob,ect

reMuire8Uluamod2usU9
m2 K luamod2us.rtu89

+pen 5odbus TCP connection

'PC @F?/@GH/@/?2 portC @?EI
m2Gopen8U1>2.168.1.2U: 12!$9
m2Gconnect89

6dvanced guide | Cod2us(/-=$8.


6>
+pen 5odbus %T$ connection

EHIJJ baud rate2 even parit2 H data bits2 @ stop bit2 half duple=
m2Gopen8U(dev(/-$8.U: 1>2: U)U: 8: 1: UHU9
m2Gconnect89

Terminal nameC

U(dev(/-$8.U

Supported (aud ratesC
! 2it(s
6 2it(s
12 2it(s
2$ 2it(s
$8 2it(s
>6 2it(s
19&00 3it1s
!8$ 2it(s
.;6 2it(s
11.2 2it(s
2!$ 2it(s

ParitC
[&4 &one
J:A :$en
[?4 ?dd

#ata 3its \&um2er of data 2its K .: 6: ;: ']
+top 3its \&um2er of stop 2its 1: 2]

6uple=C
JHA Hal! duple-
A5B "ull duple@ 8not supported in /-=$8.9

,+e *aud rate is set depending on t+e distance 2et#een Cod2us /,< devices. "or instance #it+ a
*aud rate of >6 2it(sec t+e ma@imum communication distance 2et#een 1 = 1. Cod2us /,<
devices is 1:2 metres. Bit+ t+e *aud rate of 1>2 2it(sec t+e ma@imum communication distance
is > metres: as t+e ta2le s+o#s 2elo#G

Parit7 refers to t+e tec+niMue of c+ecking if transmission +as 2een successful #+en transmitting
2et#een devices. It lets 7ou kno# if some data +as 2een lost during transmission.

6dvanced guide | Cod2us(/-=$8.


;
Setting of parit
,+e Cod2us supports onl7 11 2it frames. ,+e ),- application sets stop 2its automaticall7 depending
on t+e parit7 setting. FParit7F refers to t+e num2er of 1s in a given 2inar7 num2er. ?dd parit7 means
t+ere are an odd num2er of 1s and even parit7 means t+at t+ere is an even num2er of 1s. Parit7 2its
are used as a means of error detection as digital data is transmitted and received.
*ot+ t+e Date#a7 and Ceter must al#a7s 2e set to t+e same as one anot+er: odd: even or none.
,+e default parit7 mode of Cod2us is FevenF parit7.
Y Parit7 K &oneG c+oose 2et#een one and t#o stop 2its
Y Parit7 K )venG one stop 2it is set
Y Parit7 K ?ddG one stop 2it is set

6ela bet0een frames
-ome devices reMuire considera2le time after end of response until t+e7 are read7 to receive t+e
follo#ing reMuest from t+e master. In particular it applies to -c+neider )lectric -)P6C po#er devices
and legac7 slave devices. 6s t+e7 are slo# in dealing #it+ t+e original reMuest t+e7 ma7 miss t+e
follo#ing reMuest.
,+e time 2et#een reMuests s+ould 2e greater t+an !.. c+aracters according to t+e Cod2us
specification. Ho#ever: t+ese legac7 devices need more time. Please use dela7 command
appropriatel7G

Kait for @/D seconds
os"sleepD1"<E
Communication itsel! takes care o! minimal 36 < c(aracter dela2"


&=ampleC
init modbus on first script e=ecution
if not mb then
reAuire7BluamodbusB8
mb L luamodbus/rtu78
mbCopen7B/dev/%SIHDB2 EHIJJ2 B&B2 H2 @2 BHB8
mbCconnect78
end
mbCsetslave7EJ8
mbCflush78

,imeout interval 2et#een t#o consecutive 27tes of t+e same message

mbCgetbtetimeout78
mbCsetbtetimeout7timeout8

,imeout interval used to #ait for a responseG

mbCgetresponsetimeout78
mbCsetresponsetimeout7timeout8

,imeout interval used to for an incoming indication from master 8slave mode onl79G

mbCgetreceivetimeout78
mbCsetreceivetimeout7timeout8

6dvanced guide | Cod2us(/-=$8.


;1
Set slave address

m2Gsetslave812!9
:@//?IM9

%ead registers

read from address @JJJ
value K m2Greadregisters819

Close modbus connection

m2Gclose89



3"3 5unction codes D0""1&GE
FC#01 Read Coils
Name A=ead single coilB
Command coil ; m3readcoilsD1000E
\address]

Name A=ead Multiple coilB
Command coil16 coil&6 coil3 ; m3readcoilsD10006 3E
\-tarting address: Quantit7 of coils ( ma@ 2 2its]
1 K ?&: K ?""

,+is function code is used to read from 1 to 2 contiguous status of coils in a remote device. ,+e
/eMuest PD< specifies t+e starting address: i.e. t+e address of t+e first coil specified: and t+e num2er
of coils. In t+e PD< 0oils are addressed starting at 1ero. ,+erefore coils num2ered 1=16 are
addressed as =1..
,+e coils in t+e response message are packed as one coil per 2it of t+e data field. -tatus is indicated
as 1K ?& and K ?"". ,+e L-* of t+e first data 27te contains t+e output addressed in t+e Muer7. ,+e
ot+er coils follo# to#ard t+e +ig+ order end of t+is 27te: and from lo# order to +ig+ order in
su2seMuent 27tes.
If t+e returned output Muantit7 is not a multiple of eig+t: t+e remaining 2its in t+e final data 27te #ill
2e padded #it+ 1eros 8to#ard t+e +ig+ order end of t+e 27te9. ,+e *7te 0ount field specifies t+e
Muantit7 of complete 27tes of data.
6dvanced guide | Cod2us(/-=$8.


;2


FC#02 Read Discrete Inputs

Name A=ead discrete inputB
Command $alue ; m3readdiscreteinputsD1000E
\address]

Name A=ead discrete inputsB
Command $alue ; m3readdiscreteinputsD10006-E
\address of t+e first input specified: num2er of inputs]

,+is function code is used to read from 1 to 2 contiguous status of discrete inputs in a remote
device. ,+e /eMuest PD< specifies t+e starting address: i.e. t+e address of t+e first input specified:
and t+e num2er of inputs. In t+e PD< Discrete Inputs are addressed starting at 1ero. ,+erefore
Discrete inputs num2ered 1=16 are addressed as =1..
,+e discrete inputs in t+e response message are packed as one input per 2it of t+e data field. -tatus
is indicated as 1K ?&P K ?"". ,+e L-* of t+e first data 27te contains t+e input addressed in t+e
Muer7. ,+e ot+er inputs follo# to#ard t+e +ig+ order end of t+is 27te: and from lo# order to +ig+
order in su2seMuent 27tes.
If t+e returned input Muantit7 is not a multiple of eig+t: t+e remaining 2its in t+e final data 27te #ill
2e padded #it+ 1eros 8to#ard t+e +ig+ order end of t+e 27te9. ,+e *7te 0ount field specifies t+e
Muantit7 of complete 27tes of data.



6dvanced guide | Cod2us(/-=$8.


;!


FC#0 Read !olding registers

Name A=ead registersB
Command $alue ; m3readregistersD101<66E
\starting address: Muantit7 of registers 1..12.]

,+is function code is used to read t+e contents of a contiguous 2lock of +olding registers in a remote
device. ,+e /eMuest PD< specifies t+e starting register address and t+e num2er of registers. In t+e
PD< /egisters are addressed starting at 1ero. ,+erefore registers num2ered 1=16 are addressed as =
1..
,+e register data in t+e response message are packed as t#o 27tes per register: #it+ t+e 2inar7
contents rig+t 3ustified #it+in eac+ 27te. "or eac+ register: t+e first 27te contains t+e +ig+ order 2its
and t+e second contains t+e lo# order 2its.



FC#0" Read Input Registers

Name A=ead input registersB
Command $alue ; m3readinputregistersD101<66E
\starting address: Muantit7 of registers 1..12.]

,+is function code is used to read from 1 to 12. contiguous input registers in a remote device. ,+e
/eMuest PD< specifies t+e starting register address and t+e num2er of registers. In t+e PD<
/egisters are addressed starting at 1ero. ,+erefore input registers num2ered 1=16 are addressed as
=1..
,+e register data in t+e response message are packed as t#o 27tes per register: #it+ t+e 2inar7
contents rig+t 3ustified #it+in eac+ 27te. "or eac+ register: t+e first 27te contains t+e +ig+ order 2its
and t+e second contains t+e lo# order 2its.

6dvanced guide | Cod2us(/-=$8.


;$


FC#0# $rite Single Coil

Name A*rite single 3itB
Command $alue ; m3%rite3itsD10006 trueE
\starting address: value 4true5 or 4false5(55]

,+is function code is used to #rite a single output to eit+er ?& or ?"" in a remote device. ,+e
reMuested ?&(?"" state is specified 27 a constant in t+e reMuest data field. 6 value of "" +e@
reMuests t+e output to 2e ?&. 6 value of reMuests it to 2e ?"". 6ll ot+er values are illegal and
#ill not affect t+e output.
,+e /eMuest PD< specifies t+e address of t+e coil to 2e forced. 0oils are addressed starting at 1ero.
,+erefore coil num2ered 1 is addressed as . ,+e reMuested ?&(?"" state is specified 27 a constant
in t+e 0oil Aalue field. 6 value of '"" reMuests t+e coil to 2e ?&.
6 value of ' reMuests t+e coil to 2e off. 6ll ot+er values are illegal and #ill not affect t+e coil.
,+e normal response is an ec+o of t+e reMuest: returned after t+e coil state +as 2een #ritten.




FC#0% $rite Single Register

Name A*rite single registerB
Command $alue ; m3%riteregistersD10006 1&3E
\address: value]

,+is function code is used to #rite a single +olding register in a remote device. ,+e /eMuest PD<
specifies t+e address of t+e register to 2e #ritten. /egisters are addressed starting at 1ero. ,+erefore
6dvanced guide | Cod2us(/-=$8.


;.
register num2ered 1 is addressed as . ,+e normal response is an ec+o of t+e reMuest: returned after
t+e register contents +ave 2een #ritten.



FC#0F $rite &ultiple Coils

Name A*rite multiple 3itsB
Command $alue ; m3%rite3itsD10006 true6 !alse6true6KE
\address: 2it value1: 2it value2:..Wma@ 1>68 2itsX]

,+is function code is used to force eac+ coil in a seMuence of coils to eit+er ?& or ?"" in a remote
device. ,+e /eMuest PD< specifies t+e coil references to 2e forced. 0oils are addressed starting at
1ero. ,+erefore coil num2ered 1 is addressed as . ,+e reMuested ?&(?"" states are specified 27
contents of t+e reMuest data field. 6 logical U1U in a 2it position of t+e field reMuests t+e
corresponding output to 2e ?&. 6 logical UU reMuests it to 2e ?"". ,+e normal response returns t+e
function code: starting address: and Muantit7 of coils forced.



FC#10 $rite &ultiple Registers

Name A*rite multiple registersB
Command $alue ; m3%riteregistersD10006 1&36 3&16&&&6""E
\address: value1: value2: ..Wma@ 12! registersX]

6dvanced guide | Cod2us(/-=$8.


;6
,+is function code is used to #rite a 2lock of contiguous registers 81 to 12! registers9 in a remote
device. ,+e reMuested #ritten values are specified in t+e reMuest data field. Data is packed as t#o
27tes per register. ,+e normal response returns t+e function code: starting address: and Muantit7 of
registers #ritten.






'(ception codes )12*++2##,

m2Greadcoils8start: count9
m2Greaddiscreteinputs8start: count9
m2Greadregisters8start: count9
m2Greadinputregisters8start: count9

,+ese commands read one or man7 registers(coils from t+e start address and return all values on
success. In case of error: t+ree varia2les are sent 2ackG
&ill
)@ception code description
)@ception code


6dvanced guide | Cod2us(/-=$8.


;;

6dvanced guide | Cod2us(/-=$8.


;8
3"7 Master mode !unctions

m-.setsla/e)sla/eid,
sets slave id to read(#rite data from(to
m-.readcoils)start0 count, 1012
m-.readdiscreteinputs)start0 count, 1022
m-.readregisters)start0 count, 102
m-.readinputregisters)start0 count, 10"2
reads one or man7 registers(coils from t+e start address
returns all values on success and nil: error description on error
m-.write-its)start0 /10 1/20 1/0 +++22, 10#2
m-.writeregisters)start0 /10 1/20 1/0 +++22, 10%2
#rites values to registers(coils from t+e start address
single #rite #ill 2e used #+en onl7 one value is supplied: multiple #rite ot+er#ise
returns all of values #ritten on success and nil: error description on error
m-.reportsla/eid),
reads slave internal data
returns values on success and nil: error description on error

6dvanced guide | Cod2us(/-=$8.


;>

3"< +la$e mode !unctions

m-.recei/e),
receives data from master #it+ 1 minute timeout
returns data as a 2inar7 string on success and nil: error description on error
m-.setmapping)coils0 inputs0 !olding3regs0 input3regs,
creates memor7 mapping for t+e registers #it+ si1e specified for eac+ t7pe
m-.!andlesla/e),
#aits for an incoming indication from master and sends a repl7 #+en necessar7

m-.getcoils)start0 count,
m-.getdiscreteinputs)start0 count,
m-.getinputregisters)start0 count,
m-.getregisters)start0 count,
gets one or man7 register(coil values from mapping from t+e start address
returns all values on success and nil: error description on error: e@ception code if applica2le
m-.setcoils)start0 /10 1/20 1/0 +++22,
m-.setdiscreteinputs)start0 /10 1/20 1/0 +++22,
m-.setinputregisters)start0 /10 1/20 1/0 +++22,
m-.setregisters)start0 /10 1/20 1/0 +++22,
sets values to register(coil mapping from t+e start address
returns true on success and nil: error description on error: e@ception code if applica2le
m-.setwritecoilc-)4n,
m-.setwriteregisterc-)4n,
sets a call2ack function for coil(register #rite event
call2ack s+ould accept t#o parameters = coil(register address and value 82oolean or num2er9
for multiple #rites call2ack is e@ecuted for eac+ coil(register separatel7
use nil to remove a call2ack


6dvanced guide | /-=2!2

7 =+F&3&
7"1 C(aracteristics
,+e /-=2!2 serial interface communications standard +as 2een in use for ver7 man7 7ears and is one
of t+e most #idel7 used standards for serial data communications as a result of it 2eing simple and
relia2le.
,+e /-2!2 serial interface standard still retains its popularit7 and remains in #idespread use. It is still
found on some computers and on man7 interfaces: often 2eing used for applications ranging from
data acMuisition to suppl7ing a serial data communications facilit7 in general computer
environments.
,+e long term #idespread use of t+e /-2!2 standard +as meant t+at products are 2ot+ c+eap and
freel7 availa2le: and in t+ese da7s of ne# +ig+er speed standards: t+e relia2le: ro2ust /-2!2
standard still +as muc+ to offer. ,+e interface is intended to operate over distances of up to 1.
meterP it is 2ased on one Caster( one -lave rule.
6pplication e@ample
0onnection to simple devices or ot+er 2us su2 s7stems
6udio(video: I/ s7stem integration
7"& Con!iguration commands

Con!iguration commands %it( parameters are t(e same as t(e Mod3us =+F7'< serial connection
5pen connection
reMuire8UserialU9
port K serial.open8U(dev(/-2!2U: W2audrate K >6X9

$rite to port
portG#rite8Utest dataU9

6locking read
== script #ill 2lock until 1 c+aracters are read
data K portGread819
7imeout read
88 script will wait 4or 10 c!aracters 4or 20 seconds
data K portGread81: 29

Close serial port
port.close),



6dvanced guide | <-* 2.

< @+, &"0
<"1 C(aracteristics
<-* 2. provides a 2and#idt+ of $8 C2it(s: corresponding to an effective image data rate
of $ C*(s.
Integrated voltage suppl7 8. AD09 for devices in t+e $=pole ca2le. Devices compl7ing #it+ t+e
<-* specification ma7 consume a total of . m6 from t+e 2us. Devices #it+ a po#er of up
to 2.. B can t+erefore 2e supplied via t+e 2us.
<-* ca2le must onl7 2e $.. m long at t+e ma@imum.
Data transmission is possi2le in 2ot+ directions
6pplication e@ample
<-* interface can 2e used for e@tending memor7 capacit7 via attac+ing <-* flas+ drive.
<"& Con!iguration commands
/ead #+ole file at once. /eturns file contents as a string on success or nil on error.
io.readfile 8file9
Brites given data to a file. Data can 2e eit+er a value converti2le to string or a ta2le of suc+ values.
B+en data is a ta2le t+en eac+ ta2le item is terminated 27 a ne# line c+aracter. /eturn 2oolean as
#rite result #+en file can 2e open for #riting or nil #+en file cannot 2e accessed.
io.#ritefile 8file: data9
Note <-* flas+ drive supports "6,: "6,!2 and &,"- file s7stem. Ca@imum si1e of "las+ drive is
!2D*.
+end and recei$e +M+ messages $ia attac(ing @+, >+M adapter"
<se Hua#ei )1;! modem
,+e modem +as to 2e plugged into an7 of <-* ports of LC2 and it starts operating
immediatel7
-pecific functions s+ould 2e added into user script li2rar7 #it+ PI& code setting and
telep+one num2er #+ite=list #+ic+ #ill 2e a2le to receive and send in -C- messages
0ommand s7nta@
Brite to 2usG
B 6LI6- A6L<)
/ead from 2usG
/ 6LI6-
?n read reMuest: script #ill repl7 #it+ -C- message containing current value of selected
o23ect
6dvanced guide | <-* 2.


82
6LI6- can 2eG
Droup address 8e.g. 1(1(19
&ame 8e.g. ?2319. If name contains spaces t+en it must 2e escaped using dou2le Muotes 8e.g.
4/oom ,emperature59
Note ?23ect data t7pe and name must 2e set in 0onfigurator =Q ?23ects ta2. ?t+er#ise script #onHt
2e a2le to read and #rite to o23ect
Note ?nl7 6-0II s7m2ols are accepted in t+e message

6dvanced guide | L<6 E Programming language


8!
6 L@. L Programming Language
L<6 is a po#erful: fast: lig+t#eig+t: em2edda2le scripting language. L<6 com2ines simple
procedural s7nta@ #it+ po#erful data description constructs 2ased on associative arra7s and
e@tensi2le semantics. L<6 is d7namicall7 t7ped: runs 27 interpreting 27te code for a register=2ased
virtual mac+ine: and +as automatic memor7 management #it+ incremental gar2age collection:
making it ideal for configuration: scripting: and rapid protot7ping.
6"1 034ect !unctions
grp provides simplified access to t+e o23ects stored in t+e data2ase and group address reMuest
+elpers.
Cost functions use alias parameter ^ o23ect group address or uniMue o23ect name. 8e.g. U1(1(1U or
UC7 o23ectU9
grp+get/alue)alias,
/eturns value for t+e given alias or L<6 nil #+en o23ect cannot 2e found.
grp+4ind)alias,
/eturns single o23ect for t+e given alias. ?23ect value #ill 2e decoded automaticall7 onl7 if t+e data
t7pe +as 2een specified in t+e U?23ectsU module. /eturns L<6 nil #+en o23ect cannot 2e found:
ot+er#ise it returns L<6 table #it+ t+e follo#ing itemsG
address ^ o23ect group address
updatetime ^ latest update time in <&I' timestamp format. <se L<6 os/date78 to convert to
reada2le date formats
B+en o23ect data t7pe +as 2een specified in t+e U?23ectsU module t+e follo#ing fields are availa2leG
name ^ uniMue o23ect name
datatpe ^ o23ect data t7pe as specified 27 user
decoded ^ set to true #+en decoded value is availa2le
value ^ decoded o23ect value
grp+tag)tags0 mode,
/eturns L<6 table containing o23ects #it+ t+e given tag. ,ags parameter can 2e eit+er L<6 table or a
string. Code parameter can 2e eit+er UallU 8return o23ects t+at +ave all of t+e given tags9 or Uan7U
8default ^ returns o23ects t+at +ave an7 of t+e given tags9. You can use %eturned ob,ect functions on
t+e returned ta2le.
grp+alias )alias,
0onverts group address to o23ect name or name to address. /eturns L<6 nil #+en o23ect cannot 2e
found.
6"& >roup communication !unctions
,+ese functions s+ould onl7 2e used if it is reMuired to access o23ects 27 group address directl7: it is
recommended to use single or multiple o23ect functions.
grp+write )alias0 /alue2 datatpe,
-ends group #rite reMuest to t+e given alias. Data t7pe is taken from t+e data2ase if not specified as
t+ird parameter. /eturns L<6 boolean as t+e result.
6dvanced guide | L<6 E Programming language


8$
grp+response )alias0 /alue2 datatpe,
-imilar to grp/0rite. -ends group response reMuest to t+e given alias.
grp+read)alias,
-ends group read reMuest to t+e given alias. &oteG t+is function returns immediatel7 and cannot 2e
used to return t+e result of read reMuest. <se event=2ased script instead.
grp+update)alias0 /alue2 datatpe,
-imilar to grp/0rite: 2ut does not send ne# value to t+e 2us. <seful for o23ects t+at are used onl7 in
visuali1ation.
6"3 =eturned o34ect !unctions
?23ects received 27 using grp/find7alias8 or grp/tag7tags2 mode8 +ave t+e follo#ing functions
attac+ed to t+emG
6l#a7s c+eck t+at t+e returned o23ect #as found ot+er#ise calling t+ese functions #ill result in
an error. -ee t+e e@ample 2elo#.
o-9ect.write)/alue2 datatpe,
-ends group #rite reMuest to o23ectUs group address. Data t7pe is taken from t+e data2ase if not
specified as second parameter. /eturns L<6 boolean as t+e result.
o-9ect.response)/alue2 datatpe,
-imilar to ob,ectC0rite. -ends group response reMuest to o23ectUs group address.
o-9ect.read),
-ends group read reMuest to o23ectUs group address. &oteG t+is function returns immediatel7 and
cannot 2e used to return t+e result of read reMuest. <se event=2ased script instead.
o-9ect.update)/alue2 datatpe,
-imilar to ob,ectC0rite: 2ut does not send ne# value to t+e 2us. <seful for o23ects t+at are used
onl7 in visuali1ation.
6"7 #ata t2pe !unctions
kn'datatype o23ect provides data encoding and decoding 2et#een L<6 and %&' data formats.
kn(datatype+decode)/alue0 datatype,
0onverts +e@=encoded data to L<6 varia2le 2ased on given data t7pe. Data t7pe is specified eit+er as
%&' primar7 data t7pe 8integer 2et#een 1 and 169 or a secondar7 data t7pe 8integer 2et#een 1
and 169./eturn valuesG
success ^ decoded data as L<6 varia2le 8t7pe depends on data t7pe9: value lengt+ in 27tes
error ^ nil: error string
6"< #ata t2pes
,+e follo#ing data t7pes can 2e used for encoding and decoding of %&' data. Data representation
on L<6 level and predefined constants 8in 2old9 is given 2elo#G
bool @ bit 7boolean8 # dt/^ 2oolean
? bit 7@ bit controlled8 # dt/bit@ ^ num2er
I bit 7E bit controlled8 # dt/bitB ^ num2er
@ bte !SC'' character # dt/char ^ string
@ bte unsigned integer # dt/uintC ^ num2er
@ bte signed integer # dt/intC ^ num2er
? bte unsigned integer # dt/uint:D ^ num2er
6dvanced guide | L<6 E Programming language


8.
? bte signed integer # dt/int:D ^ num2er
? bte floating point # dt/float:D ^ num2er
E bte time / da # dt/time ^ ta2le #it+ t+e follo#ing itemsG
o da7 ^ num2er 8=;9
o +our ^ num2er 8=2!9
o minute ^ num2er 8=.>9
o second ^ num2er 8=.>9
E bte date # dt/date ^ ta2le #it+ t+e follo#ing itemsG
o da7 ^ num2er 81=!19
o mont+ ^ num2er 81=129
o 7ear ^ num2er 81>>=28>9
I bte unsigned integer # dt/uintA@ ^ num2er
I bte signed integer # dt/intA@ ^ num2er
I bte floating point # dt/floatA@ ^ num2er
I bte access control # dt/access ^ num2er: currentl7 not full7 supported
@I bte !SC'' string # dt/string ^ string: null c+aracters 8U_U9 are discarded during decoding
6"6 #ata storage !unctions
storage o23ect provides persistent ke7=value data storage for user scripts. ?nl7 t+e follo#ing L<6
data t7pes are supportedG
boolean
number
string
table
storage+set)key0 /alue,
-ets ne# value for t+e given ke7. ?ld value is over#ritten. /eturns 2oolean as t+e result and an
optional error string.
storage+get)key0 de4ault,
Dets value for t+e given ke7 or returns default value 8nil if not specified9 if ke7 is not found in t+e
data storage.
&oteG all user scripts s+are t+e same data storage. Cake sure t+at same ke7s are not used to store
different t7pes of data.
&=amples
,+e follo#ing e@amples s+o#s t+e 2asic s7nta@ of storage/set. /esult #ill return
2oolean true since t+e passed parameters are correct
resultKstorage.set8Um7`stored`value`1U: 12.219
,+is e@ample #ill return false as t+e result 2ecause #e are tr7ing to store a function #+ic+ is
not possi2le.
testfnKfunction8t9
return t N t
end
result Kstorage.set8Um7`stored`value`2U: testfn9## this 0ill result in an error

6dvanced guide | L<6 E Programming language


86
,+e follo#ing e@amples s+o#s t+e 2asic s7nta@ of storage/get. 6ssuming t+at ke7 value #as
not found: first call #ill return nil #+ile second call #ill return num2er J #+ic+ #as specified
as a default value.
result Kstorage.get8Um7`stored`value`!U9## returns nil if value is not found
result Kstorage.get8Um7`stored`value`!U: 9## returns J if value is not found

B+en storing ta2les make sure to c+eck t+e returned result t7pe. 6ssume #e +ave created a
storage item #it+ ke7 test<ob,ect<data.
o23ectdataKWX
o23ectdata.temperatureK2!.1
o23ectdata.sceneKUdefaultU
result Kstorage.set8Utest`o23ect`dataU: o23ectdata9## store ob,ectdata variable as
Btest<ob,ect<dataB

&o# #e are retrieving data from storage. Data t7pe is c+ecked for correctness.
o23ectdataKstorage.get8Utest`o23ect`dataU9
if t7pe8o23ectdata9KKUta2leUt+en
if o23ectdata.temperatureQ 2$ t+en
## do something if temperature level is too high
end
end

6"G .lert !unctions
:lert )message0 1/ar10 1/ar20 1/ar222,
-tores alert message and current s7stem time in t+e main data2ase. 6ll alerts are accessi2le in t+e
F6lertsF module. ,+is function 2e+aves e@actl7 as L<6 string/format.
&'ample
temperature K 2..!
if temperature Q 2$ t+en
## resulting messageC BTemperature levels are too highC ?D/EB
alert8U,emperature level is too +ig+G V.1fU: temperature9
end
6dvanced guide | L<6 E Programming language


8;

6"' Log !unctions
;og )/ar10 1/ar20 1/ar0 +++22,
0onverts varia2les to +uman=reada2le form and stores t+em in t+e main data2ase. 6ll items are
accessi2le in t+e FLogsF module.
&'ample
## log function accepts L$! nil2 boolean2 number and table 7up to D nested levels8 tpe variables
a KW ke71 KUvalue1U: ke72 K2X
2 KUtestU
c K12!.$.
## logs all passed variables
log8a: 2: c9

6"9 Time !unctions
os+sleep)delay,
Dela7 t+e ne@t command e@ecution for t+e dela7 seconds.

os/microtime 78
/eturns t#o valuesG current timestamp in seconds and timestamp fraction in nanoseconds

os/udifftime 7sec2 usec8
/eturns time difference as floating point value 2et#een no# and timestamp components passed
to t+is function 8seconds: nanoseconds9

6dvanced guide | L<6 E Programming language


88
6"10 +tring !unctions
,+is li2rar7 provides generic functions for string manipulation: suc+ as finding and e@tracting
su2strings: and pattern matc+ing. B+en inde@ing a string in L<6: t+e first c+aracter is at position 1
8not at : as in 09.
Indices are allo#ed to 2e negative and are interpreted as inde@ing 2ack#ards: from t+e end of t+e
string. ,+us: t+e last c+aracter is at position =1: and so on.
,+e string li2rar7 provides all its functions inside t+e ta2le string. It also sets a metata2le for strings
#+ere t+e ``inde@ field points to t+e string ta2le. ,+erefore: 7ou can use t+e string functions in
o23ect=oriented st7le. "or instance: string/bte7s2 i8 can 2e #ritten as sCbte7i8. ,+e string li2rar7
assumes one=27te c+aracter encodings.
string+trim )str,
,rims t+e leading and trailing spaces off a given string.
string+split )str0 sep,
-plits string 27 given separator string. /eturns L<6 ta2le.
string+-yte )s 10 i 10 922,
/eturns t+e internal numerical codes of t+e c+aracters s:i92 s:iN@92 OOO2 s:,9. ,+e default value for i is 1P
t+e default value for , is i. &ote t+at numerical codes are not necessaril7 porta2le across platforms.
string+c!ar )<<<,
/eceives 1ero or more integers. /eturns a string #it+ lengt+ eMual to t+e num2er of arguments: in
#+ic+ eac+ c+aracter +as t+e internal numerical code eMual to its corresponding argument. &ote
t+at numerical codes are not necessaril7 porta2le across platforms.
string+4ind )s0 pattern 10 init 10 plain22,
Looks for t+e first matc+ of pattern in t+e string s. If it finds a matc+: t+en find returns t+e indices of
s #+ere t+is occurrence starts and endsP ot+er#ise: it returns nil. 6 t+ird: optional numerical
argument init specifies #+ere to start t+e searc+P its default value is 1 and can 2e negative. 6 value
of true as a fourt+: optional argument plain turns off t+e pattern matc+ing facilities: so t+e function
does a plain Ffind su2stringF operation: #it+ no c+aracters in pattern 2eing considered FmagicF.
&ote t+at if plain is given: t+en init must 2e given as #ell. If t+e pattern +as captures: t+en in a
successful matc+ t+e captured values are also returned: after t+e t#o indices.
string+4ormat )4ormatstring0 <<<,
/eturns a formatted version of its varia2le num2er of arguments follo#ing t+e description given in
its first argument 8#+ic+ must 2e a string9. ,+e format string follo#s t+e same rules as t+e printf
famil7 of standard 0 functions. ,+e onl7 differences are t+at t+e options(modifiers N: l: L: n: p: and +
are not supported and t+at t+ere is an e@tra option: M. ,+e M option formats a string in a form
suita2le to 2e safel7 read 2ack 27 t+e L<6 interpreterG t+e string is #ritten 2et#een dou2le Muotes:
and all dou2le Muotes: ne#lines: em2edded 1eros: and 2ackslas+es in t+e string are correctl7
escaped #+en #ritten. "or instance: t+e call
string.format8UVMU: Ua string #it+ FMuotesF and Mn ne# lineU9
#ill produce t+e stringG
6dvanced guide | L<6 E Programming language


8>
Pa string 0ith QPAuotesQP and Q
ne0 lineP
,+e options c2 d2 &2 e2 f2 g2 42 i2 o2 u2 *2 and = all e@pect a num2er as argument: #+ereas A and s
e@pect a string. ,+is function does not accept string values containing em2edded 1eros: e@cept as
arguments to t+e A option.
string+gmatc! )s0 pattern,
/eturns an iterator function t+at: eac+ time it is called: returns t+e ne@t captures from pattern over
string s. If pattern specifies no captures: t+en t+e #+ole matc+ is produced in eac+ call. 6s an
e@ample: t+e follo#ing loop
s K F+ello #orld from L<6F
for # in string.gmatc+8s: FVaIF9 do
print8#9
end

#ill iterate over all t+e #ords from string s: printing one per line. ,+e ne@t e@ample collects all pairs
keLvalue from t+e given string into a ta2leG
t K WX
s K FfromK#orld: toKL<6F
for k: v in string.gmatc+8s: F8V#I9K8V#I9F9 do
t\k] K v
end

"or t+is function: a UaU at t+e start of a pattern does not #ork as an anc+or: as t+is #ould prevent t+e
iteration.
string+gsu- )s0 pattern0 repl 10 n2,
/eturns a cop7 of s in #+ic+ all 8or t+e first n: if given9 occurrences of t+e pattern +ave 2een
replaced 27 a replacement string specified 27 repl: #+ic+ can 2e a string: a ta2le: or a function. gsu2
also returns: as its second value: t+e total num2er of matc+es t+at occurred.
If repl is a string: t+en its value is used for replacement. ,+e c+aracter V #orks as an escape
c+aracterG an7 seMuence in repl of t+e form Rn: #it+ n 2et#een 1 and >: stands for t+e value of t+e
n=t+ captured su2string 8see 2elo#9. ,+e seMuence V stands for t+e #+ole matc+. ,+e seMuence
VV stands for a single V.
If repl is a ta2le: t+en t+e ta2le is Mueried for ever7 matc+: using t+e first capture as t+e ke7P if t+e
pattern specifies no captures: t+en t+e #+ole matc+ is used as t+e ke7.
If repl is a function: t+en t+is function is called ever7 time a matc+ occurs: #it+ all captured
su2strings passed as arguments: in orderP if t+e pattern specifies no captures: t+en t+e #+ole matc+
is passed as a sole argument.
If t+e value returned 27 t+e ta2le Muer7 or 27 t+e function call is a string or a num2er: t+en it is used
as t+e replacement stringP ot+er#ise: if it is false or nil: t+en t+ere is no replacement 8t+at is: t+e
original matc+ is kept in t+e string9.
6dvanced guide | L<6 E Programming language


>
)@amplesG
@ K string.gsu28F+ello #orldF: F8V#I9F: FV1 V1F9
==Q @KF+ello +ello #orld #orldF
@ K string.gsu28F+ello #orldF: FV#IF: FV VF: 19
==Q @KF+ello +ello #orldF
@ K string.gsu28F+ello #orld from L<6F: F8V#I9VsN8V#I9F: FV2 V1F9
==Q @KF#orld +ello L<6 fromF
@ K string.gsu28F+ome K bH?C): user K b<-)/F: FVb8V#I9F: os.getenv9
==Q @KF+ome K (+ome(ro2erto: user K ro2ertoF
@ K string.gsu28F$I. K breturn $I.bF: FVb8.=9VbF: function 8s9
return loadstring8s989
end9
==Q @KF$I. K >F
local t K WnameKFL<6F: versionKF..1FX
@ K string.gsu28Fbname=bversion.tar.g1F: FVb8V#I9F: t9
==Q @KFL<6=..1.tar.g1F
string+len )s,
/eceives a string and returns its lengt+. ,+e empt7 string FF +as lengt+ . )m2edded 1eros are
counted: so Fa_2c_F +as lengt+ ..
string+lower )s,
/eceives a string and returns a cop7 of t+is string #it+ all uppercase letters c+anged to lo#ercase. 6ll
ot+er c+aracters are left unc+anged. ,+e definition of #+at an uppercase letter is depends on t+e
current locale.
string+matc! )s0 pattern 10 init2,
Looks for t+e first matc+ of pattern in t+e string s. If it finds one: t+en matc+ returns t+e captures
from t+e patternP ot+er#ise it returns nil. If pattern specifies no captures: t+en t+e #+ole matc+ is
returned. 6 t+ird: optional numerical argument init specifies #+ere to start t+e searc+P its default
value is 1 and can 2e negative.
string+rep )s0 n,
/eturns a string t+at is t+e concatenation of n copies of t+e string s.
string+re/erse )s,
/eturns a string t+at is t+e string s reversed.
6dvanced guide | L<6 E Programming language


>1
string+su- )s0 i 10 92,
/eturns t+e su2string of s t+at starts at i and continues until 3P i and 3 can 2e negative. If 3 is a2sent:
t+en it is assumed to 2e eMual to =1 8#+ic+ is t+e same as t+e string lengt+9. In particular: t+e call
string/sub7s2@2,8 returns a prefi@ of s #it+ lengt+ 3: and string/sub7s2 #i8 returns a suffi@ of s #it+ lengt+
i.
string+upper )s,
/eceives a string and returns a cop7 of t+is string #it+ all lo#ercase letters c+anged to uppercase. 6ll
ot+er c+aracters are left unc+anged. ,+e definition of #+at a lo#ercase letter is depends on t+e
current locale.
Patterns
0+aracter 0lassG
6 c+aracter class is used to represent a set of c+aracters. ,+e follo#ing com2inations are allo#ed in
descri2ing a c+aracter classG
Y -G 8#+ere @ is not one of t+e magic c+aracters ab89V.\]NI=J9 represents t+e c+aracter @
itself.
Y "G 8a dot9 represents all c+aracters.
Y NaG represents all letters.
Y NcG represents all control c+aracters.
Y NdG represents all digits.
Y NlG represents all lo#ercase letters.
Y NpG represents all punctuation c+aracters.
Y NsG represents all space c+aracters.
Y NuG represents all uppercase letters.
Y N%G represents all alp+anumeric c+aracters.
Y N-G represents all +e@adecimal digits.
Y N?G represents t+e c+aracter #it+ representation .
Y N-G 8#+ere @ is an7 non=alp+anumeric c+aracter9 represents t+e c+aracter @. ,+is is t+e
standard #a7 to escape t+e magic c+aracters. 6n7 punctuation c+aracter 8even t+e non
magic9 can 2e preceded 27 a UVU #+en used to represent itself in a pattern.
Y OsetPG represents t+e class #+ic+ is t+e union of all c+aracters in set. 6 range of c+aracters
can 2e specified 27 separating t+e end c+aracters of t+e range #it+ a U=U. 6ll classes V@
descri2ed a2ove can also 2e used as components in set. 6ll ot+er c+aracters in set represent
t+emselves. "or e@ample: \V#`] 8or \`V#]9 represents all alp+anumeric c+aracters plus t+e
6dvanced guide | L<6 E Programming language


>2
underscore: \=;] represents t+e octal digits: and \=;VlV=] represents t+e octal digits plus
t+e lo#ercase letters plus t+e U=U c+aracter.
Y ,+e interaction 2et#een ranges and classes is not defined. ,+erefore: patterns like \Va=1]
or \a=VV] +ave no meaning.
Y OQsetPG represents t+e complement of set: #+ere set is interpreted as a2ove.
"or all classes represented 27 single letters 8Va: Vc: etc.9: t+e corresponding uppercase letter
represents t+e complement of t+e class. "or instance: V- represents all non=space c+aracters.
,+e definitions of letter: space: and ot+er c+aracter groups depend on t+e current locale. In
particular: t+e class \a=1] ma7 not 2e eMuivalent to Vl.
Pattern )tem
6 pattern item can 2eG
Y a single c+aracter class: #+ic+ matc+es an7 single c+aracter in t+e classP
Y a single c+aracter class follo#ed 27 UNU: #+ic+ matc+es or more repetitions of c+aracters
in t+e class. ,+ese repetition items #ill al#a7s matc+ t+e longest possi2le seMuenceP
Y a single c+aracter class follo#ed 27 UIU: #+ic+ matc+es 1 or more repetitions of c+aracters
in t+e class. ,+ese repetition items #ill al#a7s matc+ t+e longest possi2le seMuenceP
Y a single c+aracter class follo#ed 27 U=U: #+ic+ also matc+es or more repetitions of
c+aracters in t+e class. <nlike UNU: t+ese repetition items #ill al#a7s matc+ t+e s+ortest
possi2le seMuenceP
Y a single c+aracter class follo#ed 27 UJU: #+ic+ matc+es or 1 occurrence of a c+aracter in
t+e classP
Y Vn: for n 2et#een 1 and >P suc+ item matc+es a su2string eMual to t+e n=t+ captured string
8see 2elo#9P
Y V2@7: #+ere @ and 7 are t#o distinct c+aractersP suc+ item matc+es strings t+at start #it+
@: end #it+ 7: and #+ere t+e @ and 7 are 2alanced. ,+is means t+at: if one reads t+e string
from left to rig+t: counting I1 for an @ and =1 for a 7: t+e ending 7 is t+e first 7 #+ere t+e
count reac+es . "or instance: t+e item V289 matc+es e@pressions #it+ 2alanced
parent+eses.
Pattern
6 pattern is a seMuence of pattern items. 6 UaU at t+e 2eginning of a pattern anc+ors t+e matc+ at t+e
2eginning of t+e su23ect string. 6 UbU at t+e end of a pattern anc+ors t+e matc+ at t+e end of t+e
su23ect string. 6t ot+er positions: UaU and UbU +ave no special meaning and represent t+emselves.
Captures
6dvanced guide | L<6 E Programming language


>!
6 pattern can contain su2=patterns enclosed in parent+esesP t+e7 descri2e captures. B+en a matc+
succeeds: t+e su2strings of t+e su23ect string t+at matc+ captures are stored 8captured9 for future
use. 0aptures are num2ered according to t+eir left parent+eses. "or instance: in t+e pattern
F8aN8.9V#8VsN99F: t+e part of t+e string matc+ing FaN8.9V#8VsN9F is stored as t+e first capture 8and
t+erefore +as num2er 19P t+e c+aracter matc+ing F.F is captured #it+ num2er 2: and t+e part
matc+ing FVsNF +as num2er !.
6s a special case: t+e empt7 capture 89 captures t+e current string position 8a num2er9. "or instance:
if #e appl7 t+e pattern F89aa89F on t+e string FflaaapF: t+ere #ill 2e t#o capturesG ! and .. 6 pattern
cannot contain em2edded 1eros. <se V1 instead.
6"11 )nput and output !unctions
io+e(ists )pat!,
0+ecks if given pat+ 8file or director79 e@ists. /eturn 2oolean.
io+read4ile )4ile,
/eads #+ole file at once. /eturn file contents as a string on success or nil on error.
io+write4ile )4ile0 data,
Brites given data to a file. Data can 2e eit+er a value converti2le to string or a ta2le of suc+
values. B+en data is a ta2le t+en eac+ ta2le item is terminated 27 a ne# line c+aracter. /eturn
2oolean as #rite result #+en file can 2e open for #riting or nil #+en file cannot 2e accessed.
6"1& +cript control !unction
script+ena-le)=scriptname=,
)na2le t+e script #it+ t+e name scriptname.
script+disa-le)=scriptname=,
Disa2le t+e script #it+ t+e name scriptname.
status > script+status)=scriptname=,
/eturns true(false if script is found: nil ot+er#ise
6"13 Con$ersions

0ompati2ilit7 la7erG lmcore is an alias of cnv.
cn/+strto!e( )str,
0onverts given 2inar7 string to a +e@=encoded string.
cn/+!e(tostr )!e( 10 keepnulls2,
0onverts given +e@=encoded string to a 2inar7 string. &<LL c+aracters are ignored 27 default: 2ut
can 2e included 27 setting second parameter to true.
cn/+tonum-er )/alue,
0onverts t+e given value to num2er using follo#ing rulesG num2ers and valid numeric strings are
treated as is: 2oolean true is 1: 2oolean false is : ever7t+ing else is nil.
cn/+!e(toint)!e(/alue0 -ytes,
0onverts t+e given +e@ string to and integer of a given lengt+ in 27tes.
6dvanced guide | L<6 E Programming language


>$
cn/+intto!e()int/alue0 -ytes,
0onverts t+e given integer to a +e@ string of given 27tes.
cn/+strto!e()str,
0onverts t+e given 2inar7 string to a +e@=encoded string.
cn/+!e(tostr)!e(str,
0onverts t+e given +e@=encoded string to a 2inar7 string.

6"17 ,it operators
-it+-not )/alue,
*inar7 not
-it+-and )(1 10 (2+++2,
*inar7 and 2et#een an7 num2er of varia2les
-it+-or )(1 10 (2+++2,
*inar7 and 2et#een an7 num2er of varia2les
-it+-(or )(1 10 (2+++2,
*inar7 and 2et#een an7 num2er of varia2les
-it+ls!i4t )/alue0 s!i4t,
Left 2inar7 s+ift
-it+rs!i4t )/alue0 s!i4t,
/ig+t 2inar7 s+ift
6"1< )nput and output !acilities

,+e I(? li2rar7 provides t#o different st7les for file manipulation. ,+e first one uses implicit file
descriptorsP t+at is: t+ere are operations to set a default input file and a default output file: and
all input(output operations are over t+ese default files. ,+e second st7le uses e@plicit file
descriptors.
B+en using implicit file descriptors: all operations are supplied 27 ta2le io. B+en using e@plicit
file descriptors: t+e operation io/open returns a file descriptor and t+en all operations are
supplied as met+ods of t+e file descriptor.
,+e ta2le io also provides t+ree predefined file descriptors #it+ t+eir usual meanings from 0G
io/stdin2 io/stdout: and io/stderr. ,+e I(? li2rar7 never closes t+ese files.
<nless ot+er#ise stated: all I(? functions return nil on failure 8plus an error message as a second
result and a s7stem=dependent error code as a t+ird result9 and some value different from nil on
success.
io+close )14ile2,
)Muivalent to fileCclose78. Bit+out a file: closes t+e default output file.
io+4lus! ),
)Muivalent to fileGflus+ over t+e default output file.
6dvanced guide | L<6 E Programming language


>.
io+input )14ile2,
B+en called #it+ a file name: it opens t+e named file 8in te@t mode9: and sets its +andle as t+e
default input file. B+en called #it+ a file +andle: it simpl7 sets t+is file +andle as t+e default
input file. B+en called #it+out parameters: it returns t+e current default input file. In case of
errors t+is function raises t+e error: instead of returning an error code.

io+lines )14ilename2,
?pens t+e given file name in read mode and returns an iterator function t+at: eac+ time it is
called: returns a ne# line from t+e file. ,+erefore: t+e construction #ill iterate over all lines of
t+e file. B+en t+e iterator function detects t+e end of file: it returns nil 8to finis+ t+e loop9 and
automaticall7 closes t+e file.

for line in io/lines7filename8 do bod end

,+e call io/lines78 8#it+ no file name9 is eMuivalent to io/input78Clines78P t+at is: it iterates over t+e
lines of t+e default input file. In t+is case it does not close t+e file #+en t+e loop ends.

io+open )4ilename 10 mode2,
,+is function opens a file: in t+e mode specified in t+e string mode. It returns a ne# file +andle:
or: in case of errors: nil plus an error message. ,+e mode string can 2e an7 of t+e follo#ingG
Y FrFG read mode 8t+e default9P
Y F#FG #rite modeP
Y FaFG append modeP
Y FrIFG update mode: all previous data is preservedP
Y F#IFG update mode: all previous data is erasedP
Y FaIFG append update mode: previous data is preserved: #riting is onl7 allo#ed at t+e end of
file.

,+e mode string can also +ave a U2U at t+e end: #+ic+ is needed in some s7stems to open t+e file
in 2inar7 mode. ,+is string is e@actl7 #+at is used in t+e standard 0 function fopen.
io+output )14ile2,
-imilar to io.input: 2ut operates over t+e default output file.
6"16 Mat(ematical !unctions

,+is li2rar7 is an interface to t+e standard 0 mat+ li2rar7. It provides all its functions inside t+e
ta2le mat+.
mat!+a-s )(,
/eturns t+e a2solute value of @.
mat!+acos )(,
/eturns t+e arc cosine of @ 8in radians9.
mat!+asin )(,
/eturns t+e arc sine of @ 8in radians9.
6dvanced guide | L<6 E Programming language


>6
mat!+atan )(,
/eturns t+e arc tangent of @ 8in radians9.
mat!+atan2 )y0 (,
/eturns t+e arc tangent of 7(@ 8in radians9: 2ut uses t+e signs of 2ot+ parameters to find t+e
Muadrant of t+e result. 8It also +andles correctl7 t+e case of @ 2eing 1ero.9
mat!+ceil )(,
/eturns t+e smallest integer larger t+an or eMual to @.
mat!+cos )(,
/eturns t+e cosine of @ 8assumed to 2e in radians9.
mat!+cos! )(,
/eturns t+e +7per2olic cosine of @.

mat!+deg )(,
/eturns t+e angle @ 8given in radians9 in degrees.
mat!+e(p )(,
/eturns t+e value

.
mat!+4loor )(,
/eturns t+e largest integer smaller t+an or eMual to @.
mat!+4mod )(0 y,
/eturns t+e remainder of t+e division of @ 27 7 t+at rounds t+e Muotient to#ards 1ero.
mat!+4re(p )(,
/eturns m and e suc+ t+at @ K 2

: e is an integer and t+e a2solute value of m is in t+e range


\..: 19 8or 1ero #+en @ is 1ero9.
mat!+!uge
,+e value H<D)`A6L: a value larger t+an or eMual to an7 ot+er numerical value.
mat!+lde(p )m0 e,
/eturns 2

: 8e s+ould 2e an integer9.
mat!+log )(,
/eturns t+e natural logarit+m of @.
mat!+log10 )(,
/eturns t+e 2ase=1 logarit+m of @.
mat!+ma( )(0 <<<,
/eturns t+e ma@imum value among its arguments.
mat!+min )(0 <<<,
/eturns t+e minimum value among its arguments.
mat!+mod4 )(,
/eturns t#o num2ers: t+e integral part of @ and t+e fractional part of @.
6dvanced guide | L<6 E Programming language


>;
mat!+pi
,+e value of pi.
mat!+pow )(0 y,
/eturns

. 8You can also use t+e e@pression @a7 to compute t+is value.9
mat!+rad )(,
/eturns t+e angle @ 8given in degrees9 in radians.
mat!+random )1m 10 n22,
,+is function is an interface to t+e simple pseudo=random generator function rand provided 27
6&-I 0. 8&o guarantees can 2e given for its statistical properties.9
B+en called #it+out arguments: returns a uniform pseudo=random real num2er in t+e range
\:19. B+en called #it+ an integer num2er m: mat+.random returns a uniform pseudo=random
integer in t+e range \1:m]. B+en called #it+ t#o integer num2ers m and n: mat+.random
returns a uniform pseudo=random integer in t+e range \m: n].
mat!+randomseed )(,
-ets @ as t+e FseedF for t+e pseudo=random generatorG eMual seeds produce eMual seMuences of
num2ers.
mat!+sin )(,
/eturns t+e sine of @ 8assumed to 2e in radians9.
mat!+sin! )(,
/eturns t+e +7per2olic sine of @.
mat!+s?rt )(,
/eturns t+e sMuare root of @. 8You can also use t+e e@pression @a.. to compute t+is value.9
mat!+tan )(,
/eturns t+e tangent of @ 8assumed to 2e in radians9.
mat!+tan! )(,
/eturns t+e +7per2olic tangent of @.
6"1G Ta3le manipulation

,+is li2rar7 provides generic functions for ta2le manipulation. It provides all its functions inside
t+e ta2le ta2le. Cost functions in t+e ta2le li2rar7 assume t+at t+e ta2le represents an arra7 or a
list. "or t+ese functions: #+en #e talk a2out t+e Flengt+F of a ta2le #e mean t+e result of t+e
lengt+ operator.
ta-le+concat )ta-le 10 sep 10 i 10 9222,
Diven an arra7 #+ere all elements are strings or num2ers: returns table:i9//sep//table:iN@9 OOO
sep//table:,9. ,+e default value for sep is t+e empt7 string: t+e default for i is 1: and t+e default
for , is t+e lengt+ of t+e ta2le. If i is greater t+an ,: returns t+e empt7 string.
ta-le+insert )ta-le0 1pos02 /alue,
Inserts element value at position pos in ta2le: s+ifting up ot+er elements to open space: if
necessar7. ,+e default value for pos is nN@: #+ere n is t+e lengt+ of t+e ta2le: so t+at a call
table/insert7t2=8 inserts @ at t+e end of ta2le t.
6dvanced guide | L<6 E Programming language


>8
ta-le+ma(n )ta-le,
/eturns t+e largest positive numerical inde@ of t+e given ta2le: or 1ero if t+e ta2le +as no
positive numerical indices. 8,o do its 3o2 t+is function does a linear traversal of t+e #+ole ta2le.9
ta-le+remo/e )ta-le 10 pos2,
/emoves from ta2le t+e element at position pos: s+ifting do#n ot+er elements to close t+e
space: if necessar7. /eturns t+e value of t+e removed element. ,+e default value for pos is n:
#+ere n is t+e lengt+ of t+e ta2le: so t+at a call table/remove7t8 removes t+e last element of
ta2le t.
ta-le+sort )ta-le 10 comp2,
-orts ta2le elements in a given order: in=place: from table:@9 to table:n9: #+ere n is t+e lengt+ of
t+e ta2le. If comp is given: t+en it must 2e a function t+at receives t#o ta2le elements: and
returns true #+en t+e first is less t+an t+e second 8so t+at not comp7a:iN@92a:i99 #ill 2e true after
t+e sort9. If comp is not given: t+en t+e standard L<6 operator c is used instead.
,+e sort algorit+m is not sta2leP t+at is: elements considered eMual 27 t+e given order ma7 +ave
t+eir relative positions c+anged 27 t+e sort.
6"1' 0perating s2stem !acilities
os+date )14ormat 10 time22,
/eturns a string or a ta2le containing date and time: formatted according to t+e given string
format. If t+e time argument is present: t+is is t+e time to 2e formatted 8see t+e os/time
function for a description of t+is value9. ?t+er#ise: date formats t+e current time.
If format starts #it+ URU: t+en t+e date is formatted in 0oordinated <niversal ,ime. 6fter t+is
optional c+aracter: if format is t+e string FNtF: t+en date returns a ta2le #it+ t+e follo#ing
fieldsG 7ear 8four digits9: mont+ 81==129: da7 81==!19: +our 8==2!9: min 8==.>9: sec 8==619: #da7
8#eekda7: -unda7 is 19: 7da7 8da7 of t+e 7ear9: and isdst 8da7lig+t saving flag: a 2oolean9.
If format is not FNtF: t+en date returns t+e date as a string: formatted according to t+e same
rules as t+e 0 function strftime.
B+en called #it+out arguments: date returns a reasona2le date and time representation t+at
depends on t+e +ost s7stem and on t+e current locale 8t+at is: os/date78 is eMuivalent to
os.date8FVcF99.
os+di44time )t20 t1,
/eturns t+e num2er of seconds from time t1 to time t2. In P?-I': Bindo#s: and some ot+er
s7stems: t+is value is e@actl7 t2=t1.
os+e(ecute )1command2,
,+is function is eMuivalent to t+e 0 function s7stem. It passes command to 2e e@ecuted 27 an
operating s7stem s+ell. It returns a status code: #+ic+ is s7stem=dependent. If command is
a2sent: t+en it returns non1ero if a s+ell is availa2le and 1ero ot+er#ise.
os+e(it )1code2,
0alls t+e 0 function e@it: #it+ an optional code: to terminate t+e +ost program. ,+e default
value for code is t+e success code.
6dvanced guide | L<6 E Programming language


>>
os+geten/ )/arname,
/eturns t+e value of t+e process environment varia2le varname: or nil if t+e varia2le is not
defined.
os+remo/e )4ilename,
Deletes t+e file or director7 #it+ t+e given name. Directories must 2e empt7 to 2e removed. If
t+is function fails: it returns nil: plus a string descri2ing t+e error.
os+rename )oldname0 newname,
/enames file or director7 named oldname to ne#name. If t+is function fails: it returns nil: plus a
string descri2ing t+e error.
os+time )1ta-le2,
/eturns t+e current time #+en called #it+out arguments: or a time representing t+e date and
time specified 27 t+e given ta2le. ,+is ta2le must +ave fields 7ear: mont+: and da7: and ma7
+ave fields +our: min: sec: and isdst 8for a description of t+ese fields: see t+e os/date function9.
,+e returned value is a num2er: #+ose meaning depends on 7our s7stem. In P?-I': Bindo#s:
and some ot+er s7stems: t+is num2er counts t+e num2er of seconds since some given start
time 8t+e Fepoc+F9. In ot+er s7stems: t+e meaning is not specified: and t+e num2er returned 27
time can 2e used onl7 as an argument to date and difftime.
os+tmpname ),
/eturns a string #it+ a file name t+at can 2e used for a temporar7 file. ,+e file must 2e e@plicitl7
opened 2efore its use and e@plicitl7 removed #+en no longer needed. ?n some s7stems
8P?-I'9: t+is function also creates a file #it+ t+at name: to avoid securit7 risks. 8-omeone else
mig+t create t+e file #it+ #rong permissions in t+e time 2et#een getting t+e name and
creating t+e file.9 You still +ave to open t+e file to use it and to remove it 8even if 7ou do not use
it9.
B+en possi2le: 7ou ma7 prefer to use io/tmpfile: #+ic+ automaticall7 removes t+e file #+en t+e
program ends
6"19 :-tended !unction li3rar2
to-oolean)/alue,
0onverts t+e given value to 2oolean using follo#ing rulesG nil:
2oolean false: J: empt string: BJB string are treated as false: ever7t+ing else as true
string+split)str0 sep,
-plits t+e given string into c+unks 27 t+e given separator./eturns L<6 ta2le.
kn(li-+decodeia)indaddressa0 indaddress-,
0onverts 2inar7=encoded individual address to L<6 string. ,+is function accepts eit+er one or
t#o arguments 8interpreted as t#o single 27tes9.
kn(li-+decodega)groupaddressa0 groupaddress-,
0onverts 2inar7=encoded group adress to L<6 string. ,+is function accepts eit+er one or t#o
arguments 8interpreted as t#o single 27tes9.
6dvanced guide | L<6 E Programming language


1
kn(li-+encodega)groupaddress0 separate,
0onverts L<6 string to 2inar7=encoded group adress. /eturns group address a single L<6
num2er #+en second argument is nil or false and t#o separate 27tes ot+er#ise.
ipairs )t,
/eturns t+ree valuesG an iterator function: t+e ta2le t: and : so t+at t+e construction #ill iterate
over t+e pairs 81:t\1]9: 82:t\2]9: ddd: up to t+e first integer ke7 a2sent from t+e ta2le.

for i:v in ipairs8t9 do bod end
ne(t )ta-le 10 inde(2,
6llo#s a program to traverse all fields of a ta2le. Its first argument is a ta2le and its second
argument is an inde@ in t+is ta2le. ne@t returns t+e ne@t inde@ of t+e ta2le and its associated
value. B+en called #it+ nil as its second argument: ne@t returns an initial inde@ and its
associated value. B+en called #it+ t+e last inde@: or #it+ nil in an empt7 ta2le: ne@t returns nil.
If t+e second argument is a2sent: t+en it is interpreted as nil. In particular: 7ou can use ne=t7t9 to
c+eck #+et+er a ta2le is empt7. ,+e order in #+ic+ t+e indices are enumerated is not specified:
even for numeric indices. 8,o traverse a ta2le in numeric order: use a numerical for or t+e ipairs
function.9 ,+e 2e+avior of ne@t is undefined if: during t+e traversal: 7ou assign an7 value to a
non=e@istent field in t+e ta2le. You ma7 +o#ever modif7 e@isting fields. In particular: 7ou ma7
clear e@isting fields.
pairs )t,
/eturns t+ree valuesG t+e ne=t function: t+e ta2le t: and nil: so t+at t+e construction #ill iterate
over all ke7Evalue pairs of ta2le t.

for k:v in pairs8t9 do 2od7 end
tonum-er )e 10 -ase2,
,ries to convert its argument to a num2er. If t+e argument is alread7 a num2er or a string
converti2le to a num2er: t+en tonum2er returns t+is num2erP ot+er#ise: it returns nil.
6n optional argument specifies t+e 2ase to interpret t+e numeral. ,+e 2ase ma7 2e an7 integer
2et#een 2 and !6: inclusive. In 2ases a2ove 1: t+e letter U6U 8in eit+er upper or lo#er case9
represents 1: U*U represents 11: and so fort+: #it+ UTU representing !.. In 2ase 1 8t+e default9:
t+e num2er can +ave a decimal part: as #ell as an optional e@ponent part. In ot+er 2ases: onl7
unsigned integers are accepted.

tostring )e,
/eceives an argument of an7 t7pe and converts it to a string in a reasona2le format. "or
complete control of +o# num2ers are converted: use string/format.
If t+e metata2le of e +as a F``tostringF field: t+en tostring calls t+e corresponding value #it+ e
as
argument: and uses t+e result of t+e call as its result.

type )/,
/eturns t+e t7pe of its onl7 argument: coded as a string. ,+e possi2le results of t+is function are
FnilF 8a string: not t+e value nil9: Fnum2erF: FstringF: F2ooleanF: Fta2leF: FfunctionF: Ft+readF: and
FuserdataF.


6dvanced guide | L<6 E Programming language


11
G +cript e-amples
G"1 ,inar2 !ilter
0reate t#o 12it group addresses under ?23ect ta2 #+ere
1(1(1 input
1(1(2 output
0reate event E2ased script and attac+ it to group 1(1(1. -cript #ill run eac+ time group 1(1(1 receive
telegram
6dd fallo#ing code to -cript editor
value`1 K grp.getvalue8U1(1(1U9
if value`1 KK true t+en
== do not+ing
elseif value`1 KK false t+en
grp.#rite8U1(1(2U: false9
end
G"& ,inar2 gate %it( 3it gate
0reate t+ree 12it group addresses under ?23ect ta2 #+ere
1(1(1 input
1(1(2 gate
1(1(! output
0reate event E2ased script and attac+ it to group 1(1(1. -cript #ill run eac+ time group 1(1(1 receive
telegram
6dd fallo#ing code to -cript editor
value`1 K grp.getvalue8U1(1(1U9 ==input
value`2 K grp.getvalue8U1(1(2U9 ==gate
if value`2 KK true t+en
== do not+ing
elseif value`2 KK false t+en
grp.#rite8U1(1(!U: value`19 ==output
end
G"3 >ate %it( 32te gate
0reate t+ree group addresses under ?23ect ta2 #+ere
1(1(1 input E an7 t7pe 2ut t+e same as output
1(1(2 gate= 27te o23ect
1(1(! output E t+e same as input
6dvanced guide | L<6 E Programming language


12
0reate event E2ased script and attac+ it to group 1(1(1. -cript #ill run eac+ time group 1(1(1 receive
telegram
6dd fallo#ing code to -cript editor
value`1 K grp.getvalue8U1(1(1U9 == input
value`2 K grp.getvalue8U1(1(2U9 ==gate
if value`2 KK t+en
== do not+ing
elseif value`2 c or value`2 Q t+en
grp.#rite8U1(1(!U: value`19 ==output
end
G"7 0r F Port D& in 1 0utE
0reate t+ree 12it group addresses under ?23ect ta2 #+ere
1(1(1 value 1
1(1(2 value 2
1(1(! output
6dd tag ?/1 to value1 and value2 group addresses.
0reate event E2ased script and attac+ it to ,ag ?/1. -cript #ill run eac+ time group 1(1(1 or group
1(1(2 receive telegram
6dd fallo#ing code to -cript editor
value`1 K grp.getvalue8U1(1(1U9
value`2 K grp.getvalue8U1(1(2U9
if value`1 KK true or value`2 KK true t+en
grp.#rite8U1(1(!U: true9
else
grp.#rite8U1(1(!U: false9
end
G"< .nd F Port D& in 1 0utE
0reate t+ree 12it group addresses under ?23ect ta2 #+ere
1(1(1 value 1
1(1(2 value 2
1(1(! output
6dd tag 6&D1 to value1 and value2 group addresses.
0reate event E2ased script and attac+ it to ,ag 6&D1. -cript #ill run eac+ time group 1(1(1 or group
1(1(2 receive telegram
6dd fallo#ing code to -cript editor
6dvanced guide | L<6 E Programming language


1!
value`1 K grp.getvalue8U1(1(1U9
value`2 K grp.getvalue8U1(1(2U9
if value`1 KK true and value`2 KK true t+en
grp.#rite8U1(1(!U: true9
else
grp.#rite8U1(1(!U: false9
end
G"6 0r F Port D< in & 0utE
0reate group addresses under ?23ect ta2 #+ere
1(1(1 value 1 = 12it
1(1(2 value 2 = 12it
1(1(! value ! = 12it
1(1($ value $ = 12it
1(1(. value . = 12it
1(1(6 2it`output = 12it
1(1(; 27te`output = 127te
6dd tag ?/2 to group addresses value1: value2: value!: value$ and value ..
0reate event E2ased script and attac+ it to ,ag ?/2. -cript #ill run eac+ time groups 1(1(1: 1(1(2:
1(1(!: 1(1($: 1(1(. receive telegram
6dd fallo#ing code to -cript editor
value`1 K grp.getvalue8U1(1(1U9
value`2 K grp.getvalue8U1(1(2U9
value`! K grp.getvalue8U1(1(!U9
value`$ K grp.getvalue8U1(1($U9
value`. K grp.getvalue8U1(1(.U9
if value`1 KK true or value`2 KK true or value`! KK true or value`$ KK true or value`. KK true t+en
grp.#rite8U1(1(6U: true9 == 2it to 1
grp.#rite8U1(1(;U: 2..9 == 27te to 2..
else
grp.#rite8U1(1(6U: false9 == 2it to
grp.#rite8U1(1(;U: 9 == 27te to
end
G"G .nd F Port D< in & 0utE

0reate group addresses under ?23ect ta2 #+ere
1(1(1 value 1 = 12it
1(1(2 value 2 = 12it
1(1(! value ! = 12it
6dvanced guide | L<6 E Programming language


1$
1(1($ value $ = 12it
1(1(. value . = 12it
1(1(6 2it`output = 12it
1(1(; 27te`output = 127te

6dd tag 6&D2 to group addresses value1: value2: value!: value$ and value ..
0reate event E2ased script and attac+ it to ,ag 6&D2. -cript #ill run eac+ time groups 1(1(1: 1(1(2:
1(1(!: 1(1($: 1(1(. receive telegram
6dd fallo#ing code to -cript editor
value`1 K grp.getvalue8U1(1(1U9
value`2 K grp.getvalue8U1(1(2U9
value`! K grp.getvalue8U1(1(!U9
value`$ K grp.getvalue8U1(1($U9
value`. K grp.getvalue8U1(1(.U9
if value`1 KK true and value`2 KK true and value`! KK true and value`$ KK true and value`. KK true
t+en
grp.#rite8U1(1(6U: true9 == 2it to 1
grp.#rite8U1(1(;U: 2..9 == 27te to 2..
else
grp.#rite8U1(1(6U: false9 == 2it to
grp.#rite8U1(1(;U: 9 == 27te to
end

G"' Telegram trans!ormer D011 3it to 0F&<< 32teE
0reate t#o group addresses under ?23ect ta2 #+ere
1(1(1 input E 12it
1(1(2 output E 127te

0reate event E2ased script and attac+ it to group 1(1(1. -cript #ill run eac+ time group 1(1(1 receive
telegram
6dd fallo#ing code to -cript editorG
value`1 K grp.getvalue8U1(1(1U9
if value`1 KK true t+en == 2it value 8in9
grp.#rite8U1(1(2U: 2..9 == 27te value 8out9
else
grp.#rite8U1(1(2U: 9 == 27te value 8out9
end
G"9 Compare $alue
value`1 K grp.getvalue8U1(1(1U9
value`2 K grp.getvalue8U1(1(2U9
if value`1 KK value`2 t+en
grp.#rite8U1(1(!U: true9 == 2it to 1
grp.#rite8U1(1($U: 2..9 == 27te to 2..
else
6dvanced guide | L<6 E Programming language


1.
grp.#rite8U1(1(!U: false9 == 2it to
grp.#rite8U1(1($U: 9 == 27te to
end
G"10 +a$e +cene 1 D=>, $alueE

value`1 K grp.getvalue8U1(1(1U9 ==/)D
value`2 K grp.getvalue8U1(1(2U9 ==D/))&
value`! K grp.getvalue8U1(1(!U9 ==*L<)
storage.set8U-cene1`/edU: value`19
storage.set8U-cene1`DreenU: value`29
storage.set8U-cene1`*lueU: value`!9
G"11 Call +cene 1 D=>, $alue

value`1 K storage.get8U-cene1`/edU9
value`2 K storage.get8U-cene1`DreenU9
value`! K storage.get8U-cene1`*lueU9
if not value`1 t+en
==if storage value does not e@ist do not+ing
else
grp.#rite8U1(1(1U: value`19 ==/)D
end
if not value`2 t+en
==if storage value does not e@ist do not+ing
else
grp.#rite8U1(1(2U: value`29 ==D/))&
end
if not value`! t+en
==if storage value does not e@ist do not+ing
else
grp.#rite8U1(1(!U: value`!9 ==*L<)
end

G"1& H2steresis
)do not c!ange o-9ect 1@1@2 w!en /alue o4 o-9ect 1@1@1 is -etween 100 and 200,
value`1 K grp.getvalue8U1(1(1U9 == 27te value
if value`1 c 1 t+en
grp.#rite8U1(1(2U: false9 == 2it to
elseif value`1 Q 2 t+en
grp.#rite8U1(1(2U: true9 == 2it to
end
G"13 =andom 32te $alue
steps K 2.. == possi2le steps c+ange t+is value to lo#er value to make 2igger steps
random K mat+.random8: 8steps = 199 N 2.. ( 8steps = 19
outcome K 8mat+.floor8random99
value`1 K grp.getvalue8U1(1(1U9
grp.#rite8U1(1(1U: outcome9 == Brite random 27te value to o23ect
6dvanced guide | L<6 E Programming language


16
G"17 C2clic =epeater Ddela2 60 secondsE
value`1 K grp.getvalue8U1(1(1U9
if value`1 KK true t+en
repeat
value`1 K grp.getvalue8U1(1(1U9
if value`1 KK true t+en
grp.#rite8U1(1(2U: true9
== #ait for 6 seconds
os.sleep869
end
until value`1 KK false
end
G"1< +tepper 1 Counter Positi$e input
value`1 K grp.getvalue8U1(1(1U9 == Positive input
if value`1 KK true t+en
-tepper`Aalue K storage.get8UAalue`-tepper`1U9
if not -tepper`Aalue t+en
-tepper`Aalue K
end
if -tepper`Aalue KK 2.. t+en
else
-tepper`Aalue K -tepper`Aalue I 1
end
storage.set8UAalue`-tepper`1U: -tepper`Aalue9
grp.#rite8U1(1($U: -tepper`Aalue9
end
G"16 +tepper 1 Counter Negati$e input
value`1 K grp.getvalue8U1(1(2U9 == &egative input
if value`1 KK true t+en
-tepper`Aalue K storage.get8UAalue`-tepper`1U9
if not -tepper`Aalue t+en
-tepper`Aalue K
end
if -tepper`Aalue KK t+en
else
-tepper`Aalue K -tepper`Aalue = 1
end
storage.set8UAalue`-tepper`1U: -tepper`Aalue9
grp.#rite8U1(1($U: -tepper`Aalue9
end

G"1G =eset +tepper 1 Counter
value`1 K grp.getvalue8U1(1(!U9
if value`1 KK true t+en
storage.set8UAalue`-tepper`1U: 9
grp.#rite8U1(1($U: 9
end

6dvanced guide | L<6 E Programming language


1;
G"1' 0n #ela2 D3utton set to Rupdate onl2 internalRE
value`1 K grp.getvalue8U1(1(1U9
if value`1 KK true t+en
os.sleep8!9 == Dela7 time
grp.#rite8U1(1(1U: true9
end
G"19 .$erage
value`1 K grp.getvalue8U1(1(1U9
value`2 K grp.getvalue8U1(1(2U9
6verage K value`1 I value`2
6verage K 86verage ( 29
value`! K grp.getvalue8U1(1(!U9
grp.#rite8U1(1(!U: 6verage9
G"&0 0!! #ela2
value`1 K grp.getvalue8U1(1(1U9
if value`1 KK true t+en
os.sleep8!9 == Dela7 time
grp.#rite8U1(1(1U: false9
end
G"&1 +tare case timer D%it( $aria3le time o34ectE
value`1 K grp.getvalue8U1(1(1U9
value`2 K grp.getvalue8U1(1(2U9 == Aaria2le value
if value`1 KK true t+en
os.sleep8value`29
grp.#rite8U1(1(1U: false9
end
G"&& Calue memor2 D%rite to storageE
value`1 K grp.getvalue8U1(1(1U9
storage.set8U-torage`Aalue`Cemor7`1U: value`19
G"&3 Calue memor2 Dget !rom storageE
Aalue`Cemor7`1 K storage.get8U-torage`Aalue`Cemor7`1U9
if not Aalue`Cemor7`1 t+en
== do not+ing
else
grp.#rite8U1(1(1U: Aalue`Cemor7`19
end
G"&7 Multiple-er D1 in 1 3 outE Notice 034ect t2pe needs to 3e t(e same
value`1 K grp.getvalue8U1(1(1U9
grp.#rite8U1(1(2U: Aalue`19
grp.#rite8U1(1(!U: Aalue`19
grp.#rite8U1(1($U: Aalue`19

G"&< =ound !unction using Common !unctions
4dd following code to common functions
6dvanced guide | L<6 E Programming language


18
== /ounds a num2er to t+e given num2er of decimal places...
function round8num: idp9
local mult K 1a8idp or 9
return mat+.floor8num N mult I ..9 ( mult
end

Create script in script editor
== /ound function 8#it+ glo2al function9
value`1 K grp.getvalue8U1(1(1U9
round8value`1: 29 == using function round from common functions
grp.#rite8U1(1(1U: Aalue`29
G"&6 *rite data and time to 8N9 group addresses
== get current data as ta2le
no# K os.date8UNtU9
== s7stem #eek da7 starts from sunda7: convert it to kn@ format
#da7 K no#.#da7 KK 1 and ; or no#.#da7 = 1
== time ta2le
time K W
da7 K #da7:
+our K no#.+our:
minute K no#.min:
second K no#.sec:
X
== date ta2le
date K W
da7 K no#.da7:
mont+ K no#.mont+:
7ear K no#.7ear:
X
== #rite to 2us
grp.#rite8U1(1(2U: time: dt.time9
grp.#rite8U1(1(1U: date: dt.date9
G"&G *rite data to groups %it( tags
0reate fe# 12it group addresses and add tag OLig+tH to t+em
0reate one more group different one from t+e ot+ers to trigger script.

1(1(1 E Li+gt1 E ,ag OLig+tH
1(1(2 E Li+gt2 E ,ag OLig+tH
1(1(! E Li+gt! E ,ag OLig+tH
1(1($ E Li+gt$ E ,ag OLig+tH
1(1(. E Li+gt. E ,ag OLig+tH
1(1(6 E Li+gt6 E ,ag OLig+tH

1(1(1 E -cene active group Eno tag attac+edR

0reate event E2ased script and attac+ it to group 1(1(1. -cript #ill run eac+ time group 1(1(1
receive telegram

6dd fallo#ing code to -cript editorG
6dvanced guide | L<6 E Programming language


1>
6llLig+ts K grp.tag8ULig+tU9
6llLig+tsG #rite8true9

6ll lig+ts #ill 2e s#itc+ed on eac+ time group 1(1(1 receive telegram.

Note Do not start script from t+e same tag or group addresses containing t+e same tag. ,+is #ill
create infinite loop #+ic+ #ill generate lots of 2us traffic and +ig+ load on processor.
If infinite loop is created stop t+e script and re2oot HomeLYnk.

S-ar putea să vă placă și