Tag Archives: WiFi

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.

Introduction to the Wiz smart lighting

Today you will get to know the Wiz lighting devices, for example, the filamentous (retro-styled) ST64 E27 bulb. The full name is “ST64 E27 WIZ DW FA Q”.

History of Wiz

Wiz was founded in 2017 as a startup, and in 2019 it already became a part of Signify, the world leader in the lighting industry. Signify is also the owner of Philips Hue. Wiz is the IoT platform of solutions for smart lighting. The Wiz ecosystem includes not only software solutions but also cloud features and products. Together with partners, the company offers lighting, devices, and accessories under different brands. Wiz already connected millions of devices in the market.

Unlike Philips Hue, Wiz offers smart lighting based on Wi-Fi, which is then controlled by a very handy app that connects to existing Wi-Fi networks. You don’t need a hub to control the system. The Wiz ecosystem covers more than 60 countries around the world.

Short characteristics and the Wiz ST64 E27

The light bulb is made out of glass, pear-shaped and retro-styled. The filaments are made out of rows of LEDs, that visually copy the filaments of “Edison’s lamp”. The light from such filaments is a nice white warm light with a cool temperature of 2200K. You can control the brightness of the lamp in a branded app. The max brightness of the lamp is 550 lumen, which is the equivalent of a 45W incandescent lamp.

I must say, controlling the brightness of the lamp by third-party dimmers is impossible, I recommend controlling the brightness from the original app only.

The lamp that sells in European shops has a plinth E27 and a voltage of 220-240W. That means using the device in the countries of North America would be impossible. Just as the advertisement booklet is stating, the lamp life is 22 years on the condition of work for 3 hours a day. The device has an energy-saving tier of A+.

Controlling the lamp is possible thanks to the Wi-Fi IEEE 802.11 b/g/n wireless standard with a frequency of 2.4 GHz. It is also possible to control the lamp using voice assistants or alternative smart home control systems.

The Wiz app for light control

First of all, after launching, the app will warn you that all Wiz devices added to your smart home, will only work with 2.4 GHz Wi-Fi networks.

Then you will be offered to create a Wiz account. This will help control your device in the future. If necessary, you can log onto your account using Google or Facebook.

In the settings, you can turn on local device control. This will be required to control lighting using Home Assistant. On the same screen, there is a possibility to turn on third-party integration, for example with Google and Alexa voice assistants.

We can add or change rooms in our smart home and assign smart devices to them.

Adding the lamp isn’t hard, you can just press the correlating button in the menu and choose the way to connect the device. But before that, don’t forget to turn on the lamp. Next, you will need to enter the password to your network so that this way you will save it onto your device.

It can happen if after adding the new lamp in the Wiz app you won’t be able to control it from the app. I don’t know why it happens, but everything works as it should right after relaunching the Wiz app. I could be wrong, but this bug only happens the first time you turn on the lamp after adding. Maybe this is caused by changing the network in the process of adding the device to the Wiz smart home.

So, controlling works now, and you can change the brightness from within the app. In the same app, you can set up scenes and routines for the devices. And if you added voice assistant integration, you can control the lighting using either your voice or the Google Home app.

Making it possible to control Wiz in Home Assistant

In order to control Wiz devices in Home Assistant, you need to enable local communication (Allow Using Communication) in the Wiz app. Also, don’t forget to make the lamp’s IP static in the router settings. Now we’ll go to Home Assistant settings and add the Wiz integration.

Now specify the IP address of your lamp.

If needed, set a correct room for it.

The lamp will be added to Home Assistant, every light bulb in the integration will have three essences, but currently, some of them could be disabled or unavailable. This depends on the scene or the current lamp mode. Of course, the “light” essence must be always available.

For convenience, you can add a card and control lighting from there. And if you already have a working Wiz integration you can add new automatization rules with its participation.

That’s it for today. See you!

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.