Python Plugin: TUYA

Python and python framework

Moderator: leecollings

manjh
Posts: 748
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 know this has been discussed earlier, and we all agreed to just leave it as it is. But the situation keeps coming back....

Whenever Domoticz is restarted, there is a good chance that the Tuya plugin returns in a state where the devices cannot be controlled. All lamps come in with status "timed out = true".
The only way to set this right, is to go into the hardware tab, switch the Tuya plugin to "disabled", and wait a little. Then switch back to "enabled" and al is well again.

I know this is not a lot of work, but sometimes Domoticz is restarted without me realizing I have to make the correction. I'll find out the hard way when the Tuya lamps are not switched off late at night...

So I'll ask again: any chance of a fix for this?
Hans
User avatar
Xenomes
Posts: 416
Joined: Tuesday 27 November 2018 19:05
Target OS: Linux
Domoticz version: 2025.1
Location: Netherlands
Contact:

Re: Python Plugin: TUYA

Post by Xenomes »

manjh wrote: Tuesday 12 October 2021 15:30 So I'll ask again: any chance of a fix for this?
I don't know how to simulate your problem. I have disabled a part in the script that put the light off-line.

go to the plug-in folder

Code: Select all

git pull
git checkout manjh
sudo systemctl restart domoticz.service
please report back what is happening.
HP T630 (256GB SSD/8GB Mem) - Ubuntu 24.04.2 LTS (64Bit) - Domoticz 2025.1 (Docker) Machinon theme - RFLink - KaKu - Sonoff - Tasmota - Shelly - MQTT2Zigbee - OpenTherm Gateway - Tinytuya - IR Blaster - P1 Smart Meter - NPN Watermeter - Google Assistant
manjh
Posts: 748
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 »

Xenomes wrote: Tuesday 12 October 2021 20:55
manjh wrote: Tuesday 12 October 2021 15:30 So I'll ask again: any chance of a fix for this?
I don't know how to simulate your problem. I have disabled a part in the script that put the light off-line.

go to the plug-in folder

Code: Select all

git pull
git checkout manjh
sudo systemctl restart domoticz.service
please report back what is happening.
Did as you asked. It restarts, I see the following:

Code: Select all

2021-10-13 08:30:44.170 (Tuya_devices) TUYA plugin started
2021-10-13 08:30:44.187 (Tuya_devices) Update 0:'Off' (Lamp schuifpui) TimedOut=True
2021-10-13 08:30:44.210 (Tuya_devices) Update 0:'Off' (Lamp raam 2) TimedOut=True
2021-10-13 08:30:44.225 (Tuya_devices) Update 0:'Off' (Lamp glazenkast onder) TimedOut=True
2021-10-13 08:30:44.235 (Tuya_devices) Update 0:'Off' (Lamp deur 1) TimedOut=True
2021-10-13 08:30:44.245 (Tuya_devices) Update 0:'Off' (Lamp raam 1) TimedOut=True
2021-10-13 08:30:44.266 (Tuya_devices) Update 0:'Off' (Lamp deur 2) TimedOut=True
2021-10-13 08:30:44.287 (Tuya_devices) Update 0:'Off' (Lamp glazenkast boven) TimedOut=True
2021-10-13 08:30:44.299 (Tuya_devices) Update 0:'Off' (Lamp secretaire onder) TimedOut=True
2021-10-13 08:30:44.311 (Tuya_devices) Update 0:'Off' (Lamp secretaire boven) TimedOut=True
2021-10-13 08:30:45.967 (Tuya_devices) Update 0:'Off' (Lamp schuifpui) TimedOut=False
2021-10-13 08:30:45.979 (Tuya_devices) Update 0:'Off' (Lamp raam 2) TimedOut=False
2021-10-13 08:30:45.986 (Tuya_devices) Update 0:'Off' (Lamp glazenkast onder) TimedOut=False
2021-10-13 08:30:45.992 (Tuya_devices) Update 0:'Off' (Lamp deur 1) TimedOut=False
2021-10-13 08:30:45.999 (Tuya_devices) Update 0:'Off' (Lamp raam 1) TimedOut=False
2021-10-13 08:30:46.012 (Tuya_devices) Update 0:'Off' (Lamp deur 2) TimedOut=False
2021-10-13 08:30:46.025 (Tuya_devices) Update 0:'Off' (Lamp glazenkast boven) TimedOut=False
2021-10-13 08:30:46.033 (Tuya_devices) Update 0:'Off' (Lamp secretaire onder) TimedOut=False
2021-10-13 08:30:46.040 (Tuya_devices) Update 0:'Off' (Lamp secretaire boven) TimedOut=False
But also:

