Tag Archives: sonoff

Review of the first Matter device from Sonoff: Mini R4M

Today, I want to show you a rather interesting and perspective device from a well-known Chinese brand. Should you buy it today? You can read this article to learn about its pros and cons.

SONOFF MINI Extreme Wi-Fi Smart Switch – or MiniR4M – is almost entirely a carbon copy of the MiniR4. Visually, it’s only distinguishable by the plating color on the contacts. It’s green here.

Disassembling the MiniR4M

The build of both devices is also almost identical, the only difference being the controller microcircuit. The previous device has Esp32-DOWD installed, but this one has Esp32-C3.

View from the relay’s side.

The PCB looks like this. The contacts are well-soldered, and the power tracks have a proficient cross-section. Note that the L In and S1 contacts used to connect the relay are interconnected. So, take safety precautions when connecting the device to a 220v network since the relay will have a high voltage.

How to add the MiniR4M to your smart home with eWeLink

Let’s start with the native app for Sonoff devices since you’ll only be able to upgrade its firmware and unlink the relay from the switch in said app.

In the image below, you can see the pros and cons of using the device with different smart home apps compared to eWeLink.

So, let’s hook the MiniR4M to the wires and connect it to the network. Here are multiple possible ways to connect it.

In my case, I connected the Shelly switch (actually a button) to the S1 and S2 connectors, the cable to L In and N, and the lamp to L Out and N.

After its first boot, after a few seconds, a pop-up to add the device to SmartThings has already appeared on my phone. Since I decided to add it to eWeLink first, I closed this pop-up.

So, after the device turns on, an LED will start blinking with a “2 short, 1 long” pattern, which means the device is in pairing mode. If that doesn’t happen, hold the button on the case for ten seconds. The phone should discover the new device. Also, connect your phone to a 2.4GHz network since the MiniR4M does not support 5GHz. One of the steps is entering the password to your Wi-Fi network. Just follow the steps on the screen.

After you add the device to the app, you can control and set it up. On the main screen, only the on/off setting is visible, but there’s way more in the app. From the settings, I’m highlighting “Switch Mode” – here, you can choose the switch type, which you will connect to the relay. In my case, it’s “Pulse Mode.” If you have a regular switch, select “Edge Mode.” In the settings, you can also disconnect the switch from the relay, change the device’s behavior during power loss, turn off the LED, etc.

This amount of features should be enough for the average user, but since Sonoff positions this device as a Matter device, it should work in multiple smart home apps. By default, just as I thought, MiniR4M is a cloud device. So, let’s try to add this device to other systems using the Matter protocol.

And here is where the fun begins…

Attempts to add the MiniR4M to Home Assistant

To clarify, when writing this review, the device received a 1.0.1 firmware update, and the eWeLink app got a 5.0.1 update. So, while reading this text, all the bugs may have already been fixed.

So, to add a Matter device to a compatible smart home system, you must have a QR code. It’s already there on MiniR4M’s case, and it’s also there on the box the device came in. But hypothetically, let’s imagine that the box was already thrown away, and the device was installed on a mounting box that’s inaccessible. Here, the stock app comes to our aid, which can generate the QR code required to pair the device to Home Assistant.

For that, in the app (in the device’s plugin), click the “Enable Pairing Mode” button. In response, we get a pop-up with the QR code and, take note, two underscores without numbers. Meanwhile, the device goes into pairing mode, followed by the LED (two short and one long flash).

For convenience, I printed the screenshot with the QR code and will now attempt to use it to add the MiniR4M to Home Assistant. On the phone, in the Home Assistant app, open “Settings” – “Devices & Services,” then click the “+” button below and select the first option – “Add Matter device.” After a few seconds, the camera app will open, and we must scan the QR code. After we do that, we get an error. The device refuses to connect.

But there’s more. After returning to the eWeLink app, the MiniR4M is offline. To work with it, reset the device to factory settings. For that, hold down the button on the case for 10 seconds. But, of course, you need physical access to the device.

Adding the device to Home Assistant while bypassing eWeLink

