Tuya Switches w/ Power Usage Data (No TuyaConvert Needed)

@perr Please stop with the barage of messages. It doesn’t help get your issue resolved in fact it just makes it far more difficult. Also, the somewhat entitled tone of your messages does little to motivate me to look further into helping you. If you feel an issue was wrongly closed, just post a new comment and I’ll consider reopening it. Otherwise open a new ticket and reference the old one.

Remember that I’ve no obligation to help you or anyone else. I made some code for myself and was kind enough to post it to help others. If people are respectful, I try to find time to help them. Being a dick will get you nowhere.

1 Like

Phill,

First my unconditional appology to you, it has never been my intentention to pester you.

I think you have done a great job, and I have my self spent hours in trying to solve the en/decoding issues your solution is facing with other devices.

I will keep of the thread, and only return if I find a useable solution de/encoding solution.

Best regards,
Per

I have found this one https://github.com/subzero79/node-red-contrib-tuya-local
Very promissing and simplifies the topic you are working on. But the main problem is that author converted all his devices witn new tuya-convert and project is discontinued.

It is quite hard to install it but it definitely belongs to HACS.
I can get data in HomeAssistant but everything is in one entity. And I can not turn them on or off and add more than 2 devices as on template.

I would really appreciate if someone of you could continue his work and make user friendly solution

1 Like

HACS doesn’t have anything to do with node red.

2 Likes

Nath, with your help I managed to get the data. But I still can’t get anything useful out of it. Can not use power data in automations and even switching does not work for me…

I know. But I think that the same logic about the connection to local api could be used in HA component.

@monaco @Nath Would you guys mind creating a separate thread for this so that we can keep this one focused on the OP?

1 Like

Sorry, I moved to Tuya LOCAL with energy monitoring and without tuya-convert

1 Like

hey Ive managed to run Phils tuyapower2mqtt and would like to run it as an docker image, because I run hassio.

I am new to this so I have no clue how to use your dockerfile.
so far I’ve managed to run your docker but with no results.

this is how I run it:

docker run -d -e "MQTT_HOST=MQTT server IP" -e "RATE=2" -e "ID=Plug ID" -e "IP=Device ID" -e "KEY=device localKey" -e "VERSION=3.3" weldfire/tuya:single

my other question would be: how can I autorun this docker container on server start?

1 Like

Hi Nindtendo!

If you are replacing those strings that should work!
Are you getting any log output?

To answer your second question, after you run that command, it should keep going and restart when your server restarts until you kill the container manually.

To be honest, I use docker-compose to maintain my version; however, that shouldn’t be necessary.

unfortunately I couldn’t get it to work, but I found another solution to my problem.

Please, could you create the add-on?

As soon as I have time. In the meantime if anyone else is interested in turning my repo into a HACS compliant version they are more than welcome to do so. Pull Requests are also greatly appreciated.

1 Like

Any news from you about the add-on?

1 Like

I have some error after command

$ python getstats.py "MyValidID123456" "192.168.0.209" "MyValidKey7bb7b889af" "3.1"

$ Unexpected status() payload=b'r\xc0Z\xe72>ri\xa6\t\x19L\xe5-\x0eI\xde?=\x04\x9f\x8c\x19\xd6w\x02\x95C\t7\x82\x82'

After command
$ python getstats.py "MyValidID123456" "192.168.0.209" "MyValidKey7bb7b889af" "3.3"

i didn’t recevie any response

Firmvare ver. 1.0.4
Working on Qnap Docker with Debian
pytuya
Version: 7.0.5
python3.8

Anyone help?

Hello,
get error installing tuyapower2mqtt:
Command “python setup.py egg_info” failed with error code 1 in /tmp/pip-install-V7Az7g/tuyapower2mqtt/
i do not know what is getting wrong? any advice?
tia
Michael

Hello. This is very cool solution, I like it very much. The problem I have is that after some time, the switch seems to get stuck with constant values and it sends same values over and over again. Cron job works fine, I see MQTT message every minute. But values are same all the time and I have to look at socket in mobile Smart Life application. Then values in MQTT get updated, but when I kill Smart Life values are constat every minute again. Have you seen this? Looks like device is not probed to update.

I learned that device sends changed values in irregular intervals, sometimes even after one hour. I think that values change slightly in the meantime, but are not send. Major changes seem to be sent more often.

How does it work now?

Could we make integrations for more devices?