Code: Select all

2021-10-13 08:30:48.671 Error: Bluetooth beacon hardware (20) thread seems to have ended unexpectedly
2021-10-13 08:30:48.671 Error: Xiaomi flowermate hardware (21) thread seems to have ended unexpectedly
2021-10-13 08:30:48.671 Error: Tuya_devices hardware (22) thread seems to have ended unexpectedly
Tried to switch a light, and this works:

Code: Select all

2021-10-13 08:31:36.990 (Tuya_devices) Update 1:'93' (Lamp glazenkast boven) TimedOut=0
2021-10-13 08:31:36.737 Status: User: Admin initiated a switch command (4253/Lamp glazenkast boven/Set Level)
2021-10-13 08:31:39.245 (Tuya_devices) Sending command for DeviceID=bfcb108044ffd382863sht
2021-10-13 08:31:39.338 (Tuya_devices) Update 1:'4' (Lamp glazenkast boven) TimedOut=0
2021-10-13 08:31:39.236 Status: User: Admin initiated a switch command (4253/Lamp glazenkast boven/Set Level)
2021-10-13 08:31:43.096 (Tuya_devices) Sending command for DeviceID=bfcb108044ffd382863sht
2021-10-13 08:31:43.204 (Tuya_devices) Update 0:'Off' (Lamp glazenkast boven) TimedOut=False
2021-10-13 08:31:43.087 Status: User: Admin initiated a switch command (4253/Lamp glazenkast boven/Set Level)
2021-10-13 08:31:46.160 (Tuya_devices) Sending command for DeviceID=6276453110521cc9adb2
2021-10-13 08:31:46.391 (Tuya_devices) Update 1:'100' (Lamp secretaire onder) TimedOut=0
2021-10-13 08:31:46.118 Status: User: Admin initiated a switch command (4254/Lamp secretaire onder/Set Level)
2021-10-13 08:31:50.800 (Tuya_devices) Sending command for DeviceID=6276453110521cc9adb2
2021-10-13 08:31:50.798 Status: setcolbrightnessvalue: ID: 109e, bri: 100, color: '{m: 2, RGB: 000000, CWWW: ff00, CT: 0}'
Looks like it works ok. Will do some more checking today.
Hans
manjh
Posts: 748
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 »

Xenomes wrote: Tuesday 12 October 2021 20:55
manjh wrote: Tuesday 12 October 2021 15:30 So I'll ask again: any chance of a fix for this?
I don't know how to simulate your problem. I have disabled a part in the script that put the light off-line.

go to the plug-in folder

Code: Select all

git pull
git checkout manjh
sudo systemctl restart domoticz.service
please report back what is happening.
I rebooted the PI, this is what's in the log:

Code: Select all

2021-10-13 08:36:28.091 Status: (Tuya_devices) Started.
2021-10-13 08:36:29.348 Status: (Tuya_devices) Initialized version 1.0.13, author 'Wagner Oliveira contributed Xenomes'
2021-10-13 08:36:29.373 Status: (Tuya_devices) Entering work loop.
2021-10-13 08:36:32.466 (Tuya_devices) Waiting 60 seconds to connect TuyaApi login timeout
2021-10-13 08:37:37.435 Error: Tuya_devices hardware (22) thread seems to have ended unexpectedly
2021-10-13 08:37:46.554 (Tuya_devices) TUYA plugin started
2021-10-13 08:37:46.562 (Tuya_devices) Update 0:'Off' (Lamp schuifpui) TimedOut=True
2021-10-13 08:37:46.575 (Tuya_devices) Update 0:'Off' (Lamp raam 2) TimedOut=True
2021-10-13 08:37:46.582 (Tuya_devices) Update 0:'Off' (Lamp glazenkast onder) TimedOut=True
2021-10-13 08:37:46.589 (Tuya_devices) Update 0:'Off' (Lamp deur 1) TimedOut=True
2021-10-13 08:37:46.595 (Tuya_devices) Update 0:'Off' (Lamp raam 1) TimedOut=True
2021-10-13 08:37:46.608 (Tuya_devices) Update 0:'Off' (Lamp deur 2) TimedOut=True
2021-10-13 08:37:46.621 (Tuya_devices) Update 0:'Off' (Lamp glazenkast boven) TimedOut=True
2021-10-13 08:37:46.634 (Tuya_devices) Update 0:'Off' (Lamp secretaire onder) TimedOut=True
2021-10-13 08:37:46.640 (Tuya_devices) Update 0:'Off' (Lamp secretaire boven) TimedOut=True
2021-10-13 08:37:48.260 (Tuya_devices) Update 0:'Off' (Lamp schuifpui) TimedOut=False
2021-10-13 08:37:48.268 (Tuya_devices) Update 0:'Off' (Lamp raam 2) TimedOut=False
2021-10-13 08:37:48.275 (Tuya_devices) Update 0:'Off' (Lamp glazenkast onder) TimedOut=False
2021-10-13 08:37:48.282 (Tuya_devices) Update 0:'Off' (Lamp deur 1) TimedOut=False
2021-10-13 08:37:48.288 (Tuya_devices) Update 0:'Off' (Lamp raam 1) TimedOut=False
2021-10-13 08:37:48.301 (Tuya_devices) Update 0:'Off' (Lamp deur 2) TimedOut=False
2021-10-13 08:37:48.314 (Tuya_devices) Update 0:'Off' (Lamp glazenkast boven) TimedOut=False
2021-10-13 08:37:48.327 (Tuya_devices) Update 1:'On' (Lamp secretaire onder) TimedOut=False
2021-10-13 08:37:48.333 (Tuya_devices) Update 0:'Off' (Lamp secretaire boven) TimedOut=False
2021-10-13 08:37:51.438 Error: Tuya_devices hardware (22) thread seems to have ended unexpectedly
Besides the lines about threads ending unexpectedly, the lamps still work!
Hans
User avatar
Xenomes
Posts: 416
Joined: Tuesday 27 November 2018 19:05
Target OS: Linux
Domoticz version: 2025.1
Location: Netherlands
Contact:

Re: Python Plugin: TUYA

Post by Xenomes »

manjh wrote: Wednesday 13 October 2021 8:39

Code: Select all

2021-10-13 08:37:37.435 Error: Tuya_devices hardware (22) thread seems to have ended unexpectedly
2021-10-13 08:37:51.438 Error: Tuya_devices hardware (22) thread seems to have ended unexpectedly
These lines I never see, it looks like the number of devices is causing the plug-in to crash.
manjh wrote: Tuesday 12 October 2021 15:30

Code: Select all

2021-10-13 08:30:48.671 Error: Bluetooth beacon hardware (20) thread seems to have ended unexpectedly
2021-10-13 08:30:48.671 Error: Xiaomi flowermate hardware (21) thread seems to have ended unexpectedly
These line has nothing to do with the Tuya plug-in.
manjh wrote: Wednesday 13 October 2021 8:35

Code: Select all

2021-10-13 08:30:44.187 (Tuya_devices) Update 0:'Off' (Lamp schuifpui) TimedOut=True
Timeout at start-up is disabled in the manjh test version can you pull the version and test?

Can you give me the python version, current version of Domoticz and the total number of Tuya devices? I am now running a test with 16 devices.
HP T630 (256GB SSD/8GB Mem) - Ubuntu 24.04.2 LTS (64Bit) - Domoticz 2025.1 (Docker) Machinon theme - RFLink - KaKu - Sonoff - Tasmota - Shelly - MQTT2Zigbee - OpenTherm Gateway - Tinytuya - IR Blaster - P1 Smart Meter - NPN Watermeter - Google Assistant
manjh
Posts: 748
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 »

Xenomes wrote: Wednesday 13 October 2021 19:10
manjh wrote: Wednesday 13 October 2021 8:39

Code: Select all

2021-10-13 08:37:37.435 Error: Tuya_devices hardware (22) thread seems to have ended unexpectedly
2021-10-13 08:37:51.438 Error: Tuya_devices hardware (22) thread seems to have ended unexpectedly
These lines I never see, it looks like the number of devices is causing the plug-in to crash.
manjh wrote: Tuesday 12 October 2021 15:30

Code: Select all

2021-10-13 08:30:48.671 Error: Bluetooth beacon hardware (20) thread seems to have ended unexpectedly
2021-10-13 08:30:48.671 Error: Xiaomi flowermate hardware (21) thread seems to have ended unexpectedly
These line has nothing to do with the Tuya plug-in.
manjh wrote: Wednesday 13 October 2021 8:35

Code: Select all

2021-10-13 08:30:44.187 (Tuya_devices) Update 0:'Off' (Lamp schuifpui) TimedOut=True
Timeout at start-up is disabled in the manjh test version can you pull the version and test?

Can you give me the python version, current version of Domoticz and the total number of Tuya devices? I am now running a test with 16 devices.
I don't know where the suddenly ending threads come from, just thought I'd mention it.
Downloaded the manjh test version, am running with that now. Everything runs OK, as far as I can see.
Python version is 3.7.3, Domoticz 2020.2. Mu,ber of Tuya devices: 9 (all are lamps).
Hans
manjh
Posts: 748
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 »

Just restarted Domoticz, just to try.
Noticed a msg from the plugin: wait for 60 before login.
After that period, this is what I see:

Code: Select all

2021-10-15 11:11:54.431 (Tuya_devices) Update 0:'Off' (Lamp schuifpui) TimedOut=False
2021-10-15 11:11:54.438 (Tuya_devices) Update 0:'Off' (Lamp raam 2) TimedOut=False
2021-10-15 11:11:54.445 (Tuya_devices) Update 0:'Off' (Lamp glazenkast onder) TimedOut=False
2021-10-15 11:11:54.454 (Tuya_devices) Update 0:'Off' (Lamp deur 1) TimedOut=False
2021-10-15 11:11:54.462 (Tuya_devices) Update 0:'Off' (Lamp raam 1) TimedOut=False
2021-10-15 11:11:54.470 (Tuya_devices) Update 0:'Off' (Lamp deur 2) TimedOut=False
2021-10-15 11:11:54.478 (Tuya_devices) Update 0:'Off' (Lamp glazenkast boven) TimedOut=False
2021-10-15 11:11:54.492 (Tuya_devices) Update 0:'Off' (Lamp secretaire onder) TimedOut=False
2021-10-15 11:11:54.500 (Tuya_devices) Update 0:'Off' (Lamp secretaire boven) TimedOut=False
2021-10-15 11:11:56.954 Error: Bluetooth beacon hardware (20) thread seems to have ended unexpectedly
2021-10-15 11:11:56.954 Error: Xiaomi flowermate hardware (21) thread seems to have ended unexpectedly
2021-10-15 11:11:56.954 Error: Tuya_devices hardware (22) thread seems to have ended unexpectedly
I understand it does not look ike the Bluetooth and Xiaomi errors are related to the Tuya plugin, but it is weird that this always happens when the plugin starts...

ALso tried to disable the plugin in HW, and then after a little whille enabled it again. This happens:

Code: Select all

2021-10-15 11:15:09.702 (Tuya_devices) Waiting 60 seconds to connect TuyaApi login timeout
2021-10-15 11:15:09.314 Status: (Tuya_devices) Started.
2021-10-15 11:15:09.698 Status: (Tuya_devices) Entering work loop.
2021-10-15 11:15:09.698 Status: (Tuya_devices) Initialized version 1.0.13, author 'Wagner Oliveira contributed Xenomes'
2021-10-15 11:15:15.823 MQTT: Topic: domoticz/in, Message: {"command":"udevice","idx":3787,"nvalue":0,"svalue":"11.8;88;3"}
2021-10-15 11:15:24.432 (RFLink De Meern) Temp + Humidity (Utrecht temp&hum buiten)
2021-10-15 11:15:29.857 MQTT: Topic: domoticz/in, Message: {"command":"udevice","idx":3786,"nvalue":0,"svalue":"15.4;70;3"}
2021-10-15 11:15:46.091 MQTT: Topic: domoticz/in, Message: {"command":"udevice","idx":3713,"nvalue":0,"svalue":"1145839;1106563;0;0;121;0"}
2021-10-15 11:15:46.196 MQTT: Topic: domoticz/in, Message: {"command":"udevice","idx":3712,"nvalue":0,"svalue":"679300"}
2021-10-15 11:15:50.819 MQTT: Topic: domoticz/in, Message: {"command":"udevice","idx":3787,"nvalue":0,"svalue":"11.8;88;3"}
2021-10-15 11:15:53.665 (Utrecht P1) P1 Smart Meter (Utrecht Power)
2021-10-15 11:15:53.693 (Utrecht P1) P1 Smart Meter (Utrecht Gas)
2021-10-15 11:15:59.431 (RFLink De Meern) Temp + Humidity (Utrecht temp&hum buiten)
2021-10-15 11:16:03.133 MQTT: Topic: domoticz/in, Message: {"command":"udevice","idx":3842,"nvalue":0,"svalue":"38.4"}
2021-10-15 11:16:04.857 MQTT: Topic: domoticz/in, Message: {"command":"udevice","idx":3786,"nvalue":0,"svalue":"15.5;70;3"}
2021-10-15 11:16:09.762 (Tuya_devices) TUYA plugin started
2021-10-15 11:16:09.776 (Tuya_devices) Update 0:'Off' (Lamp schuifpui) TimedOut=True
2021-10-15 11:16:09.793 (Tuya_devices) Update 0:'Off' (Lamp raam 2) TimedOut=True
2021-10-15 11:16:09.806 (Tuya_devices) Update 0:'Off' (Lamp glazenkast onder) TimedOut=True
2021-10-15 11:16:09.819 (Tuya_devices) Update 0:'Off' (Lamp deur 1) TimedOut=True
2021-10-15 11:16:09.832 (Tuya_devices) Update 0:'Off' (Lamp raam 1) TimedOut=True
2021-10-15 11:16:09.861 (Tuya_devices) Update 0:'Off' (Lamp deur 2) TimedOut=True
2021-10-15 11:16:09.884 (Tuya_devices) Update 0:'Off' (Lamp glazenkast boven) TimedOut=True
2021-10-15 11:16:09.892 (Tuya_devices) Update 0:'Off' (Lamp secretaire onder) TimedOut=True
2021-10-15 11:16:09.899 (Tuya_devices) Update 0:'Off' (Lamp secretaire boven) TimedOut=True
2021-10-15 11:16:09.236 Error: Bluetooth beacon hardware (20) thread seems to have ended unexpectedly
2021-10-15 11:16:09.236 Error: Xiaomi flowermate hardware (21) thread seems to have ended unexpectedly
2021-10-15 11:16:12.080 (Tuya_devices) Update 0:'Off' (Lamp schuifpui) TimedOut=False
2021-10-15 11:16:12.098 (Tuya_devices) Update 0:'Off' (Lamp raam 2) TimedOut=False
2021-10-15 11:16:12.109 (Tuya_devices) Update 0:'Off' (Lamp glazenkast onder) TimedOut=False
2021-10-15 11:16:12.120 (Tuya_devices) Update 0:'Off' (Lamp deur 1) TimedOut=False
2021-10-15 11:16:12.131 (Tuya_devices) Update 0:'Off' (Lamp raam 1) TimedOut=False
2021-10-15 11:16:12.154 (Tuya_devices) Update 0:'Off' (Lamp deur 2) TimedOut=False
2021-10-15 11:16:12.168 (Tuya_devices) Update 0:'Off' (Lamp glazenkast boven) TimedOut=False
2021-10-15 11:16:12.192 (Tuya_devices) Update 0:'Off' (Lamp secretaire onder) TimedOut=False
2021-10-15 11:16:12.202 (Tuya_devices) Update 0:'Off' (Lamp secretaire boven) TimedOut=False
Ignore the unrelated lines, this is a full cut from the Domoticz log.
Again, the Bluetooth and Xiaomi aborts are there.

The good news, of course, is the fact that after a Domoticz restart, or a Tuya plugin restart, the lamps are fully operational and can be switched!
Hans
User avatar
Xenomes
Posts: 416
Joined: Tuesday 27 November 2018 19:05
Target OS: Linux
Domoticz version: 2025.1
Location: Netherlands
Contact:

Re: Python Plugin: TUYA

Post by Xenomes »

manjh wrote: Friday 15 October 2021 11:09 I don't know where the suddenly ending threads come from, just thought I'd mention it.
Downloaded the manjh test version, am running with that now. Everything runs OK, as far as I can see.
Python version is 3.7.3, Domoticz 2020.2. Mu,ber of Tuya devices: 9 (all are lamps).
OK, versions are the same as my test set-up.
manjh wrote: Friday 15 October 2021 11:18 Just restarted Domoticz, just to try.
Noticed a msg from the plugin: wait for 60 before login.
After that period, this is what I see:

Code: Select all

2021-10-15 11:11:54.431 (Tuya_devices) Update 0:'Off' (Lamp schuifpui) TimedOut=False
2021-10-15 11:11:54.438 (Tuya_devices) Update 0:'Off' (Lamp raam 2) TimedOut=False
2021-10-15 11:11:54.445 (Tuya_devices) Update 0:'Off' (Lamp glazenkast onder) TimedOut=False
2021-10-15 11:11:54.454 (Tuya_devices) Update 0:'Off' (Lamp deur 1) TimedOut=False
2021-10-15 11:11:54.462 (Tuya_devices) Update 0:'Off' (Lamp raam 1) TimedOut=False
2021-10-15 11:11:54.470 (Tuya_devices) Update 0:'Off' (Lamp deur 2) TimedOut=False
2021-10-15 11:11:54.478 (Tuya_devices) Update 0:'Off' (Lamp glazenkast boven) TimedOut=False
2021-10-15 11:11:54.492 (Tuya_devices) Update 0:'Off' (Lamp secretaire onder) TimedOut=False
2021-10-15 11:11:54.500 (Tuya_devices) Update 0:'Off' (Lamp secretaire boven) TimedOut=False
2021-10-15 11:11:56.954 Error: Bluetooth beacon hardware (20) thread seems to have ended unexpectedly
2021-10-15 11:11:56.954 Error: Xiaomi flowermate hardware (21) thread seems to have ended unexpectedly
2021-10-15 11:11:56.954 Error: Tuya_devices hardware (22) thread seems to have ended unexpectedly
I understand it does not look ike the Bluetooth and Xiaomi errors are related to the Tuya plugin, but it is weird that this always happens when the plugin starts...
Maybe it uses a common python library, i don't have devices for the plug-ins to test.
manjh wrote: Friday 15 October 2021 11:18 ALso tried to disable the plugin in HW, and then after a little whille enabled it again. This happens:

Code: Select all

2021-10-15 11:15:09.702 (Tuya_devices) Waiting 60 seconds to connect TuyaApi login timeout
2021-10-15 11:15:09.314 Status: (Tuya_devices) Started.
2021-10-15 11:15:09.698 Status: (Tuya_devices) Entering work loop.
2021-10-15 11:15:09.698 Status: (Tuya_devices) Initialized version 1.0.13, author 'Wagner Oliveira contributed Xenomes'
2021-10-15 11:15:15.823 MQTT: Topic: domoticz/in, Message: {"command":"udevice","idx":3787,"nvalue":0,"svalue":"11.8;88;3"}
2021-10-15 11:15:24.432 (RFLink De Meern) Temp + Humidity (Utrecht temp&hum buiten)
2021-10-15 11:15:29.857 MQTT: Topic: domoticz/in, Message: {"command":"udevice","idx":3786,"nvalue":0,"svalue":"15.4;70;3"}
2021-10-15 11:15:46.091 MQTT: Topic: domoticz/in, Message: {"command":"udevice","idx":3713,"nvalue":0,"svalue":"1145839;1106563;0;0;121;0"}
2021-10-15 11:15:46.196 MQTT: Topic: domoticz/in, Message: {"command":"udevice","idx":3712,"nvalue":0,"svalue":"679300"}
2021-10-15 11:15:50.819 MQTT: Topic: domoticz/in, Message: {"command":"udevice","idx":3787,"nvalue":0,"svalue":"11.8;88;3"}
2021-10-15 11:15:53.665 (Utrecht P1) P1 Smart Meter (Utrecht Power)
2021-10-15 11:15:53.693 (Utrecht P1) P1 Smart Meter (Utrecht Gas)
2021-10-15 11:15:59.431 (RFLink De Meern) Temp + Humidity (Utrecht temp&hum buiten)
2021-10-15 11:16:03.133 MQTT: Topic: domoticz/in, Message: {"command":"udevice","idx":3842,"nvalue":0,"svalue":"38.4"}
2021-10-15 11:16:04.857 MQTT: Topic: domoticz/in, Message: {"command":"udevice","idx":3786,"nvalue":0,"svalue":"15.5;70;3"}
2021-10-15 11:16:09.762 (Tuya_devices) TUYA plugin started
2021-10-15 11:16:09.776 (Tuya_devices) Update 0:'Off' (Lamp schuifpui) TimedOut=True
2021-10-15 11:16:09.793 (Tuya_devices) Update 0:'Off' (Lamp raam 2) TimedOut=True
2021-10-15 11:16:09.806 (Tuya_devices) Update 0:'Off' (Lamp glazenkast onder) TimedOut=True
2021-10-15 11:16:09.819 (Tuya_devices) Update 0:'Off' (Lamp deur 1) TimedOut=True
2021-10-15 11:16:09.832 (Tuya_devices) Update 0:'Off' (Lamp raam 1) TimedOut=True
2021-10-15 11:16:09.861 (Tuya_devices) Update 0:'Off' (Lamp deur 2) TimedOut=True
2021-10-15 11:16:09.884 (Tuya_devices) Update 0:'Off' (Lamp glazenkast boven) TimedOut=True
2021-10-15 11:16:09.892 (Tuya_devices) Update 0:'Off' (Lamp secretaire onder) TimedOut=True
2021-10-15 11:16:09.899 (Tuya_devices) Update 0:'Off' (Lamp secretaire boven) TimedOut=True
2021-10-15 11:16:09.236 Error: Bluetooth beacon hardware (20) thread seems to have ended unexpectedly
2021-10-15 11:16:09.236 Error: Xiaomi flowermate hardware (21) thread seems to have ended unexpectedly
2021-10-15 11:16:12.080 (Tuya_devices) Update 0:'Off' (Lamp schuifpui) TimedOut=False
2021-10-15 11:16:12.098 (Tuya_devices) Update 0:'Off' (Lamp raam 2) TimedOut=False
2021-10-15 11:16:12.109 (Tuya_devices) Update 0:'Off' (Lamp glazenkast onder) TimedOut=False
2021-10-15 11:16:12.120 (Tuya_devices) Update 0:'Off' (Lamp deur 1) TimedOut=False
2021-10-15 11:16:12.131 (Tuya_devices) Update 0:'Off' (Lamp raam 1) TimedOut=False
2021-10-15 11:16:12.154 (Tuya_devices) Update 0:'Off' (Lamp deur 2) TimedOut=False
2021-10-15 11:16:12.168 (Tuya_devices) Update 0:'Off' (Lamp glazenkast boven) TimedOut=False
2021-10-15 11:16:12.192 (Tuya_devices) Update 0:'Off' (Lamp secretaire onder) TimedOut=False
2021-10-15 11:16:12.202 (Tuya_devices) Update 0:'Off' (Lamp secretaire boven) TimedOut=False
Ignore the unrelated lines, this is a full cut from the Domoticz log.
Again, the Bluetooth and Xiaomi aborts are there.
Do you have at the plug-in the 'Data Timeout' Disabled?
manjh wrote: Friday 15 October 2021 11:18 The good news, of course, is the fact that after a Domoticz restart, or a Tuya plugin restart, the lamps are fully operational and can be switched!
Yep that is 🤣
HP T630 (256GB SSD/8GB Mem) - Ubuntu 24.04.2 LTS (64Bit) - Domoticz 2025.1 (Docker) Machinon theme - RFLink - KaKu - Sonoff - Tasmota - Shelly - MQTT2Zigbee - OpenTherm Gateway - Tinytuya - IR Blaster - P1 Smart Meter - NPN Watermeter - Google Assistant
manjh
Posts: 748
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 »