Since we already know how to add Matter devices, no additional problems should arise. Hold the button and eventually scan the QR code on the case or the box. The QR code that you printed before serves no use anymore. The device should connect without problems in two tries at most.

In Home Assistant’s Matter integration, the device will use a “Switch” entity by default. You can always change it to a different one, for example, Light. The next part is like always – use the device however you want in Home Assistant with nearly instantaneous response time.

Home Assistant’s Matter integration has a setback. We can’t, at least not in the current version of the Matter integration, “share” the device with a different smart home system. But how does Google Home combat this issue?

Adding the MiniR4M to Google Home

Just like before, put the device into pairing mode by holding the button on the case for 10 seconds. Of course, this will reset the device to factory settings. Theoretically, after that, your phone should “discover” the device and show the corresponding pop-up. All you have to do from there is click the “Add” button and scan the QR code.

If that doesn’t happen, open Google Home. In the second tab, click the “Add +” button, then select “New Device” – “Next.” In the window that opens, select “Matter-enabled device.” Scan the QR code and wait. All left to do is select the room and name the device.

From Google Home, you can turn the device on and off.

But the fun part is that from the app, you can generate a working QR or a pairing code to connect with other systems (or to save it for later). Apart from that, you can directly add the device to pre-installed smart home systems without opening the QR code scanner.

Conclusions

In my opinion, the first Matter device from Sonoff came out interesting and perspective. According to the retailer’s vision, there should be “an out-of-the-box cross-platform experience.” But, considering the device is still recent, it doesn’t work as well as the end user would think. Even in eWeLink, the relay can ignore commands for half a minute. Bugs with QR code generation only bring more inconveniences. Hopefully, firmware updates will make the “fever” go away.

Maybe someone is waiting to install a custom firmware, like ESPHome or Tasmota. Sorry to disappoint, but according to the regulations for Matter devices, the bootloader is locked, which means you can’t change the firmware other than through OTA updates.

So, I can’t recommend this device despite considering its low price, at least for now.

Home Assistant panel on Sonoff NSPanel Pro

This article is my adaptation of the story of enthusiast in smart homes who calls himself blakadder. His experience is below, and I used his materials in the article. Link to the original article by blakadder

Warning: I used a device from the pre-production batch, which was provided to me free of charge by Sonoff. Some of its elements may change with the official release.

For now, you can buy NSPanel Pro with a discount before the opening of sales in the Itead store.

After the shock and disappointment of the firmware release and the September update, I decided to go further. The easiest way to do this is with Android Debug Bridge.

Dissasemble

Remove the panel from the base. Remove the two screws on the back panel and then carefully detach the back plate starting from this point.

Now unscrew the small screws, the ones circled in red. Remove the harness from the touch panel and disconnect the connector to lift the PCB.

Connect the USB cable to the computer.

Install ADB drivers

Download the ADB drivers and install them.
When NSPanel Pro connects to the computer via USB, a new device should appear in the Device Manager.

Download Android platform tools and extract the contents into a folder. Open a command prompt and navigate to this folder. In my case, it’s at D:\adb.

Providing access to ADB

Run adb devices -l . It will list all connected devices with additional information.

D:\adb>adb devices -l
List of devices attached
F061512302021100016 device product:px30_evb model:px30_evb device:px30_evb transport_id:3

Run adb tcpip 5555, command to configure NSPanel Pro to listen for TCP/IP connections on port 5555.

D:\adb>adb tcpip 5555
restarting in TCP mode port: 5555

Now you can connect to NSPanel Pro wirelessly. If you do not know the IP address, type adb shell ip -o a to find it out.

Try this while you are still connected via USB to ensure everything works.

D:\adb>
adb connect 10.1.1.144
connected to 10.1.1.144:5555

Reassemble the panel and connect it to the power supply. After booting, run adb connect [ip_address].

Using ADB

With ADB, you have a powerful tool to control your NSPanel Pro. You can install and uninstall applications, get a list of running processes, free memory, and even gain root access.
Here is a list of ADB commands you can use on your NSPanel Pro.

It is handy to simulate pressing the “Home” button using adb shell input keyevent 3.

