Contents


Introduction

Milesight D2D featuring LoRa is a device to device communication protocol developed by Milesight and executed only among Milesight branded end nodes. There are benefits with Milesight D2D protocol:

  • Low latency: peer to peer communication without any gateway
  • Low consumption: based on low power LoRa technology
  • Wide range: long transmission range as standard LoRaWAN®
  • Security: support AES128 encryption algorithm to ensure secure communication 
  • Multicast: support control in bulks

The basic structure of Milesight D2D is consist of D2D Controller Devices and D2D Agent Devices. When triggering condition of D2D Controller device is meet (any button is pressed or sensor value reaches the threshold), D2D Controller device will send a user-defined command to corresponding D2D Agent devices to control lights, fans or other appliances. 

Here are the lists of D2D Controller Devices and corresponding triggering conditions: 

D2D Controller

Firmware Version

Triggering Condition

WS101

1.2 and later

Short press, long press or double press

WS136/WS156

Any

Any button is pressed

WS202

1.2 and later

PIR and light status is occupied/bright, occupied/dark, vacant

WS203Any

1. PIR status is occupied or vacant

2. Temperature reaches the threshold or not

WS301

1.8 and later

Door close or open (magnet absorb or separate)

WS303AnyWater is leaked or not
WS50x (2-Wire Version)AnyAny button is pressed

VS121

31.7.0.76 and later

Occupied or vacant

VS34xAny

Occupied or vacant

VS350
Any

1. Temperature reaches the threshold or not

2. Someone entered or left

3. People counting value reaches the threshold

UC100

Any

Any RS485 Modbus value reaches the threshold

UC300 (LoRaWAN)AnyAny DI status reaches the threshold condition
GS301AnyNH3 or H2S value reaches the threshold or not
EM300-TH1.5 and later (hardware version V3.x)

Temperature reaches the threshold or not

EM300-SLD/ZLD

1. Temperature reaches the threshold or not

2. Water is leaked or not

EM300-MCS

1. Temperature reaches the threshold or not

2. MCS sensor (door) open or close

EM300-MLD1.7 and laterWater is leaked or not
EM300-DI1.3 and later

1. Digital input status is high or low

2. Water flow timeout alarm or alarm dismiss

3. Water outage timeout alarm or alarm dismiss

WT201AnyWhen the schedule plan switches


Here are the lists of D2D Agent Devices and corresponding controlling actions: 

D2D Agent

Firmware Version

Controlling Actions

WS50x

Any

Any button on, off or inverse

WS51xAnySocket on, off or inverse
WS52x1.9 and laterButton on, off or inverse

WS558

Any

Any output on, off or inverse

UC100

Any

1. Reboot

2. Send customized Modbus command to RS485 terminal devices

UC300 (LoRaWAN)

Any

1. Control DO to on or off

2. Send customized Modbus command to RS485 terminal devices

WT201Any

1. Control temperature control system on/off

2. Switch a schedule plan



Application Example

Milesight D2D can be widely used on many indoor applications like smart offices, smart buildings, etc. In this article, we provide a smart office application example to realize a quick control without gateway.

WS156: 

Button 1 works as day mode——UC300 opens the fan, UC100 opens the curtain, WS502 switches off the lights; the control command is 40e1.

Button 2 works as night mode——UC300 closes the fan, UC100 draws the curtain, WS502 switches on the lights; the control command is 40e0.

WS202: 

When PIR status is occupied and light is bright, WS502 switches on the lights; the control command is 40e0.

When PIR status is vacant, WS502 switches off the lights; the control command is 40e1.

 

Requirements

  • Milesight D2D Controller: WS156, WS202
  • Milesight D2D Agent: UC100, UC300 (LoRaWAN), WS502
  • Milesight ToolBox App: download from Google Play or App Store
  • ToolBox Software: download here

All above devices should use the same frequency plan.

 

D2D Controller Configurations

1. Open Milesight ToolBox App on a NFC-enabled smartphone and attach the NFC area to the device to read the basic information of D2D Controller devices.

2. Go to Setting > LoRaWAN Settings, set the RX2 frequency and RX2 datarate which will be used to send control commands. It is suggested to change the default parameters to avoid transmission conflicts.

3. Enable D2D feature and define an unique D2D key (length: 16 to 32) for every device. The default value is 5572404c696e6b4c6f52613230313823.

 

4. Define a 2-byte hexadecimal control command for every trigger condition. 

For WS156, set the button 1 command as 40e1 and button 2 command as 40e0

 

For WS202, set the Occupied/Bright status command as 40e0 and Vacant status commands as 40e1.

 

D2D Agent Configurations

1. Connect type-C port of UC100 and UC300 to PC and open Milesight ToolBox software to log in and configure the device. The default log in password is 123456. For WS502, open Milesight ToolBox App on a NFC-enabled smartphone and attach the NFC area to the switch to read and configure the basic information.

2. Go to LoRaWAN Settings > Basic page, set the supported frequency, RX2 frequency and RX2 datarate the same as D2D Controller device.

 

3. Enable D2D feature and set D2D key the same as D2D Controller device. The default value is 5572404c696e6b4c6f52613230313823. In this example, UC300 and UC100 uses the same key as WS156; WS502 uses the same key as WS156 and WS202.


4. Set the received control commands and corresponding operating actions.

For UC300, go to Command page to add two commands:

Command 1: Received command 1 is 40e1, trigger DO to open;

Command 2: Received command 2 is 40e0, trigger DO to close.

 

For UC100, go to Command page to add two commands:

Command 1: Received command 1 is 40e1, send curtain pulling up Modbus RTU command;

Command 2: Received command 2 is 40e0, send curtain pulling down Modbus RTU command.

 

For WS502, add two commands:

Command 1: Received command 1 is 40e1, all switches off; 

Command 2: Received command 2 is 40e0, all switches on.

 

 

FAQ

Q1Do the Milesight D2D compliant end nodes support standard LoRaWAN® transmission at the same time?
A: Yes, but if D2D controller feature is enabled, default button message or threshold alarm will be transformed first to D2D control command to send to agent devices instead of sending via LoRaWAN®. For parts of models, you can enable the LoRa Uplink option which will allow the device to send both command to D2D agent and data to LoRaWAN® network server at the same time.


Q2Why there is delay of D2D communication if device does not join the LoRaWAN® network?
A: Even D2D is enabled, the device will also send join request to LoRaWAN® network server regularly. When both join requests and D2D control commands need to be sent, the device will send join requests in priority, which will delay the D2D communication.


Q3It seems there is a long delay in response after clicking the WS1x6 button hundreds of times continuously.
A: For sake of battery life, the initial 6 times of operation will get an immediately response. After that, the command will be sent with a latency of 4 seconds each time until you stop continuous clicking.

  

Q4Can UC100 and UC300 work as Controller or Agent at the same time?
A: Yes, you can add both controller command and agent command to achieve both features.

 

 

 

 

 

----END---