Xenomes wrote: Friday 15 October 2021 18:59 Do you have at the plug-in the 'Data Timeout' Disabled?
Yes.
Hans
User avatar
Xenomes
Posts: 416
Joined: Tuesday 27 November 2018 19:05
Target OS: Linux
Domoticz version: 2025.1
Location: Netherlands
Contact:

Re: Python Plugin: TUYA

Post by Xenomes »

manjh wrote: Monday 18 October 2021 16:41 Yes.
OK perfect, I merge the test version with the live version. can you run that version for a wile and report back you findings .
HP T630 (256GB SSD/8GB Mem) - Ubuntu 24.04.2 LTS (64Bit) - Domoticz 2025.1 (Docker) Machinon theme - RFLink - KaKu - Sonoff - Tasmota - Shelly - MQTT2Zigbee - OpenTherm Gateway - Tinytuya - IR Blaster - P1 Smart Meter - NPN Watermeter - Google Assistant
manjh
Posts: 748
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 »

Xenomes wrote: Monday 18 October 2021 19:12
manjh wrote: Monday 18 October 2021 16:41 Yes.
OK perfect, I merge the test version with the live version. can you run that version for a wile and report back you findings .
I did as you requested, looking good. WIll keep an eye on it.
Hans
jono
Posts: 21
Joined: Saturday 09 July 2016 8:27
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: U.K.-England
Contact:

Re: Python Plugin: TUYA

Post by jono »

Hi will this plug-in control my IR blaster connected to my smart life app ?
User avatar
Xenomes
Posts: 416
Joined: Tuesday 27 November 2018 19:05
Target OS: Linux
Domoticz version: 2025.1
Location: Netherlands
Contact:

Re: Python Plugin: TUYA

Post by Xenomes »

jono wrote: Monday 25 October 2021 13:27 Hi will this plug-in control my IR blaster connected to my smart life app ?
Nope, only lights and switches and some other devices on/off.
HP T630 (256GB SSD/8GB Mem) - Ubuntu 24.04.2 LTS (64Bit) - Domoticz 2025.1 (Docker) Machinon theme - RFLink - KaKu - Sonoff - Tasmota - Shelly - MQTT2Zigbee - OpenTherm Gateway - Tinytuya - IR Blaster - P1 Smart Meter - NPN Watermeter - Google Assistant
JimmyH1969
Posts: 153
Joined: Tuesday 28 June 2016 16:38
Target OS: Windows
Domoticz version: Beta
Location: Amersfoort NL
Contact:

Re: Python Plugin: TUYA

Post by JimmyH1969 »

Hi There,

I have a couple of lichts added to the TUYA app on my phone and i can control them perfectly. On/Off, change brightness, Color etc..
They are also added in Domoticz, but as a type: colorswitch and a subtype: WW