You can also get root access with adb root.

Send a file to NSPanel Pro, like a new wallpaper:

D:\adb>adb push wallpaper.jpg /sdcard/Download/wallpaper.jpg
wallpaper.jpg: 1 file pushed, 0 skipped. 18.5 MB/s (52101 bytes in 0.003s)

Installing a launcher

To make working with NSPanel easier, you need to change the default launcher, the eWeLink control panel, to a more familiar one. I chose Lawnchchair because of its small size. Download the APK to the adb folder and install it on NSPanel Pro using ADB.

D:\adb>adb install ch.deletescape.lawnchair.plah_2001.apk
Performing Streamed Install
Success

D:\adb>adb shell monkey -p ch.deletescape.lawnchair.plah 1
bash arg: -p
bash arg: ch.deletescape.lawnchair.plah
bash arg: 1
args: [-p, ch.deletescape.lawnchair.plah, 1]
arg: “-p”
arg: “ch.deletescape.lawnchair.plah”
arg: “1”
data=”ch.deletescape.lawnchair.plah”
Events injected: 1
## Network stats: elapsed time=32ms (0ms mobile, 0ms wifi, 32ms not connected)

Set the default launcher in Settings – Apps & notifications – Advanced – Default apps and set Lawnchair as “Home app.”

To enable the navigation bar, go to Settings – Display and turn on “show status bar.”

Now you can freely navigate the user interface.

Home Assistant

You can install the Home Assistant Companion app, but I have connection problems, probably because of the old WebView component used in the system. The same goes for the Fully Kiosk browser, which complains that WebView is too old.

But you can still access the Home Assistant dashboard through the browser. Download Chromium for Android and install it using the ADB command adb install chromium-106.0.5228.0.apk (version number may be different).

D:\adb>adb install chromium-106.0.5228.0.apk
Performing Streamed Install
Success

It will take some time because the apk file is big! You can run it using the launcher or using adb shell monkey – p org.chromium.chrome 1

It will complain about the lack of Google Play services. Ignore the message. Enter the Home Assistant URL and open it.

After going to the Home Assistant dashboard, tap the three dots and add the page to the home screen.

Pressing the icon opens the full-screen mode of the Home Assistant dashboard.

Capabilities

This solution is not perfect, but it’s what I’ve managed so far. The best option would be to reach out to Itead en masse and demand HA Companion or Fully Kiosk Browser support out-of-the-box. They get more sales, we get more features, it’s a win-win scenario, and now we know it’s possible. At the very least, demand that they update WebView to a compatible version. Tweet them at https://twitter.com/ITeadstudio, email them at support@itead.cc, or use the contact form!

Poking around in the adb environment revealed things like mosquitto, bash scripts to interact with the Zigbee module, RS485 traces, relay 1, relay 2, and possibly more. I hope that more developers who understand Android will fully unlock this device.

Sonoff POW Elite – power meter with relay, WiFi. Up to 20A

Approximately a week ago, in the official internet shop of a Chinese company Sonoff two devices appeared, marked as POWR316D and POWR320D. It’s the same device, with two modifications that differ only in the maximum allowable current flowing through it. And these are 16 and 20 Amps. I will review the devices as one, and the user must know the difference between the models when ordering the device.

SONOFF POW Elite features

  • Model – POWR316D/POWR320D
  • Case material – PC V0
  • Dimensions – 98x54x31 mm (DIN Rail mountable)
  • Input/Output – 100-240 В 50/60 Hz, 16A/20A Max
  • Wi-Fi – IEEE 802.11 b/g/n 2,4 GHz
  • WiSoC – Espressif ESP32 240 MHz with connection to Wi-Fi 2,4 GHz and Bluetooth 4.2

From the specifications, it is clear that the “brain” of the device is already familiar to us ESP32. Theoretically, we can change its firmware to alternatives called Tasmota or ESPhome.
The power meter has the possibility of mounting on a standard DIN rail.
You can install several such devices in an electrical switchboard and control the supply voltage, for example, outlets in your home. In this case, you should ensure a stable Wi-Fi signal between your router and the power meter in the shield. After all, its metal body can shield the passage of radio waves between devices. I will also warn readers against such a power meter at the main entrance to the apartment or house since its allowable power will not be enough for all your appliances.

Terminals for connection for both input and voltage output wires are in the lower part of the housing. There are four terminals, and you clamp the wires with screws. To access the clamping screws, remove the cover on the bottom of the housing. On the case near screws, there are markings for the corresponding wires.

At the top of the case above the display are status indicators with a single button to control the relay. This button also performs a device reset function.

eWeLink app features

The program interface is the same for almost all switches. Here’s quick access to the relay state switch from the card and the main menu. Detailed information on power consumption is also displayed here. The following information will be available to users

  • Electricity consumption for today (kWh)
  • Electricity consumed yesterday (kWh)
  • Electricity consumed per month (kWh)
  • Current (A)
  • Voltage (V)
  • Power (W)

The settings section will show the power status, we can turn on local control, and we can add schedules, timers, and cycles. Other settings allow you to add notifications based on relay status or power consumption goals for the day or month.

The values on the display and in eWeLink are updated every 5 seconds.

Smart Controls

eWeLink is compatible with smart speakers from Alexa and Google Home.
There is a possibility of integration with SmartThings. But unfortunately, you can’t control anything but turning the relay on or off. It is not possible to obtain information on electricity consumption through such integrations. There will be alternative firmware for the device. It’s probably already made. Both Tasmota and ESPHome allow you to transfer power usage statistics to Home Assistant, and from there, you can send them to Alexa or SmartThings.

What’s inside

Usually, Sonoff devices come with everything needed to tinker with the firmware, and the Sonoff POW Elite is no different. The PCB contains contacts for ESP32 (TC, RX, GND, Vcc), and something tells me that the button links to GPIO00, which enables the firmware mode.

The antenna got printed to the PCB. Unfortunately, there is no connector for connecting an external antenna, which makes another argument against a weak Wi-Fi signal.

The display controller chip is on the same side as the ESP32, with several contacts next to it to connect to the display itself. By the way – the screen has no backlight, which can be inconvenient at night. On the other hand, few control electricity consumption in the middle of the night.
ЗOn the back of the PCB, we see the elements of the power supply system (small transformer, capacitors, and filters). The large item on this side of the board is the relay.

This relay exactly controls the supply of voltage to the output of the power meter. In my opinion, the manufacturer could install a more powerful relay because, as you can see in the photo, there is more than enough space on the board. Maybe in a while, we will see an updated model of this power meter from Sonoff, but already designed for more power. It would be interesting to install one at the entrance to your home to control the electricity consumption inside your home. Logically, such a power meter would cost more, but I think the price here would differ only due to the cost of a more powerful relay.

Meeting the NSPanel switch and flashing ESPHome

Last year, the Chinese company Sonoff started crowdfunding, where they presented an interesting smart device. By the end of 2021, Sonoff introduced NSPanel. This device is a rectangular device with a colored touch display sized 3,5 inches and two physical buttons.

The touch display was also created by Sonoff, this is a Nextion model.

There are two versions of the NSPanel, and they differ only in size. One is for the US market, and the other one is for the EU countries. The power and logical parts of the devices are the same. As a “brain“, the company chose the Espressif ESP32-DOWD V3, which allowed working in Wi-Fi 4 802.11n/g/n networks. Bluetooth 4.2/5.x is only used when setting up the device.

Connecting NSPanel to the power grid

To set up and control the device you need to download the eWeLink app, it must be familiar with Sonoff devices owners. If you do not have an account yet, create it, or log onto your account. eWeLink lets you control connected devices from all around the world where the Internet connection is established.

So, to connect the NSPanel on the phone you need to turn on Bluetooth. After that, connect the device to the power grid.

Use safety precautions when working with high voltages!

In the eWeLink app press “add new device“. Then, you will see the device on the screen, tap on it to add it. Then, you may need to enter your Wi-Fi credentials. After connecting, the NSPanel most likely will ask you to update its firmware. Do it, because this update may contain bug fixes or performance improvements. The update may take a while.

The power part of the switch includes two relays that can withstand up to 16A of current. This means that you can connect two additional electric devices. It could be not only lighting devices but also, for example, a warm floor controller. Below is a switch connecting scheme.

Setting up the NSPanel in eWeLink

In the eWeLink application, you can switch one of the switch relays to thermostat mode, then the built-in thermal sensor can control the temperature in the room. For the thermostat, choose the heating or cooling mode depending on the device you want to connect (heater or cooler). Set the target temperature in the room and the device will turn off when it reaches the target temperature.

To reach the thermostat screen on the switch, swipe right on its screen. One more swipe will lead you to widgets. These are pictograms with which you can control other smart devices. This way you can control plugs or bulbs, and also their groups. In addition, you can create widgets to load a scene.

You need to create widgets in the eWeLink app. The max widget number is 8.

To control the device using voice assistants create the appropriate integration in the eWeLink app. In addition, Sonoff allows controlling the switch in a local network, which enables integrations into alternative smart home control systems. Enable the corresponding item in the device settings.

Getting ready to launch ESPHome

I think that this smart device is “smart” only when it can work independently of cloud services. NSPanel can work locally but sadly, its widgets don’t work without a network connection. Essentially, you can only control two relay devices through a local network.

Just as I stated above, the logical part of the switch is a Nextion display that is connected to the esp32 controller. Such a tandem gives us hope for the ability to easily load alternative firmware. And really, “tasmota” firmware already exists for our device, work on creating an NSPanel component for ESPhome is also in full swing.

Let’s look at the PCB of the logic unit. To take it out, lightly press the screwdriver on the groove in the center. Remember to turn off the power beforehand!

Now you need to unscrew two screws that hold the protective plate. After you carefully remove the plate, you will see the PCB with the esp32 controller microcircuit.

You will see 5 contacts in the lower corner. They are marked as 3V3, ESP_TX, ESP_RX, GND, and IO0. The last contact is a “zero” pin controller. To switch the controller to firmware mode, connect it to the neutral wire.

To flash the controller’s firmware, you will need a usb2uart (USB to TTL converter) adapter. Before you connect it to the computer, set the voltage to 3.3V, this is important!

Using Dupont wires, connect the adapter to the PCB: VCC – 3V3, GND – GND, RX – ESP_TX, TX – ESP_RX. Connect the IO0 pin on the PCB to the neutral wire on the contact pad (green wire on the picture)

Pay attention: If the Dupont wire contacts protrude beyond the contact holes on the board, they will touch the metal plate of the display. This can lead to a short circuit and both the USB adapter and NSPanel chips failure! To avoid this, disconnect the display cable and remove the PCB from the chassis.

Downloading ESPHome onto the NSPanel

Now you can confidently download the ESPHome firmware. Connect the USB adapter to the computer, and in the device manager, look what COM port it received. Now, in the ESPHome interface, you can create a new node. To be honest, downloading empty code onto esp32 and then working with the created node using Wi-Fi would be enough. To do this, select the firmware option of the ESP controller connected to the computer. Then, select the COM port in the popup. Downloading the firmware takes a few minutes. The contacts need to stay connected!

After the firmware is loaded, disconnect the wires and assemble the switch. After connecting the NSPanel to the network, you can use the switch just like a regular esp32 controller. Now let’s download an already prepared code.

After reboot, the switch will have a familiar interface. I want to warn you: There’s no official thermostat support, so I didn’t add it in the code. The thermostat, just like some widgets, could be added by JSON requests. The format which JSON should have can be read here. And here you can find another variant of the code, already bundled with some widgets and a thermostat. One thing, you will need to replace the device IDs with yours.

For an example of scene widgets, I added code that will turn off melodies on the built-in NSPanel booster (piezodynamic). You can add and load any scene with Home Assistant.

After the official release of NSPanel components for ESPHome, I plan to update the article, so check for updates. In addition, there is a way to fully change the interface and switch from the NSPanel Protocol, since onboard of the switch we have Nextion display and esp32, but that is a topic for another article.