DIY mode is a function specially designed for IoT home automation users and developers that allows them to control SONOFF devices via existing home automation open-source platform or local HTTP client instead of eWeLink App. BASICR3, RFR3, MINIR2 and D1 support the DIY mode which is well received by users. Now SPM units also support DIY mode and have more functions. Let’s enter the DIY mode!
Entering the DIY Mode
Power on SPM-Main and long press the button on it for 5s until the SIGNAL indicator flashes, which means SPM-Main entered the pairing mode.
Then connect SPM-Main to the router using an Ethernet cable, and choose one of the following methods to connect the router to the computer.

Type the ip address in the browser on your computer and access. Then access the “DIY WEB” webpage and click “WIFI SETTING”.
Next, enter the WiFi SSID and password that the device needs to be connected with, then wait for the device to connect to the WiFi network (WiFi configuration).

When WiFi configuration is completed, the SIGNAL light will remain double blinking continuously. Done. SPM-Main is in the DIY Mode!
After entering the DIY mode, you can send requests to enable SPM-Main to execute different functions, such as sub-device list obtaining and overload protection setting. You can view more details in SPM-Main HTTP API via this link: http://developers.sonoff.tech/spm-main-http-api.html
Now, let’s try to get the list of sub-device now.
1. Obtain the list of SPM-4RELAY
Before obtaining, check whether the COMM light of SPM-4RELAY is blinking. If the COMM light is off, you need to whether the RS485 communication cable is connected to the SPM-Main and SPM-4RELAY. If connected correctly, press the button on SPM-Main once and you will see the COMM light on SPM-4RELAY flashes continuously.
Open the Postman application and create a new HTTP Request, and select POST–Body–raw.

Next, type http://[ip]:[port]/zeroconf/subDevList in the browser.
[ip] is the ip address of SPM-Main. [port] is fixed to 8081.
For example, http://192.168.1.103:8081/zeroconf/subDevList
Enter the request in the Body:
1 2 3 4 | { "deviceid": "100000140e", "data": {} } |
Attribute | Type | Optional | Description |
deviceid | String | Yes | The device ID for this request. |
data | Object | No | Object type, Specific device information setting when controlling the device. Empty object when check the device information. |
Send the request then you will obtain the information about sub-device in the “response”.

2. Turn on all switches
Good job. Now we get the sub-device id that SPM-4RELAY can be controlled.
Enter the following “URL and Body” info to turn on the on/off of each channel on SPM-4RELAY.
URL: http://[ip]:[port]/zeroconf/switches
Body:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | { "deviceid": "100000140e", "data": { "subDevId": "123456", "switches": [ { "switch": "on", "outlet": 0 }, { "switch": "on", "outlet": 1 }, { "switch": "on", "outlet": 2 }, { "switch": "on", "outlet": 3 } ] } } |
Attribute | Type | Optional | Description |
switch | String | No | on: turn the switch on, off: turn the switch off |
outlet | Number | No | Channel Number, [0,3] |
Send the request, then the channel on SPM-4RELAY will be turned on. Seems very simple, right?

Well. It seems that you can now access and use more functions of SPM units by yourself. Start more features setup and experience on SPM units according to the guide in SPM-Main HTTP API.