Single phase Din rail Smart Switch with Energy monitoring zmai-90

I bought a zmai-90 and I plan to update the firmware by tasmota and try to use it to measure consumption.
I open this thread in case someone has achieved it and to be able to go counting the advances.


1 Like

I am planning on doing the same, but haven’t bought the meter yet. Can you please share your results?

Hy Denis!
For now only check all works with smart life before update to tasmota by OTA.
I keep you informed when I have time to do more.

Hi, i have it flashed with tuya-convert but only as switch without consumption

Any updates on this?

I also have this Smartswitch. It is based on a V9821 MCU designed for energy metering applications. The Wifi module, the TYWE3S, is (as most of you may know by now) is based on the ESP8266. I am on the way of tapping into the serial communication between the ESP and the MCU, and determine if it has any similarity with the data stream that occurs in other Tuya devices with MCUs. If this is the case, the TuyaMCU module in Tasmota may eventually be used to get the raw data and read it into MQTT topics.


Luis Teixeira

Some progress achieved. Full “Tasmotization” seems to be right around the corner:


Nice to know, waiting for progress

Hello all!

I’m also interested in this energy meter.

@pollinolas, did you follow the steps on this tutorial?

This guy (which has some great HA tutorials, by the way), has managed to successfuly integrate some Tuya based energy meters with HA, using EspHome.
The tutorial is for OTA flashing, which he states is no longer possible for Tuya devices, but by soldering serial leads it should still be achieved.

@luis_teixeira, I’ve seen your blog post, which is awesome, by the way.
From what you’ve seen, do you think this meter is safe/reliable to be connected 24/7 under the load of a whole house? I would not be pleased at all if some cheap device burns out from night to day and I would have to re-wire my breaker box just to have power in my house again… :slight_smile:
Do you think the relay consumption would be significant?


Hi Daniel, thanks for reaching out. I’ve see that integration using ESPHome. The device is however based on a different metering sensor (hlw8012).

I’m planning to share useable details in the next couple of days, regarding the these ZMAi-90 devices with the V9821. In a first iteration I am doing a pull request for Tasmota featuring 8E1 setting on the hardware serial port, which is required for the communication with this device.

I plan to later write a driver for this specific device in Tasmota, but for now extending the serial port capability on Tasmota will readily allow the device to be used (you can then parse the BCD encoded measurement fields, on the side).

Regarding your question about the safety of the device: from a basic inspection, the device seems to be robust enough (the relay itself is marked as rated for 80A, and the seller seemed to have been cautious enough to advertise it as rated to only 50-60A. The relay has thick copper rails. The other rail is also thick, but apparently not made of copper. The relay is bi-stable and does a respectable sound when it latches (like a circuit-breaker).

I don’t intend to use it in a setup above 30 Amps anyway. For being more on the safe side, it is probably a good idea to segregate different circuits in the house with more of these devices, allowing for less current in each.

The power consumption of the device itself is marginal, (judging by the consumption of the ESP8266, probably less than 100mA @ 5 Volts, or 0.5 Watts).


Luis Teixeira

1 Like

No,I did it with tuya-convert time ago

I’m waiting for that second part on your blog, thanks for your work

Regarding flashing Tasmota on this device, I was also able to use tuya-convert. In my case the original firmware was on version 1.0.6, according to the Tuya app.

For flashing via serial cable, I had to remove the R1 and R14 resistors (these are between the serial pins of the two MCUs), and then put these back in place. Possibly there is a more convenient approach, such as disabling the slave MCU, but so far I have not determined how. As with other ESP8266 devices, the GPIO0 pin has to be pulled down to GND while programming.

Luis Teixeira

I have finalized the changes to the Tasmota firmware that allow the necessary serial port settings to be changed. So far I have tested it on a NodeMCU against a computer (going through the 4 supported serial port data bits/parity/stop bits settings). Next I will flash on the ZMAi-90 and issue the commands from Tasmota, hopefully obtaining the metering responses. If you want to take a look and use it yourself, you can check here:

Thank you


Update: tested the new firmware on the ZMAi-90. Full success! Next step will be to write the blog post with the results and guidance/sample config for setting up the sensors and the switch in hassio.


1 Like

Oh boy… looking forward for it! :slight_smile: Great job!

Clearly not a priority, but do you see a chance of flashing the device without removing and putting back the resistors? I mean, I have some decent DIY soldering skills, but soldering SMD components (which, by the pictures, I assume those resistors are) it’s a whole new level. :slight_smile:

Thanks for your job!

Hi @Daniel, I haven’t deeply delved into that, but one possibility may be finding a pin that may be pulled low (or high), disabling the V9821 during the programming of the ESP, without removing anything. I will take a better look at the datasheet, and see if for example on the jtag interface pins there is something we can play with. I’m guessing that with the V9821 disabled, its UART pins will be in high impedance (assuming these are tri-state), hence not impacting the communication between the ESP and our serial interface. This all has to be confirmed, of course.


1 Like

As promissed, here are the detailed instructions (further down the post) and the full story on how I got the reverse engineering and the integration done:



Hi @luis_teixeira, read your post.
That is some impressive job! Congrats, and thank you so much for sharing it with us!

From what I’ve understood it is even possible to flash the device directly with tuya-convert, without all the soldering hassle. Is that correct?
That would be the icing on the cake… :slight_smile:


Hello @Daniel,

Yes it may be possible with tuya_convert, but it is not guaranteed now or in the future for every device, as a firmware upgrade may protect against the flaw that tuya-convert exploits. It is a good idea not to install the Tuya app after purchasing the device, as it may send an OTA firmware upgrade (I suspect these will be done silently, as the device prints in the debug output what appears to be a scan for firmware updates). That didn’t happen to mine though (app reported my device had firmware 1.0.6).