Wiki Home Computers page Sonoff BasicR4 setup

Sonoff BasicR4 setup

2026-02-12
sonoff, basicr4

The following explains how to detect and add a Sonoff R4 device in iCafeCloud that allows the device to turn on automatically when a session starts and turn off automatically when checkout occurs.

Prerequisites:

  1. iCafeCloud Server is running on a PC, and you can log in to the iCafeCloud Admin Panel.
  2. Sonoff R4 device is powered on and online.
  3. An Android phone with the eWeLink app installed (https://play.google.com/store/apps/details?id=com.coolkit).
  4. Both the PC and the Android phone are connected to the same local Wi‑Fi network, and the Wi‑Fi must be 2.4 GHz (5 GHz is not supported).

Setup:

  1. Remove auto-detected Sonoff devices (if any)
    Log in to the iCafeCloud Admin Panel and go to the Computers/Consoles page.
    If there are already devices whose names start with SONOFF_ (Sonoff devices automatically detected by the system), delete them first.

  1. Create an API key in iCafeCloud
    Go to Settings / API settings and create a new API key.
  2. For API access IP, enter the public IP address of the machine running iCafeCloud Server.
  3. If you do not know your public IP address, you can use websites such as https://whatismyipaddress.com/ to look it up.  (Figure 1 & 2)

Figure 1


Figure 2

  1. Run SonoffDevice.exe on the iCafeCloud Server machine
  2. In the iCafeCloud Server installation directory, run SonoffDevice.exe.
  3. Enter the API key you just created.
  4. Enter your License ID (Cafe ID). (Figure 3)

Figure 3

  1. Add the Sonoff R4 device in the eWeLink app
  2. On your Android phone, open the eWeLink app and add the Sonoff R4 device as follows:
  3. Put the Sonoff R4 into pairing mode, Quickly press the button on the Sonoff R4 five times in a row or follow the official device manual to enter pairing mode.
  4. Turn on Bluetooth on your phone and bring it close to the device.
  5. Click Add  (Figure 4)

Figure 4

  1. Click Next (Figure 5)

Figure 5

  1. After the device is discovered, tap the “+” icon next to it. (Figure 6)

Figure 6

  1. Enter the device control page, then tap the settings icon in the top-right corner to open the device settings page. (Figure 7)


Figure 7

  1. Make sure LAN control is enabled. (Figure 8)

Figure 8

  1. Configure Wi‑Fi proxy on the phone
  2. Set the Wi‑Fi proxy on the phone to point to the machine running iCafeCloud Server.
    For example, if the internal IP of the PC is 192.168.0.104, then:
    Set the phone’s Wi‑Fi proxy host to 192.168.0.104
    Set the proxy port to 8888
  3. If you do not know the internal IP of your PC, you can refer to this video: https://www.youtube.com/watch?v=goTdaCFog3U.   (Figure 9)

Figure 9

  1. Capture ON/OFF commands in SonoffDevice.exe
  2. In the eWeLink app, operate the device and let SonoffDevice capture the control commands:
  3. Turn the device ON in the eWeLink app.
  4. After the device is successfully turned on, go to the SonoffDevice window on the PC and click I Clicked ON. If successful, you will see: Device ON Command: Acquired, which means SonoffDevice has detected and recognized your ON action.
  5. Then turn the device OFF in the eWeLink app.
  6. After the device is successfully turned off, in SonoffDevice click I Clicked OFF. If successful, you will see: Device OFF Command: Acquired, which means SonoffDevice has detected and recognized your OFF action.
  7. Click Add Console to add the current device into iCafeCloud. (Figure 10)

Figure 10

  1. Verify the device in iCafeCloud
  2. Switch back to the iCafeCloud Admin Panel and go to the Computers/Consoles page.
    You should now see that the device has been added.
  3. If the list does not update, press F5 to refresh the page.
  4. After a short while, iCafeCloud Server will automatically detect the device and show a log entry similar to: SONOFF R4 device [SONOFF_XXXX] ip change to xxx.xxx.xxx.xxx
  5. You can also click the Refresh button under the list to force iCafeCloud Server to scan devices.(Figure 11)

Figure 11

  1. You can check the SONOFF device in iCafeCloud server logs (Figure 12)

Figure 12

  1. (Optional)Rename the device
    After completing the steps above, you can rename the device in iCafeCloud to any name you prefer.

Figure 13

Related: