This guide is divided into 3 main parts. Click the navigation to jump to the target part.
1. Preparations for LAN API Control
2. Supported Products
3. How to use the LAN API
Add the device to Govee Home App and make sure the Wi-Fi is connected. Turn on the LAN switch on Device Settings page.
Note: If your device is listed in the Supported Products but you can not see the LAN switch, please disconnect the device from the power supply and power on again. Wait for about 30 minutes and check if the LAN switch appears. If it still does not appear, please contact customer service.
Steps:
Client Scans Govee Devices
{ "msg":{ "cmd":"scan", "data":{ "account_topic":"reserve" } } }
Explanation of the JSON message "request scan":
The "scan" in the cmd field represents a request to the device. Govee devices will analyse the field. The "reserve" must be filled in that field. Currently, the content in the field can only be "reserve".
{ "msg":{ "cmd":"scan", "data":{ "ip":"192.168.1.23", "device":"1F:80:C5:32:32:36:72:4E", "sku":"Hxxxx", "bleVersionHard":"3.01.01", "bleVersionSoft":"1.03.01", "wifiVersionHard":"1.00.10", "wifiVersionSoft":"1.02.03" } } }
Explanation of the JSON message "response scan":
The "scan" in the cmd field represents the Govee device replies to the client. The "192.168.1.23" in the IP field represents the local IPV4 address of the Govee device, which is used to receive the UDP control command packets from the client. The "1F:80:C5:32:32:36:72:4E" in the device field represents the unique identity information of the device. The "Hxxxx" in the SKU field represents device models. The "3.01.01" in the bleVersionHard field represents the hardware version number of the Bluetooth on the Govee device. The "1.03.01" in the bleVersionSoft field represents the software version number of the Bluetooth on the Govee device. The "1.00.10" in the wifiVersionHard field represents the hardware version number of the Wi-Fi on the Govee device. The "1.02.03" in the wifiVersionSoft field represents the software version number of the Wi-Fi on the Govee device.
After the "Client Scans Govee Devices" gets the fixed IP address of the Govee devices, the client sends the "control command" via UDP to the fixed IP address of the Govee devices on port 4003. There are four main control commands, namely on/off, light brightness, device status query, and color/color temperature control. Among them, the device status query can get replies from the Govee devices. The specific "control commands" are as follows:
{ "msg":{ "cmd":"turn", "data":{ "value":0 } } }
Explanation of the JSON message "On/Off" control command:
The "turn" in the cmd field represents the on/off command. The "0" in the value field represents the specific implementation of the on/off operation. The value could only be "0" or "1". "0" means "off", "1" means "on".
{ "msg":{ "cmd":"brightness", "data":{ "value":20 } } }
Explanation of the JSON message "Light brightness" command:
The "brightness" in the cmd field represents the brightness control command. The "20" in the value field represents the brightness is set at 20%. The value can only be an integer and is between 1 to 100.
{ "msg":{ "cmd":"devStatus", "data":{ } } }
Explanation of the JSON message "Device Status Query" command:
The "devStatus" in the cmd field represents a request for device status information.
{ "msg":{ "cmd":"devStatus", "data":{ "onOff":1, "brightness":100, "color":{ "r":255, "g":0, "b":0 }, "colorTemInKelvin":7200 } } }
The “devStatus” in the cmd field represents the Govee devices' response of the status information. The “1” in the onOff field represents the current state of the Govee device is “on”. “1” is “on” while “0” is “off”. The “100” in the brightness field represents the current brightness of the Govee device is 100%. The brightness range is 1 to 100. The values of “r”, “g”, and “b” in the color field represent the colors of red, green, and blue of the Govee device. The range is 0 to 255. The “7200” in the colorTemInKelvin field represents the current color temperature value of the Govee device is 7200K. The range is 2000 to 9000.
{ "msg":{ "cmd":"colorwc", "data":{ "color":{ "r":0, "g":12, "b":8 }, "colorTemInKelvin":7200 } } }
Explanation of the JSON message "Color/Color Temperature Control":
The “colorwc” in the cmd field represents the color or color temperature control. The “7200” in the colorTemInKelvin field represents the color temperature value is 7200K. The range is 2000-9000. When the value of the color temperature is not “0”, the device will convert the color temperature value into the color value of red, green and blue. When the value of the color temperature is “0”, the device will only resolve the value of “r”, “g” and “b” in the color field.