Esphome vs Original Tuya firmware accuracy with power monitoring plugs

Hey guys,

Just ordered some Tuya compatible power sockets with power/energy monitoring and I’m planning on converting them to Esphome (to get rid of the cloud stuff obviously).

How accurate is Esphome to manage power/energy consumption? how does it behave on power outage? does it loose all data, or can it get saved data from hass/mqtt?

1 Like

You need to calibrate them.

1 Like
1 Like

Kind of depends of your update frequency and for sure of the power measuring hardware.

Do you know which one you got? Hopefully not something based on the hlw8012…

Depends all how you want them to behave…

Not much to loose actually - but you could even save sensor data to flash if you like

How “accurate” is the tuya firmware? You got any insights? Guess would need to de-compile and reveres engineer their firmware to get something…

In the end (if we say the hardware is identical and even take the assumption they use equal libraries etc.) it all comes down to the update frequency. With esphome you can go all the way the hardware supports, for example I used a 0.1 second update frequency on a pzem004t v3 which worked without troubles.

But will it be more accurate because it polls the hardware more often?

Not for power, voltage and so on but definitely for the energy usage over time :bulb:

I have no idea if the tuya firmware even supports this on the device? Maybe it’s just sends a snapshot of the current power usage (only) every 10 seconds to other people computers :cloud: and they accumulate it for you.

With esphome it’s also possible to have a very high internal update frequency for the power hardware to get accurate total energy accumulation but at the same time “limit” the frequency home assistant get’s the data.

Well thank you all for the comments, I hope these can be flashed to esphome at the first place as I just saw a recent comment on aliexpress from another buyer that these don’t support EZ Mode, which compromises the flashing, but worst case I’ll set them up using the official Tuya integration.

Many of the tuya stuff is replacing the mcu from esp (supports custom firmware and literally unbrickable :brick:) to other modules which are not supported by esphome, tasmota and so on.

other peoples computers :cloud:

Better go down the drain and retro fit the hardware with a esp module (around $1-2) in case you got hardware without it:

Quick update

Got my tyua plugs today, and all of them run a recent firmware version which blocks the tuya-convert exploit.

Integrated them with the official home assistant tuya integration and they show up as regular switches without the energy consumption info. Hopefully this will be fixed in a future update of home assistant.

I think that’s down to the Tuya integration, which is “officially maintained by the company”. So far it has not included any energy consumption features (see docs).

Not yet in 2021.11

For what I know, power metering is supported in localtuya

1 Like

I had a quite difficult journey with these plugs, localtuya is working fine, but the plugs were not updating as frequently as I’d like them to.

BUT the guys working on HACS localtuya integration just released a feature to support scan_interval, which actually saved me the hassle of flashing and maybe even saved the plugs from ending up in a trash bin.

Tuya smart plugs are now gone completely offline (no internet access from my dediceted IoT AP) to prevent accidental firmware updates that could break them once and for all, and also prevent them from doing useless updates on Tuya Cloud.

Can’t thank them enough :+1:


@ejalal is there any special quirks required to take those things offline?

My router is running openwrt, and it allows disabling wan on the virtual access point I created specifically for my iot devices.

Your router could have specific configuration, you can look at the firewall configuration to reject network traffic from your devices to the internet.

Well, the smart plugs try to reconnect to internet at some point, and they keep rebooting if they can’t reach the cloud :angry:

That’s why we flash esphome :rocket:

Full local control, upgradabilty… right to repair/own… All this is not possible when reliying on other peoples computer (cloud) or firmware :bulb:

You are right, that was exactly what I was looking for when I bought them.

I might end up tearing them apart and flash esphome. I checked their MAC addresses on and they belong to espressif, so they might have an esp8266 inside which is a good news.

1 Like

That is why I was asking my question above. I cannot remember where I read it but I remember there was something like that. The solution (again from the top of my head and I cannot remember where I read it) could be linked to preventing the tuya devices from making any DNS request (even via your router’s resolver)

Did you manage to replace firmware with ESPHome?