Python Plugin: Domoticz-TinyTUYA-Plugin (Cloud)

Python and python framework

Moderator: leecollings

Post Reply
User avatar
Xenomes
Posts: 396
Joined: Tuesday 27 November 2018 19:05
Target OS: Linux
Domoticz version: 2024.7
Location: Netherlands
Contact:

Re: Python Plugin: Domoticz-TinyTUYA-Plugin (Cloud)

Post by Xenomes »

dgilbert2 wrote: Saturday 01 April 2023 14:36 I've updated to latest tinytuya, same problem.

The second command though has broken my setup, I'm now getting these errors;
You can turn back, by enter the previous version number.

Code: Select all

sudo pip3 install requests==version
dgilbert2 wrote: Saturday 01 April 2023 14:36 The third one gives error docker not found.
Are you using a docker Domoticz?
HP T630 (256GB SSD/8GB Mem) - Ubuntu 24.04.2 LTS (64Bit) - Domoticz 2024.7 (Docker) Machinon theme - RFLink - KaKu - Sonoff - Tasmota - Shelly - MQTT2Zigbee - OpenTherm Gateway - Tinytuya - IR Blaster - P1 Smart Meter - NPN Watermeter - Google Assistant
dgilbert2
Posts: 95
Joined: Wednesday 16 August 2017 8:08
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.7
Location: UK
Contact:

Re: Python Plugin: Domoticz-TinyTUYA-Plugin (Cloud)

Post by dgilbert2 »

Thank you for your help.

I've rolled back using 'sudo pip3 install requests==2.25.1' and all working again, except for the original issue.

I'm using Domoticz on a RPI with Bullseye, so no docker??
User avatar
Xenomes
Posts: 396
Joined: Tuesday 27 November 2018 19:05
Target OS: Linux
Domoticz version: 2024.7
Location: Netherlands
Contact:

Re: Python Plugin: Domoticz-TinyTUYA-Plugin (Cloud)

Post by Xenomes »

dgilbert2 wrote: Saturday 01 April 2023 15:48 I've rolled back using 'sudo pip3 install requests==2.25.1' and all working again, except for the original issue.
can you update the charset-normalizer

Code: Select all

sudo pip3 install charset-normalizer --upgrade
dgilbert2 wrote: Saturday 01 April 2023 15:48 I'm using Domoticz on a RPI with Bullseye, so no docker??
There are more users that use Domoticz in a docker environment, here some info
HP T630 (256GB SSD/8GB Mem) - Ubuntu 24.04.2 LTS (64Bit) - Domoticz 2024.7 (Docker) Machinon theme - RFLink - KaKu - Sonoff - Tasmota - Shelly - MQTT2Zigbee - OpenTherm Gateway - Tinytuya - IR Blaster - P1 Smart Meter - NPN Watermeter - Google Assistant
dgilbert2
Posts: 95
Joined: Wednesday 16 August 2017 8:08
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.7
Location: UK
Contact:

Re: Python Plugin: Domoticz-TinyTUYA-Plugin (Cloud)

Post by dgilbert2 »

I'm confused now to be honest.

I've now confirmed with 'pip3 show' that my charset-normalizer version has updated to Version: 3.1.0.
However, pip show is saying version 3.0.1

Tinytuya also confusing:
pip3 show tinytuya, shows version 1.11.0, even after 'sudo pip3 install tinytuya --upgrade'
pip show tinytuya, shows version 1.12.2

Domoticz plus this tinytuya-plugin uses Python 3 / pip3 ? Yet, I cannot get it to upgrade to tinytuya 1.12.2

Does any of this cause the random problems at startup though?
User avatar
Varazir
Posts: 377
Joined: Friday 20 February 2015 22:23
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Contact:

Re: Python Plugin: Domoticz-TinyTUYA-Plugin (Cloud)

Post by Varazir »

Hello,

I keep getting this

Code: Select all

2023-04-02 14:05:22.651 TinyTUYA: Device read failed: bfd6bda7f3a84e2064d97h
Raspberry PI 2 with RaZberry Controller 2016 ZWave+ and CC2531(zigbee)
Several IKEA devices/z-wave devices
dgilbert2
Posts: 95
Joined: Wednesday 16 August 2017 8:08
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.7
Location: UK
Contact:

Re: Python Plugin: Domoticz-TinyTUYA-Plugin (Cloud)

Post by dgilbert2 »

Xenomes wrote: Saturday 01 April 2023 21:34 can you update the charset-normalizer

Code: Select all

sudo pip3 install charset-normalizer --upgrade
I've now cleaned things up and reinstalled the required packages using;

