Page 8 of 12
Re: Python Plugin: Domoticz-TinyTUYA-Plugin (Cloud)
Posted: Sunday 03 December 2023 21:51
by Xenomes
jpvaneijk wrote: ↑Saturday 02 December 2023 15:52
Hi Xenomes,
I'm on a RPi 5 running on Bookworm. Bullseye is no longer supported for this hardware. see:
https://www.raspberrypi.com/documentati ... spberry-pi
Due to changes in the way pip should be handled now, I seem to be running into a problem with getting Tuya working.
Code: Select all
2023-12-02 15:04:27.517 Error: Smart Life: (tuya) failed to load 'plugin.py', Python Path used was '/home/MYUSERNAME/domoticz/plugins/Domoticz-TUYA-Plugin/:/usr/lib/python311.zip:/usr/lib/python3.11:/usr/lib/python3.11/lib-dynload:/usr/local/lib/python3.11/dist-packages:/usr/lib/python3/dist-packages:/usr/lib/python3.11/dist-packages'.
2023-12-02 15:04:27.544 Error: Smart Life: Traceback (most recent call last):
2023-12-02 15:04:27.544 Error: Smart Life: File "/home/MYUSERNAME/domoticz/plugins/Domoticz-TUYA-Plugin/plugin.py", line 65, in <module>
2023-12-02 15:04:27.544 Error: Smart Life: import tuyaha
2023-12-02 15:04:27.544 Error: Smart Life: ModuleNotFoundError: No module named 'tuyaha'
In accordance with the descriptions in the link above, I have created a virtual environment in which pip installations like this can be processed. In doing so, I no longer get the annoying error message that prevents you from continuing the installation process.
It seems to me that from the Plugins folder in Domoticz, in the Plugin.py file is being searched for components that can no longer be found in the default location.
Can you help me get this sorted out?
I see the tuyaha module this question chould be in:
viewtopic.php?p=303250
Re: Python Plugin: Domoticz-TinyTUYA-Plugin (Cloud)
Posted: Friday 05 January 2024 13:58
by willemd
I have read through the Tuya plugin thread and this TinyTuya plugin thread.
Just to confirm, for a power plug with energy measurements (LSC Smart Connect from Action), I understand the TinyTuya is the way to go?
Update: in the meantime I have done the setup:
1) first paired the device in the tuya smart app
2) then followed the pdf guide for the IoT developer account setup and connecting the app
Only issue encountered was that I chose western europe datacenter instead of central europe (for Netherlands) so I had to go back and correct
3) then did the installation on the Raspberry
4) then choose the hardware in Domoticz and entered the identifiers
all as per instructions.
Result? Perfect, one switch and four utility device created, values correctly shown. All perfect in one go. Thanks.
Re: Python Plugin: Domoticz-TinyTUYA-Plugin (Cloud)
Posted: Saturday 06 January 2024 15:34
by nl2rma
First of all: Thank you Xenomes for this plugin, it works great.
Question: I use it to have a Weau Heatpump in Domoticz and it works.
The plugin created 4 devices Power, Setpoint, Mode and Temperature.
In the Tuya App, and also in the Tuya Iot webpage where I had to link the Heatpump there is an other entity available that seem to be named "Fault".
It displays numbered fault codes (example 4=no flow(E03), 8=Antifreeze protection(E04))
Is there a way to also get the "fault" entity visible as a device/entity in Domoticz?
tnx Royco
Re: Python Plugin: Domoticz-TinyTUYA-Plugin (Cloud)
Posted: Saturday 06 January 2024 15:42
by Xenomes
It could be possible, but I need to see the JSON code. You can create an issue on GitHub and post the 'dump.json' from the 'debug_discovery.py'.
Re: Python Plugin: Domoticz-TinyTUYA-Plugin (Cloud)
Posted: Thursday 18 January 2024 21:13
by EdwinK
Varazir wrote: ↑Thursday 04 May 2023 15:53
Hi I keep getting this
Code: Select all
2023-05-04 15:29:18.605 TinyTUYA: Update devices in Domoticz
2023-05-04 15:29:18.608 Error: TinyTUYA: Device read failed: bfd6bda7f3a84e2064d97h
Keep seeing this error now. The domoticz log doesn't show anything else.
Re: Python Plugin: Domoticz-TinyTUYA-Plugin (Cloud)
Posted: Thursday 18 January 2024 21:52
by Varazir
EdwinK wrote: ↑Thursday 18 January 2024 21:13
Varazir wrote: ↑Thursday 04 May 2023 15:53
Hi I keep getting this
Code: Select all
2023-05-04 15:29:18.605 TinyTUYA: Update devices in Domoticz
2023-05-04 15:29:18.608 Error: TinyTUYA: Device read failed: bfd6bda7f3a84e2064d97h
Keep seeing this error now. The domoticz log doesn't show anything else.
You checked that the free period for IOT on TUYA hasn't expired ?
//Daniel
Re: Python Plugin: Domoticz-TinyTUYA-Plugin (Cloud)
Posted: Thursday 18 January 2024 22:09
by Xenomes
EdwinK wrote: ↑Thursday 18 January 2024 21:13
Keep seeing this error now. The domoticz log doesn't show anything else.
If the 'free period' hasn't expired yet, kindly enable debugging in the hardware tab. You will find a line number indicating the location of the error. Additionally, please provide the version number of the plugin for accurate identification of the correct line. For further assistance, it would be helpful to receive the dump.json file from the debug_discovery.py via private message, allowing me to conduct additional tests.
Re: Python Plugin: Domoticz-TinyTUYA-Plugin (Cloud)
Posted: Thursday 18 January 2024 22:38
by EdwinK
When running the debug_discovery.py script both devices return an empty dump.json. Don't know if the free period has expired. Created connection on
Creation Time : 2023-03-08 16:31:24
Plugin is at version 1.7.0
This is what I could grab from the log.
Code: Select all
2024-01-18 23:13:33.045 TinyTuya: Pushing 'onHeartbeatCallback' on to queue
2024-01-18 23:13:33.095 TinyTuya: Processing 'onHeartbeatCallback' message
2024-01-18 23:13:33.095 TinyTuya: Acquiring GIL for 'onHeartbeatCallback'
2024-01-18 23:13:33.096 TinyTuya: Calling message handler 'onHeartbeat' on 'module' type object.
2024-01-18 23:13:33.096 TinyTuya: onHeartbeat called
2024-01-18 23:13:33.096 TinyTuya: onHeartbeat called last run: 60.210793018341064
2024-01-18 23:13:33.096 TinyTuya: [b]Device name=LSC Groundspots id=bfe1829726d568d498bywx category=light[/b]
2024-01-18 23:13:40.006 TinyTuya: Pushing 'onHeartbeatCallback' on to queue
2024-01-18 23:13:40.056 TinyTuya: Processing 'onHeartbeatCallback' message
2024-01-18 23:13:40.056 TinyTuya: Acquiring GIL for 'onHeartbeatCallback'
2024-01-18 23:13:40.056 TinyTuya: Calling message handler 'onHeartbeat' on 'module' type object.
2024-01-18 23:13:40.056 TinyTuya: onHeartbeat called
2024-01-18 23:13:40.056 TinyTuya: onHeartbeat called skipped
[color=#FF0000]2024-01-18 23:15:52.239 Error: TinyTuya: Device read failed: bf6b0558769ceecafdkfze[/color]
2024-01-18 23:16:02.060 TinyTuya: Pushing 'onHeartbeatCallback' on to queue
2024-01-18 23:16:02.110 TinyTuya: Processing 'onHeartbeatCallback' message
2024-01-18 23:16:02.110 TinyTuya: Acquiring GIL for 'onHeartbeatCallback'
2024-01-18 23:16:02.110 TinyTuya: Calling message handler 'onHeartbeat' on 'module' type object.
2024-01-18 23:16:02.110 TinyTuya: onHeartbeat called
2024-01-18 23:16:02.110 TinyTuya: onHeartbeat called skipped
2024-01-18 23:16:02.110 TinyTuya: Acquiring GIL for 'onHeartbeatCallback'
2024-01-18 23:16:02.745 TinyTuya: Update devices in Domoticz
2024-01-18 23:16:02.774 TinyTuya: Update device value: bfe1829726d568d498bywx Unit: 1 sValue: On nValue: 1 TimedOut=0
2024-01-18 23:16:02.775 TinyTuya: [b]Device name=gang boven id=bf6b0558769ceecafdkfze category=light[/b]
2024-01-18 23:16:12.025 TinyTuya: Pushing 'onHeartbeatCallback' on to queue
2024-01-18 23:16:12.076 TinyTuya: Processing 'onHeartbeatCallback' message
2024-01-18 23:16:12.076 TinyTuya: Acquiring GIL for 'onHeartbeatCallback'
2024-01-18 23:16:12.076 TinyTuya: Calling message handler 'onHeartbeat' on 'module' type object.
2024-01-18 23:16:12.076 TinyTuya: onHeartbeat called
2024-01-18 23:16:12.076 TinyTuya: onHeartbeat called skipped
2024-01-18 23:16:12.076 TinyTuya: Acquiring GIL for 'onHeartbeatCallback'
2024-01-18 23:16:14.163 TinyTuya: Acquiring GIL for 'onHeartbeatCallback'
2024-01-18 23:16:14.213 TinyTuya: Pushing 'onHeartbeatCallback' on to queue
2024-01-18 23:16:14.263 TinyTuya: Processing 'onHeartbeatCallback' message
2024-01-18 23:16:14.263 TinyTuya: Acquiring GIL for 'onHeartbeatCallback'
2024-01-18 23:16:14.264 TinyTuya: Calling message handler 'onHeartbeat' on 'module' type object.
2024-01-18 23:16:14.264 TinyTuya: onHeartbeat called
2024-01-18 23:16:14.264 TinyTuya: onHeartbeat called skipped
2024-01-18 23:16:14.264 TinyTuya: Acquiring GIL for 'onHeartbeatCallback'
2024-01-18 23:16:22.043 TinyTuya: Pushing 'onHeartbeatCallback' on to queue
2024-01-18 23:16:22.094 TinyTuya: Processing 'onHeartbeatCallback' message
2024-01-18 23:16:22.094 TinyTuya: Acquiring GIL for 'onHeartbeatCallback'
2024-01-18 23:16:22.094 TinyTuya: Calling message handler 'onHeartbeat' on 'module' type object.
2024-01-18 23:16:22.094 TinyTuya: onHeartbeat called
2024-01-18 23:16:22.094 TinyTuya: onHeartbeat called skipped
2024-01-18 23:16:22.094 TinyTuya: Acquiring GIL for 'onHeartbeatCallback'
2024-01-18 23:16:24.031 TinyTuya: Pushing 'onHeartbeatCallback' on to queue
2024-01-18 23:16:24.081 TinyTuya: Processing 'onHeartbeatCallback' message
2024-01-18 23:16:24.081 TinyTuya: Acquiring GIL for 'onHeartbeatCallback'
2024-01-18 23:16:24.081 TinyTuya: Calling message handler 'onHeartbeat' on 'module' type object.
2024-01-18 23:16:24.081 TinyTuya: onHeartbeat called
2024-01-18 23:16:24.081 TinyTuya: onHeartbeat called skipped
2024-01-18 23:16:24.081 TinyTuya: Acquiring GIL for 'onHeartbeatCallback'
2024-01-18 23:16:32.060 TinyTuya: Pushing 'onHeartbeatCallback' on to queue
2024-01-18 23:16:32.111 TinyTuya: Processing 'onHeartbeatCallback' message
2024-01-18 23:16:32.111 TinyTuya: Acquiring GIL for 'onHeartbeatCallback'
2024-01-18 23:16:32.111 TinyTuya: Calling message handler 'onHeartbeat' on 'module' type object.
2024-01-18 23:16:32.111 TinyTuya: onHeartbeat called
2024-01-18 23:16:32.111 TinyTuya: onHeartbeat called skipped
2024-01-18 23:16:32.111 TinyTuya: Acquiring GIL for 'onHeartbeatCallback'
2024-01-18 23:16:34.048 TinyTuya: Pushing 'onHeartbeatCallback' on to queue
2024-01-18 23:16:34.099 TinyTuya: Processing 'onHeartbeatCallback' message
2024-01-18 23:16:34.099 TinyTuya: Acquiring GIL for 'onHeartbeatCallback'
2024-01-18 23:16:34.099 TinyTuya: Calling message handler 'onHeartbeat' on 'module' type object.
2024-01-18 23:16:34.099 TinyTuya: onHeartbeat called
2024-01-18 23:16:34.099 TinyTuya: onHeartbeat called skipped
2024-01-18 23:16:34.099 TinyTuya: Acquiring GIL for 'onHeartbeatCallback'
Re: Python Plugin: Domoticz-TinyTUYA-Plugin (Cloud)
Posted: Friday 19 January 2024 15:24
by wvries
Hi Edwin,
I had a similar issue where the plugin seems to be held up in a loop requesting OnHeartbeat.
When I would restart the system, the issue would disappear but would come back randomly.
I found out that at the time of the error occurring, I had a lot of IPv6 traffic on my network (not using IPv6 at all).
With trial and error i came to the solution where if I disabled IPv6 on the RPI, the issue would disappear and since then, never came back. Now running stable again for about 1 month.
What i did was the following:
sudo nano /etc/sysctl.conf
Add the following lines:
# Disable IPv6
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1
net.ipv6.conf.eth0.disable_ipv6 = 1
sudo nano /etc/rc.local
Add the following line (before exit 0)
service procps reload
reboot the system.
check if there is still IPv6 running with ifconfig (should not have any line with inet6 in it).
Hope this might help you.
Re: Python Plugin: Domoticz-TinyTUYA-Plugin (Cloud)
Posted: Friday 19 January 2024 16:17
by Xenomes
EdwinK wrote: ↑Thursday 18 January 2024 22:38
When running the debug_discovery.py script both devices return an empty dump.json. Don't know if the free period has expired. Created connection on
Creation Time : 2023-03-08 16:31:24
Plugin is at version 1.7.0
I don't see a debug line. Did you put the plugin in 'debug: all'?
Re: Python Plugin: Domoticz-TinyTUYA-Plugin (Cloud)
Posted: Friday 19 January 2024 16:24
by EdwinK
Xenomes wrote: ↑Friday 19 January 2024 16:17
I don't see a debug line. Did you put the plugin in 'debug: all'?
Yes, it is set.

- Screen Shot 2024-01-19 at 16.23.19.png (18.81 KiB) Viewed 4947 times
Re: Python Plugin: Domoticz-TinyTUYA-Plugin (Cloud)
Posted: Friday 19 January 2024 17:02
by Xenomes
EdwinK wrote: ↑Friday 19 January 2024 16:24
Yes, it is set.
Screen Shot 2024-01-19 at 16.23.19.png
Okay, strange. Can you use the debug_discovery.py script to generate a dump.json and send it via PM? if you can't upload a json rename it to txt.
Re: Python Plugin: Domoticz-TinyTUYA-Plugin (Cloud)
Posted: Friday 19 January 2024 20:17
by EdwinK
~/domoticz/plugins/Domoticz-TinyTUYA-Plugin/tools $ sudo python3 debug_discovery.py
No device data returnd for Tuya. Trying again!
debug_discovery: -1 line 53
dump.json is created!
but... dump.json is empty.
Re: Python Plugin: Domoticz-TinyTUYA-Plugin (Cloud)
Posted: Friday 19 January 2024 20:21
by Xenomes
EdwinK wrote: ↑Friday 19 January 2024 20:17
but... dump.json is empty.
Ah, then you didn't edited the file to include the Tuya credentials.
Re: Python Plugin: Domoticz-TinyTUYA-Plugin (Cloud)
Posted: Friday 19 January 2024 21:36
by EdwinK
Xenomes wrote: ↑Friday 19 January 2024 20:21
EdwinK wrote: ↑Friday 19 January 2024 20:17
but... dump.json is empty.
Ah, then you didn't edited the file to include the Tuya credentials.
I have added my info from the TUYA site, but still
Re: Python Plugin: Domoticz-TinyTUYA-Plugin (Cloud)
Posted: Friday 19 January 2024 21:41
by Xenomes
EdwinK wrote: ↑Friday 19 January 2024 21:36
I have added my info from the TUYA site, but still
If the data you entered is correct, it looks like the subscription is expired. On the plugin page, there is a link to extend it.
Re: Python Plugin: Domoticz-TinyTUYA-Plugin (Cloud)
Posted: Saturday 20 January 2024 9:49
by EdwinK
Thought this fixed it, but alas... no.
have other problems with domoticz to fix first, then i'll try again
Re: Python Plugin: Domoticz-TinyTUYA-Plugin (Cloud)
Posted: Sunday 04 February 2024 19:22
by gillesMa
Hello,
I have a problem with notifications from switches detected through the plugin. When I configure a notification for example for "swichoff", I always receive two notifications, separated by about 2-3 seconds. It's always the case, whether it's a notification through telegram or email for example. And this doesn't happen with a switch from TP-Link. As a consequence I assume the problem is related to the plugin. Does this happen with your setup too ? Any idea how to troubleshoot the problem?
Thank you and best regards.
Re: Python Plugin: Domoticz-TinyTUYA-Plugin (Cloud)
Posted: Sunday 04 February 2024 21:13
by Xenomes
gillesMa wrote: ↑Sunday 04 February 2024 19:22
Hello,
I have a problem with notifications from switches detected through the plugin. When I configure a notification for example for "swichoff", I always receive two notifications, separated by about 2-3 seconds. It's always the case, whether it's a notification through telegram or email for example. And this doesn't happen with a switch from TP-Link. As a consequence I assume the problem is related to the plugin. Does this happen with your setup too ? Any idea how to troubleshoot the problem?
Thank you and best regards.
Hi gillesMa,
Can you specify the type of device you "switch off"? The plugin checks if the requested state is different from the current state and only changes it if necessary. There are a couple of devices that can override that request.
Re: Python Plugin: Domoticz-TinyTUYA-Plugin (Cloud)
Posted: Monday 05 February 2024 18:05
by gillesMa
Xenomes wrote: ↑Sunday 04 February 2024 21:13
gillesMa wrote: ↑Sunday 04 February 2024 19:22
Hello,
I have a problem with notifications from switches detected through the plugin. When I configure a notification for example for "swichoff", I always receive two notifications, separated by about 2-3 seconds. It's always the case, whether it's a notification through telegram or email for example. And this doesn't happen with a switch from TP-Link. As a consequence I assume the problem is related to the plugin. Does this happen with your setup too ? Any idea how to troubleshoot the problem?
Thank you and best regards.
Hi gillesMa,
Can you specify the type of device you "switch off"? The plugin checks if the requested state is different from the current state and only changes it if necessary. There are a couple of devices that can override that request.
Hello,
They're juste basic wifi Tuya plugs, with an on/off state. Some of them also have electric meters, but it doesn't makes a difference. I also receive two notifications with a Cubetouch. It seems to be the case with all my Tuya devices.