Python Plugin: TUYA

Python and python framework

Moderator: leecollings

manjh
Posts: 708
Joined: Saturday 27 February 2016 12:49
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: NL
Contact:

Re: Python Plugin: TUYA

Post by manjh »

Tuya worked OK from Domoticz for a little while, but the problems are back.
When I got home tonight, all Tuya devices were not accessibel from Domoticz. But the Tuya app worked OK.
There were no specific error messages in the Domoticz log.

I then tried to disable the plugin in the hardware tab, waited a little bit, and enabled it again. That corrected the problems... but for how long? :?
Hans
manjh
Posts: 708
Joined: Saturday 27 February 2016 12:49
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: NL
Contact:

Re: Python Plugin: TUYA

Post by manjh »

New info. Following instinct, I decided to set up a spare Tuya smartplug and send a switch command to it every hour. This has been running now for a few days, and the Tuya interface seems to stay active this way.
Does this make sense? Is it possible that the Tuya interface "dies" if it hasn't been used for a while?
Hans
manjh
Posts: 708
Joined: Saturday 27 February 2016 12:49
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: NL
Contact:

Re: Python Plugin: TUYA

Post by manjh »

OK, I have finally bit the bullet and started to set up a new Pi4 with Domoticz. Now am trying to install the Tuya plugin, but am running into some obstacles.
First, when I follow the link from the Domoticz Wiki, I see the github entry saying the plugin is no longer supported. It points me to TinyTuya.
When I follow the installation instructions for TinyTuya, I get an error message: "error: externally-managed-environment".
What should I do to install?
Hans
User avatar
waltervl
Posts: 5148
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Python Plugin: TUYA

Post by waltervl »

manjh wrote: Thursday 14 November 2024 9:34 OK, I have finally bit the bullet and started to set up a new Pi4 with Domoticz. Now am trying to install the Tuya plugin, but am running into some obstacles.
First, when I follow the link from the Domoticz Wiki, I see the github entry saying the plugin is no longer supported. It points me to TinyTuya.
When I follow the installation instructions for TinyTuya, I get an error message: "error: externally-managed-environment".
What should I do to install?
The dirty way is to add --break-system-packages at the end of the pip3 install module or requirements command line.
For example

Code: Select all

sudo pip3 install -r requirements.txt --break-system-packages
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
manjh
Posts: 708
Joined: Saturday 27 February 2016 12:49
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: NL
Contact:

Re: Python Plugin: TUYA

Post by manjh »

waltervl wrote: Thursday 14 November 2024 19:29
manjh wrote: Thursday 14 November 2024 9:34 OK, I have finally bit the bullet and started to set up a new Pi4 with Domoticz. Now am trying to install the Tuya plugin, but am running into some obstacles.
First, when I follow the link from the Domoticz Wiki, I see the github entry saying the plugin is no longer supported. It points me to TinyTuya.
When I follow the installation instructions for TinyTuya, I get an error message: "error: externally-managed-environment".
What should I do to install?
The dirty way is to add --break-system-packages at the end of the pip3 install module or requirements command line.
For example

Code: Select all

sudo pip3 install -r requirements.txt --break-system-packages
Thank you, that worked! :)
Hans
manjh
Posts: 708
Joined: Saturday 27 February 2016 12:49
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: NL
Contact:

Re: Python Plugin: TUYA

Post by manjh »

manjh wrote: Friday 08 November 2024 10:32 New info. Following instinct, I decided to set up a spare Tuya smartplug and send a switch command to it every hour. This has been running now for a few days, and the Tuya interface seems to stay active this way.
Does this make sense? Is it possible that the Tuya interface "dies" if it hasn't been used for a while?
Still on my "old" server, running Buster.
This stay-alive solution has worked sofar. Until day before yesterday: I forgot what the empty smartplug was for, so I removed it from the socket and stored it for later use. And sure enough, the Tuya interface stopped working overnight. I had to disable the plugin, wait a while, and enable it again...
Needless to say that the seemingly "unused" smartplug has found its place in the socket again...

Does this make sense to anyone? Is it possible that the interface goes into deep sleep after a period of inactivity?
Hans
manjh
Posts: 708
Joined: Saturday 27 February 2016 12:49
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: NL
Contact:

Re: Python Plugin: TUYA

Post by manjh »

I ran into a strange problem.
Last week, after using the smartplug for many months, it suddenly was unreachable from Domoticz. The Tuya app had no problem switching it off/on.
I tried to revive it by removing it from Domoticz and the Tuya plugin, and from the Tuya app. Then reset the device and installed it into the Tuya app, and it flowed into Domoticz. Still no luck: I cannot control the device from Domoticz.
So I decided to give up, and ordered a few new plugs (ZIgbee, this time).

This morning a second smartplug shows the same signs. Not reachable from Domoticz, everything OK from the Tuya app.

Any idea what may be going on? All other Tuya devices (lightbulbs, smartplugs, window sensors, temperature sensors) seem to be just fine...

I am using R-Pi4 with Buster, Domoticz 2022.2 with TUYA Plugin v.1.0.13. I realize they are out of date, but switching over to Bookworm with all new plugins on Domoticz is not trivial so it is still on my workstack... :(
Hans
manjh
Posts: 708
Joined: Saturday 27 February 2016 12:49
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: NL
Contact:

Re: Python Plugin: TUYA

Post by manjh »

manjh wrote: Tuesday 10 December 2024 12:34 I ran into a strange problem.
Last week, after using the smartplug for many months, it suddenly was unreachable from Domoticz. The Tuya app had no problem switching it off/on.
I tried to revive it by removing it from Domoticz and the Tuya plugin, and from the Tuya app. Then reset the device and installed it into the Tuya app, and it flowed into Domoticz. Still no luck: I cannot control the device from Domoticz.
So I decided to give up, and ordered a few new plugs (ZIgbee, this time).

This morning a second smartplug shows the same signs. Not reachable from Domoticz, everything OK from the Tuya app.

Any idea what may be going on? All other Tuya devices (lightbulbs, smartplugs, window sensors, temperature sensors) seem to be just fine...

I am using R-Pi4 with Buster, Domoticz 2022.2 with TUYA Plugin v.1.0.13. I realize they are out of date, but switching over to Bookworm with all new plugins on Domoticz is not trivial so it is still on my workstack... :(
Problem solved, although I donot really and fully understand why.

This afternoon I was wondering why these two smartplugs are failing, and all the others are not. The only thing I could think of: they are both located in my garage, the others are not. So I decided to restart the mesh accesspoint in the garage. And sure enough: both plugs are fully functional again, both from Tuya app and Domoticz!
So why were the plugs failing in Domoticz, and not in Tuya app? Could be timing related, perhaps? Hmmm...
But the good news: everything works again!
Hans
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest