## Device Communication Protocol

### 1. WiFi

#### 1. What is WiFi

- For a detailed introduction, please refer to [WiFi Basics Wiki](https://zh.wikipedia.org/wiki/Wi-Fi) or [WiFi Basics Encyclopedia](https://baike.baidu.com/item/Wi-Fi/151036)

#### 2. Project Development

- Notes
- During the sliding of WiFi, BLE, and Zigbee devices, the light changes with the color palette, and the panel display is consistent with the light color.
- The offline prompt time of the WiFi device is about 150s, that is, the event will be sent to the APP notification only 150s after the device is offline.

### 2. BLE

#### 1. What is BLE

- For a detailed introduction, please refer to [BLE Basic Knowledge Wiki](https://zh.wikipedia.org/wiki/%E8%93%9D%E7%89%99%E4%BD%8E%E5%8A%9F%E8%80%97) or [BLE Basic Knowledge Encyclopedia](https://baike.baidu.com/item/%E8%93%9D%E7%89%99%E4%BD%8E%E8%83%BD%E8%80%97/12806839?fr=ge_ala)

#### 2. Project Development

- Precautions
- BLE devices are directly connected via Bluetooth, and there may be scenarios where they are disconnected from the Internet (the ability to cache necessary data or must be connected to the Internet needs to be prompted), which needs to be considered during development.
- When sliding WiFi, BLE, and Zigbee devices, the light changes with the color palette, and the panel display is consistent with the light color.
- The offline prompt time of WiFi devices is about 150s, that is, the event will be sent to the APP notification 150s after the device is offline.

### III. Beacon

#### 1. What is Beacon

- For a detailed introduction, please refer to [Beacon Basic Knowledge Wiki](https://en.wikipedia.org/wiki/Beacon) or [WiFi Basic Knowledge Encyclopedia](https://baike.baidu.com/item/Beacon/2649124)

#### 2. Project Development

- Precautions
- Due to the particularity of the Beacon protocol, the control command delay is relatively serious. After the Beacon device sends DP, the APP SDK will directly report DP to the panel. If the device reports DP again, during fast control, the panel status and device status are often inconsistent.
- If persistence is required, save the panel on the cloud and then synchronize.
- Save data: `import { saveDevProperty } from '@ray-js/ray';`
- Get data: `import { getDevProperty } from '@ray-js/ray';`
- During the sliding of Sig Mesh and Beacon devices, the light will not change accordingly. You need to release the slider so that the panel and light colors are consistent.
- When the device panel is opened, the APP will only receive 30s of data. If it exceeds this time, the APP will no longer receive it. If you need to modify this restriction, you can customize the panel. So after the Beacon device is networked, the APP immediately controls it, the device reports, and the panel can display normally. However, after a period of time, the device actively reports, and the panel cannot display normally.

### 4. BLE Mesh

#### 1. What is BLE Mesh

- For a detailed introduction, see [BLE Mesh Basic Knowledge Encyclopedia](https://baike.baidu.com/item/mesh/4418120?fr=aladdin)

#### 2. Project Development

- Precautions
- Pay attention to DP synchronization issues during development. It is not recommended to report and send data at a high frequency, which may cause data storms and packet loss.
- Need to actively query non-standard DPs. DP Id > 50 generally belongs to non-standard DPs.
- The group does not support advanced timing
- Unsupported dp
- control_data (real-time data transmission, too high frequency)
- The panel needs to be added to the gateway according to whether the Sig Mesh device is added
- [Judgment method useIsSigmeshGatewayConnected](/en/miniapp/solution-panel/ability/common/hooks/useIsSigmeshGatewayConnected)
- During the sliding of Sig Mesh and Beacon devices, the light will not change accordingly. You need to release the slider so that the panel and the light color are consistent.

### 5. Zigbee

#### 1. What is Zigbee

- For a detailed introduction, please refer to [Zigbee Basic Knowledge Encyclopedia](https://baike.baidu.com/item/zigbee?fromModule=lemma_search-box)

#### 2. Project Development

- Notes
  - During the sliding of WiFi, BLE, and Zigbee devices, the light changes with the color palette, and the panel display is consistent with the light color
  - The offline prompt time of the WiFi device is about 150s, that is, the event will be sent to the APP notification 150s after the device is offline
