# Registration

Before any client device is able to communicate on the local network with the Link, it will need to be authorised by the Link as a security measure. To do this, the physical Lightwave Link will need to be accessed. If commands are sent out and the Link does not recognise the client device, it will respond with ERR,1,"Not yet registered. Send !F*p to register" or ERR,2,"Not yet registered. Send !F*p to register" depending on the Link unit used (ERR 1 refers to the LW500, ERR,2 refers to the LW930). In versions 2.92 onwards, the Link will also output a JSON packet as below:

*!{
"trans":123456,
"mac":"21:34:56",
"time":1261929516,
"pkt":"error",
"fn":"nonRegistered",
"payload":"Not yet registered. Send !F*p to register"
}

As the returned message suggests, you need to send the command !F*p to initiate the linking. When you do this from an unregistered device, you will getERR,1,"Not yet registered. See WifiLink" returned or ERR,2,"Not yet registered. See LightwaveLink"depending on the Link unit used. In versions 2.92 onwards, the Link will also output a JSON packet as below:

*!{
"trans":123456,
"mac":"21:34:56",
"time":1261929516,
"pkt":"error",
"fn":"nonRegistered",
"payload":"Not yet registered. See LightwaveLink" //For LW930
**OR**
"payload":"Not yet registered. See WifiLink."     //For LW500
}

When this is received, the Link unit will enter a “linking” mode. The light on the Link will flash (the screen on the LW500 will also show “App Link”) and the user will need to press the Link button within 12 seconds.

When the linking has been successful, the Link will output further JSON to confirm this to the client (or any clients on the network).

*!{
"trans":123457,
"mac":"21:34:56",
"time":1261929519,
"prod":"wfl", //For LW500
**OR**
"prod":"lwl", //For LW930
"pairType":"local",
"msg":"success",
"class":"",
"serial":""
}

There is no provisioning for which device was successfully linked, so if two unregistered clients were attempting to connect, you wouldn’t be able to identify which device was linked with the above packet.

If the !F*p command is sent when the client device is already linked, then the version of the Link will be in the response instead in the format ?V="U2.93J". This is used in the first party apps (i.e. those made by LightwaveRF Technology Ltd) to detect if a Link is accessible on the local network for control, by regularly transmitting !F*p and altering the client behaviour based on the response:

1. Not yet registered. See WifiLink/LightwaveLink is received; prompt user to check their Link unit to register
2. ?V="U2.93J" is received; let the user know commands can be executed without latency
3. Nothing is received; let the user know commands will not be able to be executed instantly
4. 1,ERR,1,"Pairing memory is full" is received. Prompt the user to de-register using an authorised client (see De-registering below), or using the manual hardware buttons.

Note
The Link is able to be linked to 12 client devices

## De-registering

Once a client device has the ability to control the Link unit, it is possible to remove all clients with a single command. There is no ability to remove single clients, however. From an authorised client device, send out !F*xP. The Link will respond with an OK and subsequent commands will not be successful.

To use a client to link to a peripheral lighting or power device, you must first place the peripheral into linking mode, as described by its manual. When it is in linking mode, the client simply needs to send a command to that device. The actual command is unimportant; there is no specific linking command. The peripheral simply learns that it should react to the appropriate Room & Device combination.

For example, if a dimmer is placed into linking mode, then it can be linked to Room 1, Device 1 by sending !R1D1F1,!R1D1F0,!R1D1FdP16 or !R1D1Fu - just as long as the command sent is one that the peripheral will understand. A dim command sent to a socket, would not be understood, for example.