So in domoticz it's only possible to switch them on/off, change brightness and warm/cold white settings, but not to change the color. Is it possible to change the subtype to RGBWW so the color can also be changed? Or is there a way to add them again with the correct subtype?

Tnx..
User avatar
Xenomes
Posts: 416
Joined: Tuesday 27 November 2018 19:05
Target OS: Linux
Domoticz version: 2025.1
Location: Netherlands
Contact:

Re: Python Plugin: TUYA

Post by Xenomes »

Hi JimmyH1969,

Great that everything is working! For colour detection see the Readme.md =>Key Features
Allows controlling Dimmer/RGB(WW) Colour for lights (⚠ RGBW(W) lights must be on a colour for correct detection ⚠)

I hope it will answer your question 😁

Xenomes
HP T630 (256GB SSD/8GB Mem) - Ubuntu 24.04.2 LTS (64Bit) - Domoticz 2025.1 (Docker) Machinon theme - RFLink - KaKu - Sonoff - Tasmota - Shelly - MQTT2Zigbee - OpenTherm Gateway - Tinytuya - IR Blaster - P1 Smart Meter - NPN Watermeter - Google Assistant
sciurius
Posts: 55
Joined: Monday 26 July 2021 16:39
Target OS: Raspberry Pi / ODroid
Domoticz version: 2021.1
Location: NL
Contact:

Re: Python Plugin: TUYA

Post by sciurius »

And if not correctly detected can this be changed afterwards?

It seems that the MQTT discovery pluging also detects WW and not colour.
User avatar
Xenomes
Posts: 416
Joined: Tuesday 27 November 2018 19:05
Target OS: Linux
Domoticz version: 2025.1
Location: Netherlands
Contact:

Re: Python Plugin: TUYA

Post by Xenomes »

sciurius wrote: Saturday 27 November 2021 17:10 And if not correctly detected can this be changed afterwards?
Delete the device in Domoticz, the device will be detected again.
HP T630 (256GB SSD/8GB Mem) - Ubuntu 24.04.2 LTS (64Bit) - Domoticz 2025.1 (Docker) Machinon theme - RFLink - KaKu - Sonoff - Tasmota - Shelly - MQTT2Zigbee - OpenTherm Gateway - Tinytuya - IR Blaster - P1 Smart Meter - NPN Watermeter - Google Assistant
sciurius
Posts: 55
Joined: Monday 26 July 2021 16:39
Target OS: Raspberry Pi / ODroid
Domoticz version: 2021.1
Location: NL
Contact:

Re: Python Plugin: TUYA

Post by sciurius »

Yes, but it will be detected again as Dimmer/WW. So apparently is it not possible to modify the type after detection.
User avatar
Xenomes
Posts: 416
Joined: Tuesday 27 November 2018 19:05
Target OS: Linux
Domoticz version: 2025.1
Location: Netherlands
Contact:

Re: Python Plugin: TUYA

Post by Xenomes »

U need to set a colour to the light then it will be detect as a rgbww.
HP T630 (256GB SSD/8GB Mem) - Ubuntu 24.04.2 LTS (64Bit) - Domoticz 2025.1 (Docker) Machinon theme - RFLink - KaKu - Sonoff - Tasmota - Shelly - MQTT2Zigbee - OpenTherm Gateway - Tinytuya - IR Blaster - P1 Smart Meter - NPN Watermeter - Google Assistant
JdoTMM
Posts: 3
Joined: Thursday 24 August 2017 0:08
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: TUYA

Post by JdoTMM »

Hi,

[EDIT]
Found the problem: Tuya sometimes loses connections with api. needed to unplug and replug and all is working fine :roll: Hope Tuya comes up with a fix soon.
[/EDIT]


Been using the plug-in for a couple of weeks now. The last few days I can't switch detected lights anymore.

Uninstalled then plug-in, removed the hardware and devices and deleted the folder. Reinstalled the plugin. Domoticz / Tuya plugin adds my devices without any problem:
tuya problem domoticz.png
tuya problem domoticz.png (23.7 KiB) Viewed 2655 times
But still it will not let me control the switch. The Tuya app controls it without any problem so I know the device is working.

I did install the latest beta some day's ago 2021.1 (build 13949): could this be the source of my problems?

Regards,

John.
-----
1 Aeotec ZW090, 2 FIB FGDW002, 1 FIB FGMS001, 3 FIB FGSD002,
4 Neo CoolCam Power plug, 1 Popp 004407, 1 FIB FGS222
1 NodOn CRC-3-1-00, DeConz, Milight, Tuya
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest