Power sensor

Trying to make an automation when tv is on to turn on lights
purchased a energy monitoring plug which uses Tuya

only has one entity for on off
Can’t figure out how to get this to work in an automation based on the wattage or current consumption.
I see it in the statistics in Tuya but not in HA

1 Like

Did you check under Developer Tools -> States whether the entity has an attribute for power or not?

yes I checked in
switch.44860572840d8e41ddab all it has in attributes is
friendly_name: Smart 15EM Plug-In

Then it looks like you won’t be able to do this yet. I’d ask the dev of the integration whether this could be included.

ok thanks. tried looking for where I can find developers and can’t find. can I post somewhere else?
thanks

Which integration do you use to add them to home assistant?

this one

It’s a core integration, you can post an issue on GitHub here -> https://github.com/home-assistant/core/issues

thanks I will do

For anyone else here is answer from developer
Energy monitor info is not support by TuyaAPI used by this integration

Therefore do not get a tuya energy smart plug to use with HA

You can use LocalTuya and you’ll have access to current, voltage and power as attributes of the entity. It’s not very easy to do it but you’ll find tutorials on youtube on how to get the local keys for your devices. DO NOT follow any tutorial that makes you register to the Tuya Developers website because that method doesn’t work anymore. I personally did it with the rooted-Android method installing BlueStacks.

The instructions for LocalTuya (installed through HACS) can be found in HACS itself.
I recommend NOT using the UI to add the devices but edit the configuration.yaml yourself as instructed on LocalTuya’s page (on github too)

The only thing that confused me is choosing the “entity id” when adding the device. Basically every Tuya device can have more than one entity and some of them are dummy. Try to work out from their values what they are. For instance I had a simple smart plug with IDs:
ID 1 - True
ID 9 - 0

ID 1 is True when the plug is on, False when it’s off. ID 9 is always 0 so it probably doesn’t do anything or it may be an input and if you force it to 1 resets the plug (I don’t know I did not try).

The plugs that have energy monitoring had 5 IDs. The first True/False is the state of the switch, the second again was dummy always zero but then the other ones were numbers and represented the current, the voltage, and the power consumption

For anyone else interested in flashing these plugs, the OTA method with tuya-convert wouldn’t work for me, however flashing them over UART with ESPHome worked great! I have created a guide here for anyone else interested, www.reddit.com/r/Esphome/comments/1k6hyh3/topgreener_tgwf115apm_wifi_plug_esphome_install/