Description

Milesight sensors support data retransmission feature which is to ensure no data loss if network is down suddenly for some times. There are two ways to get the lost data:

  • Data Retransmission: re-send data automatically when the device reconnects to network;
  • Historical Data Enquiry: enquire the historical data via sending downlink command. 

This article will describe how to setup configurations to achieve both features.


Requirement

  • Any Standard LoRaWAN Gateway: take Milesight UG65 as example
  • Milesight Sensor which supports data storage and data retransmission function: take EM320-TH as example
  • ToolBox App or ToolBox software: download here



Configuration

Data Retransmission

1. Sync the time of the device via ToolBox. For time sync details, please refer to article How to Sync the Time of Milesight Nodes

2. Enable Data Storage and Data Retransmission function on ToolBox.

 

3. Enable Rejoin mode function and set the number of packets sent. The device will send LinkCheckReq MAC packets to network server regularly to check if the network is disconnected. If the device still gets no response from network server for times, the join status will change to de-active and the device will record data lost time point (the time to join the network). The time for rejoin mode to take effect can be calculated as article How Rejoin Mode Work on Milesight LoRaWAN Nodes

Example: when reporting interval is 40 minutes and the number of detection signal is 8, the device join status will change to de-activate after 40*(8+1)=360 minutes=6 hours if it still get no response from network server. If it disconnects at 13:00, it will record a lost time point at 7:00.

 

4. After the network back and the device rejoins to network, the device will send the historical data from the point in time when the data was lost (In this example is 7:00) according to the data retransmission reporting interval (60s by default).

 

Note: 

1) If the device is rebooted or re-powered when data retransmission is not completed, the device will re-send all retransmission data again after device is reconnected to the network.

2) If the network is disconnected again during data retransmission, it will only send the latest disconnection data.

3) Data retransmission will increase the uplink and shorten the battery life.

 

Get Historical Data via Downlinks

1. Sync the time of the device via ToolBox. For time sync details, please refer to article How to Sync the Time of Milesight Nodes

2. Enable Data Storage function on ToolBox.

3. Ensure the device is activated on network server. Take UG65 as example, go to Network Server > Packets of gateway web GUI, type in Device EUI, set the Type to hex, type downlink command in Payload then click Send

Note: For Class A type device, it requires to wait the next uplink packet to response the command.

 

Downlink Command Format: channel(1 Byte) + command type (1 Byte) + command content

Channel

Type

Content Description

fd

6b (Enquire data in time point)

4 Bytes, Unix timestamp

fd

6c (Enquire data in time range)

Start time (4 bytes) + End time (4 bytes), Unix timestamp

fd

6d (Stop query data report)

ff

ff

6a (Report Interval)

3 Bytes

Byte 1: 01

Byte 2-3: interval time, unit:s

range: 30~1200s (60s by default)

 

Example 1: enquire the historical data from 2022/10/12 15:15:00 to 2022/10/12 16:35:00.

Note: The device only uploads no more than 300 data records per range enquiry.

fd6c 74694663 347c4663

Channel

Type

Value

fd

6c (Enquire data in time range)

Start time: 74694663 => 63466974 = 1665558900 =2022/10/12 15:15:00

End time: 347c4663 => 63467c34 = 1665563700 =2022/10/12 16:35:00

 

Example 2: enquire the historical data at 2022/10/12 15:15:00. If there is no data in this time point, the device will upload the data which is closest to the search point within the reporting interval range. 

fd6b 74694663

Channel

Type

Value

fd

6b (Enquire data in time point)

74694663 => 63466974 = 1665558900 =2022/10/12 15:15:00

 

 

4. Check the enquiring result and historical data uplinks on Packet > Network Server page.

Data enquiry result:

fc6b00 or fc6c00: data enquiry success

fc6b01 or fc6c01: enquiry time invalid

fc6b02 or fc6c02: no data in the enquiry time


Historical Data:

 


 

Historical Data Decode

The historical data uses different format from regular uplinks: 20ce+data time stamp (4 bytes) + data contents (mutable). Take EM320-TH as example, one historical uplink shows as below:

20ce 9e744663 1001 5d

Channel

Type

Time Stamp

Value

20

ce (Historical Data)

56991a63 => 2022/10/12 16:03:53

Temperature: 1001=>0110=27.2°C

Humidity: 5d=>93=46.5%

 

For details of historical data decode of every model please refer corresponding user guide here

 

 

---- End ----