Code: Select all

sudo pip uninstall tinytuya requests charset-normalizer
sudo pip3 uninstall tinytuya requests charset-normalizer
sudo pip3 install tinytuya requests charset-normalizer --upgrade
This gave me the following versions:
tinytuya 1.12.1
requests 2.28.2
charset-normalizer 3.1.0

However, with these versions Domoticz gives these errors with a 'hardware update':

Code: Select all

2023-04-02 14:41:41.804 Error: TinyTUYA: (tinytuya) failed to load 'plugin.py', Python Path used was '/home/pi/domoticz/plugins/Domoticz-TinyTUYA-Plugin/:/usr/lib/python39.zip:/usr/lib/python3.9:/usr/lib/python3.9/lib-dynload:/usr/local/lib/python3.9/dist-packages:/usr/lib/python3/dist-packages:/usr/lib/python3.9/dist-packages'.
2023-04-02 14:41:41.824 Error: TinyTUYA: Traceback (most recent call last):
2023-04-02 14:41:41.824 Error: TinyTUYA: File "/home/pi/domoticz/plugins/Domoticz-TinyTUYA-Plugin/plugin.py", line 60, in <module>
2023-04-02 14:41:41.824 Error: TinyTUYA: import tinytuya
2023-04-02 14:41:41.824 Error: TinyTUYA: File "/usr/local/lib/python3.9/dist-packages/tinytuya/__init__.py", line 99, in <module>
2023-04-02 14:41:41.824 Error: TinyTUYA: from .Cloud import Cloud
2023-04-02 14:41:41.824 Error: TinyTUYA: File "/usr/local/lib/python3.9/dist-packages/tinytuya/Cloud.py", line 36, in <module>
2023-04-02 14:41:41.824 Error: TinyTUYA: import requests
2023-04-02 14:41:41.824 Error: TinyTUYA: File "/usr/local/lib/python3.9/dist-packages/requests/__init__.py", line 48, in <module>
2023-04-02 14:41:41.824 Error: TinyTUYA: from charset_normalizer import __version__ as charset_normalizer_version
2023-04-02 14:41:41.824 Error: TinyTUYA: File "/usr/local/lib/python3.9/dist-packages/charset_normalizer/__init__.py", line 24, in <module>
2023-04-02 14:41:41.824 Error: TinyTUYA: from .api import from_bytes, from_fp, from_path
2023-04-02 14:41:41.824 Error: TinyTUYA: File "/usr/local/lib/python3.9/dist-packages/charset_normalizer/api.py", line 5, in <module>
2023-04-02 14:41:41.824 Error: TinyTUYA: from .cd import (
2023-04-02 14:41:41.824 Error: TinyTUYA: File "/usr/local/lib/python3.9/dist-packages/charset_normalizer/cd.py", line 9, in <module>
2023-04-02 14:41:41.824 Error: TinyTUYA: from .md import is_suspiciously_successive_range
2023-04-02 14:41:41.824 Error: TinyTUYA: AttributeError: PyCapsule_Import "charset_normalizer.md__mypyc.init_charset_normalizer___md" is not valid
To get 'hardware update' to work I needed to downgrade requests to 2.28.1 which also downgrades charset-normalizer to 2.1.1.

So for me at least, I couldn't use sudo pip3 install tinytuya requests charset-normalizer --upgrade as it creates compatibility issues.

All this though has not made any improvement to the random start-up problems with the plugin.
User avatar
Xenomes
Posts: 396
Joined: Tuesday 27 November 2018 19:05
Target OS: Linux
Domoticz version: 2024.7
Location: Netherlands
Contact:

Re: Python Plugin: Domoticz-TinyTUYA-Plugin (Cloud)

Post by Xenomes »

dgilbert2 wrote: Saturday 01 April 2023 23:15 I'm confused now to be honest.
I've now confirmed with 'pip3 show' that my charset-normalizer version has updated to Version: 3.1.0.
However, pip show is saying version 3.0.1
Tinytuya also confusing:
pip3 show tinytuya, shows version 1.11.0, even after 'sudo pip3 install tinytuya --upgrade'
pip show tinytuya, shows version 1.12.2
Domoticz plus this tinytuya-plugin uses Python 3 / pip3 ? Yet, I cannot get it to upgrade to tinytuya 1.12.2
Does any of this cause the random problems at startup though?
pip uses the default Python pip -V, Domoticz use python3 so with pip3 you force pip to use the correct one. There is also the with or without the sudo command, Domoticz runs as root so with. sudo ps aux | grep domoticz.pid
dgilbert2 wrote: Sunday 02 April 2023 16:00 This gave me the following versions:
tinytuya 1.12.1
requests 2.28.2
charset-normalizer 3.1.0
My versions are on my test and live system:
Tinytuya 1.12.2
Requests 2.28.2
Charset-normalizer 3.1.0
dgilbert2 wrote: Sunday 02 April 2023 16:00 However, with these versions Domoticz gives these errors with a 'hardware update':

Code: Select all

2023-04-02 14:41:41.824 Error: TinyTUYA: from charset_normalizer import __version__ as charset_normalizer_version
2023-04-02 14:41:41.824 Error: TinyTUYA: File "/usr/local/lib/python3.9/dist-packages/charset_normalizer/__init__.py", line 24, in <module>
2023-04-02 14:41:41.824 Error: TinyTUYA: from .api import from_bytes, from_fp, from_path
2023-04-02 14:41:41.824 Error: TinyTUYA: File "/usr/local/lib/python3.9/dist-packages/charset_normalizer/api.py", line 5, in <module>
2023-04-02 14:41:41.824 Error: TinyTUYA: from .cd import (
2023-04-02 14:41:41.824 Error: TinyTUYA: File "/usr/local/lib/python3.9/dist-packages/charset_normalizer/cd.py", line 9, in <module>
2023-04-02 14:41:41.824 Error: TinyTUYA: from .md import is_suspiciously_successive_range
2023-04-02 14:41:41.824 Error: TinyTUYA: AttributeError: PyCapsule_Import "charset_normalizer.md__mypyc.init_charset_normalizer___md" is not valid
The most error are about charset_normalizer.. very strange.
dgilbert2 wrote: Sunday 02 April 2023 16:00 To get 'hardware update' to work I needed to downgrade requests to 2.28.1 which also downgrades charset-normalizer to 2.1.1.
So for me at least, I couldn't use sudo pip3 install tinytuya requests charset-normalizer --upgrade as it creates compatibility issues.
All this though has not made any improvement to the random start-up problems with the plugin.
on another system i have these versions.
Tinytuya 1.10.1
Requests 2.23.0
Charset-normalizer 3.0.1
HP T630 (256GB SSD/8GB Mem) - Ubuntu 24.04.2 LTS (64Bit) - Domoticz 2024.7 (Docker) Machinon theme - RFLink - KaKu - Sonoff - Tasmota - Shelly - MQTT2Zigbee - OpenTherm Gateway - Tinytuya - IR Blaster - P1 Smart Meter - NPN Watermeter - Google Assistant
User avatar
heggink
Posts: 977
Joined: Tuesday 08 September 2015 21:44
Target OS: Raspberry Pi / ODroid
Domoticz version: 12451
Location: NL
Contact:

Re: Python Plugin: Domoticz-TinyTUYA-Plugin (Cloud)

Post by heggink »

Getting this error:

Code: Select all

Error: TUYA: handleThread: Credentials are incorrect or tuya subscription has expired!
Everything works fine and I can control the infrared panels nicely... Thoughts?
Docker in Truenas scale, close to latest beta
DASHTICZ 🙃
RFXCOM, zwavejs2mqtt, zigbee2mqtt,
P1 meter & solar panel
Google home, Wifi Cams motion detection
Geofence iCloud, Bluetooth & Wifi ping
Harmony hub, Nest, lots more :-)
User avatar
heggink
Posts: 977
Joined: Tuesday 08 September 2015 21:44
Target OS: Raspberry Pi / ODroid
Domoticz version: 12451
Location: NL
Contact:

Re: Python Plugin: Domoticz-TinyTUYA-Plugin (Cloud)

Post by heggink »

After a bunch of errors last night, no more updates and the plugin locks domoticz (webserver thread) so had to disable :-(.
TUYA: No device data returnd for Tuya. Trying again!
Weirdly, doing a python -m tinytuya scan show all my 3 devices?!?!
The previous error is no longer there. Then again running the wizard reveals that I do need a subscription so I just requested a 6 month extension :-(.
Docker in Truenas scale, close to latest beta
DASHTICZ 🙃
RFXCOM, zwavejs2mqtt, zigbee2mqtt,
P1 meter & solar panel
Google home, Wifi Cams motion detection
Geofence iCloud, Bluetooth & Wifi ping
Harmony hub, Nest, lots more :-)
User avatar
heggink
Posts: 977
Joined: Tuesday 08 September 2015 21:44
Target OS: Raspberry Pi / ODroid
Domoticz version: 12451
Location: NL
Contact:

Re: Python Plugin: Domoticz-TinyTUYA-Plugin (Cloud)

Post by heggink »

And approved from Tuya for another 6 months. Now everything works fine again.
Docker in Truenas scale, close to latest beta
DASHTICZ 🙃
RFXCOM, zwavejs2mqtt, zigbee2mqtt,
P1 meter & solar panel
Google home, Wifi Cams motion detection
Geofence iCloud, Bluetooth & Wifi ping
Harmony hub, Nest, lots more :-)
dgilbert2
Posts: 95
Joined: Wednesday 16 August 2017 8:08
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.7
Location: UK
Contact:

Re: Python Plugin: Domoticz-TinyTUYA-Plugin (Cloud)

Post by dgilbert2 »

Xenomes wrote: Saturday 01 April 2023 13:19 I think there is a change at Tuya I will monitor it with my own system.
Touch wood, I've not had any start-up issues today, maybe they were doing some work on the servers over the weekend. Shame they don't have a status page.
dgilbert2
Posts: 95
Joined: Wednesday 16 August 2017 8:08
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.7
Location: UK
Contact:

Re: Python Plugin: Domoticz-TinyTUYA-Plugin (Cloud)

Post by dgilbert2 »

heggink wrote: Monday 03 April 2023 12:21 And approved from Tuya for another 6 months. Now everything works fine again.
Sounds good, BTW how many times have you asked for an extension now?
User avatar
Xenomes
Posts: 396
Joined: Tuesday 27 November 2018 19:05
Target OS: Linux
Domoticz version: 2024.7
Location: Netherlands
Contact:

Re: Python Plugin: Domoticz-TinyTUYA-Plugin (Cloud)

Post by Xenomes »

heggink wrote: Monday 03 April 2023 9:48 After a bunch of errors last night, no more updates and the plugin locks domoticz (webserver thread) so had to disable :-(.
TUYA: No device data returnd for Tuya. Trying again!
I have change the code if 5 times the return of Tuya is empty to log to check if the subscription is ended.
HP T630 (256GB SSD/8GB Mem) - Ubuntu 24.04.2 LTS (64Bit) - Domoticz 2024.7 (Docker) Machinon theme - RFLink - KaKu - Sonoff - Tasmota - Shelly - MQTT2Zigbee - OpenTherm Gateway - Tinytuya - IR Blaster - P1 Smart Meter - NPN Watermeter - Google Assistant
User avatar
heggink
Posts: 977
Joined: Tuesday 08 September 2015 21:44
Target OS: Raspberry Pi / ODroid
Domoticz version: 12451
Location: NL
Contact:

Re: Python Plugin: Domoticz-TinyTUYA-Plugin (Cloud)

Post by heggink »

dgilbert2 wrote: Monday 03 April 2023 18:47
heggink wrote: Monday 03 April 2023 12:21 And approved from Tuya for another 6 months. Now everything works fine again.
Sounds good, BTW how many times have you asked for an extension now?
This is my first so 6 months no hassle!
Docker in Truenas scale, close to latest beta
DASHTICZ 🙃
RFXCOM, zwavejs2mqtt, zigbee2mqtt,
P1 meter & solar panel
Google home, Wifi Cams motion detection
Geofence iCloud, Bluetooth & Wifi ping
Harmony hub, Nest, lots more :-)
User avatar
Xenomes
Posts: 396
Joined: Tuesday 27 November 2018 19:05
Target OS: Linux
Domoticz version: 2024.7
Location: Netherlands
Contact:

Re: Python Plugin: Domoticz-TinyTUYA-Plugin (Cloud)

Post by Xenomes »

dgilbert2 wrote: Sunday 02 April 2023 16:00 To get 'hardware update' to work I needed to downgrade requests to 2.28.1 which also downgrades charset-normalizer to 2.1.1.

So for me at least, I couldn't use sudo pip3 install tinytuya requests charset-normalizer --upgrade as it creates compatibility issues.

All this though has not made any improvement to the random start-up problems with the plugin.
Did some final tests and the best working solution is:

Code: Select all

sudo pip3 install tinytuya -U
sudo pip3 install requests==2.23.0 charset-normalizer==3.0.1
I have update the readme on the github.
HP T630 (256GB SSD/8GB Mem) - Ubuntu 24.04.2 LTS (64Bit) - Domoticz 2024.7 (Docker) Machinon theme - RFLink - KaKu - Sonoff - Tasmota - Shelly - MQTT2Zigbee - OpenTherm Gateway - Tinytuya - IR Blaster - P1 Smart Meter - NPN Watermeter - Google Assistant
User avatar
heggink
Posts: 977
Joined: Tuesday 08 September 2015 21:44
Target OS: Raspberry Pi / ODroid
Domoticz version: 12451
Location: NL
Contact:

Re: Python Plugin: Domoticz-TinyTUYA-Plugin (Cloud)

Post by heggink »

As of this morning, the plugin stopped working for me. tinytuya scan and wizard both work fine. The plugin itself gives an error:
TUYA: No device data returned for Tuya. Trying again!
TUYA hardware (120) thread seems to have ended unexpectedly
Causing the tuya plugin to hog the system (disabled it).
It stopped working after my raspberry pi crashed and rebooted itself.

Any thoughts?
Docker in Truenas scale, close to latest beta
DASHTICZ 🙃
RFXCOM, zwavejs2mqtt, zigbee2mqtt,
P1 meter & solar panel
Google home, Wifi Cams motion detection
Geofence iCloud, Bluetooth & Wifi ping
Harmony hub, Nest, lots more :-)
User avatar
Xenomes
Posts: 396
Joined: Tuesday 27 November 2018 19:05
Target OS: Linux
Domoticz version: 2024.7
Location: Netherlands
Contact:

Re: Python Plugin: Domoticz-TinyTUYA-Plugin (Cloud)

Post by Xenomes »

heggink wrote: Wednesday 12 April 2023 9:27 As of this morning, the plugin stopped working for me. tinytuya scan and wizard both work fine. The plugin itself gives an error:
TUYA: No device data returned for Tuya. Trying again!
TUYA hardware (120) thread seems to have ended unexpectedly
Causing the tuya plugin to hog the system (disabled it).
It stopped working after my raspberry pi crashed and rebooted itself.
First, update to the latest version. Then, the plugin will attempt to retrieve data from Tuya six times. If unsuccessful, it will switch to update mode to prevent hanging in Domoticz. However, this may cause errors due to missing data. To retrieve the device data in Domoticz's memory, you will need to restart the plugin.
heggink wrote: Wednesday 12 April 2023 9:27 Any thoughts?
As of now, I am not aware of any issues with my systems since they are running smoothly.
HP T630 (256GB SSD/8GB Mem) - Ubuntu 24.04.2 LTS (64Bit) - Domoticz 2024.7 (Docker) Machinon theme - RFLink - KaKu - Sonoff - Tasmota - Shelly - MQTT2Zigbee - OpenTherm Gateway - Tinytuya - IR Blaster - P1 Smart Meter - NPN Watermeter - Google Assistant
User avatar
heggink
Posts: 977
Joined: Tuesday 08 September 2015 21:44
Target OS: Raspberry Pi / ODroid
Domoticz version: 12451
Location: NL
Contact:

Re: Python Plugin: Domoticz-TinyTUYA-Plugin (Cloud)

Post by heggink »

Thanks for the fast response. I deleted the entire folder, did a fresh git pull. Updated everything according to the wiki, restarted domoticz but no luck. It still says No device data returned :-(.
Using the tinytuya wizard and scan both return the devices I have with their states.
Docker in Truenas scale, close to latest beta
DASHTICZ 🙃
RFXCOM, zwavejs2mqtt, zigbee2mqtt,
P1 meter & solar panel
Google home, Wifi Cams motion detection
Geofence iCloud, Bluetooth & Wifi ping
Harmony hub, Nest, lots more :-)
User avatar
Xenomes
Posts: 396
Joined: Tuesday 27 November 2018 19:05
Target OS: Linux
Domoticz version: 2024.7
Location: Netherlands
Contact:

Re: Python Plugin: Domoticz-TinyTUYA-Plugin (Cloud)

Post by Xenomes »

That's strange. I'll run some tests tonight when I'm at home to see if I can figure out the issue.
HP T630 (256GB SSD/8GB Mem) - Ubuntu 24.04.2 LTS (64Bit) - Domoticz 2024.7 (Docker) Machinon theme - RFLink - KaKu - Sonoff - Tasmota - Shelly - MQTT2Zigbee - OpenTherm Gateway - Tinytuya - IR Blaster - P1 Smart Meter - NPN Watermeter - Google Assistant
dgilbert2
Posts: 95
Joined: Wednesday 16 August 2017 8:08
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.7
Location: UK
Contact:

Re: Python Plugin: Domoticz-TinyTUYA-Plugin (Cloud)

Post by dgilbert2 »

It's looking like the random problem I was having a couple of weeks ago has returned except its a 100% failure now when restarting the plugin. If I run debug_discovery.py there is no List of devices, just [].

Interestingly, I have a PI that has not restarted for a few days and that still works but I know if I restart it, that it will fail.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest