Tuya power consumption integration

Hello,
the current Tuya component can only power on/off the device but doensn’t retrieve the power comsumption.
This integration here:


is able to retrieve those values, would be great to integrate it in the current component or just create a new one only to get those values.

Thank you

I got the value in to HA with MQTT
https://pastebin.com/c3bh1zKi

But problem is that the plug turns off randomly now when i fetch the value with powermonitor…

Same issue. Returns the values OK, but then turns off the plug. ;-(

I install it on a RPI and it´s still up n runnig
I fetch with a bashscript
python /home/pi/Downloads/powermonitor/plugpower.py > plug.log

Polling Device xxxxxx at 192.168.xxxxxx
Dictionary {u’devId’: u’xxxxxx ‘, u’dps’: {u’24’: 17521, u’25’: 1190, u’20’: 2290, u’21’: 1, u’22’: 635, u’23’: 30333, u’19’: 13, u’18’: 9, u’1’: True, u’9’: 0}}
Switch On: True

I run the script from Crontab every 3 min

I’m using it to monitor power consumption. works flawlessly.
gfdgfgfdgf

I updated the firmware on the Tuya, and that seemed to have solved it. It now polls without shutting off the switch.

Ouch, spoke too soon. The ‘plugpower.py’ code will randomly shut the switch off. Not good, as it powers my fridge.

I’m running on an Intel NUC, Ubuntu Linux. I’ll poke around the API and see what may be causing it.