Python Plugin: Domoticz-TinyTUYA-Plugin (Cloud)

Python and python framework

Moderator: leecollings

User avatar
Varazir
Posts: 487
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 »

I added gcc libffi-dev pkgs to install and now it's working.
Raspberry PI 4 with RaZberry Controller 2016 ZWave+ and CC2531(zigbee)
Several IKEA devices/z-wave devices
User avatar
Xenomes
Posts: 457
Joined: Tuesday 27 November 2018 19:05
Target OS: Linux
Domoticz version: 2026.3
Location: Netherlands
Contact:

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

Post by Xenomes »

Varazir wrote: Sunday 25 January 2026 13:55 I added gcc libffi-dev pkgs to install and now it's working.
Very good that it is working! Every installation is not 100% the same.
HP T630 (256GB SSD/8GB Mem) - Ubuntu 24.04.4 LTS (64Bit) - Domoticz 2026.3 (Docker)
Tinytuya
lebsana
Posts: 1
Joined: Tuesday 10 February 2026 10:30
Target OS: Raspberry Pi / ODroid
Domoticz version: 2025.2
Location: France
Contact:

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

Post by lebsana »

Thank you so much for your work. :) :)
I followed the PDF tutorial and the instructions on GitHub, and everything worked perfectly on the first try!

Well done!

I have the MOES Smart Universal IR WiFi Infrared Remote Control. It's well integrated into Domoticz, but unfortunately, it's not yet supported by your plugin.
https://www.amazon.fr/T%C3%A9l%C3%A9com ... B07PW3R574
Do you think it's possible to integrate it? :roll:
If not, no worries, and thank you again for your work !
User avatar
Xenomes
Posts: 457
Joined: Tuesday 27 November 2018 19:05
Target OS: Linux
Domoticz version: 2026.3
Location: Netherlands
Contact:

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

Post by Xenomes »

lebsana wrote: Tuesday 10 February 2026 10:45 Thank you so much for your work. :) :)
I followed the PDF tutorial and the instructions on GitHub, and everything worked perfectly on the first try!

Well done!

I have the MOES Smart Universal IR WiFi Infrared Remote Control. It's well integrated into Domoticz, but unfortunately, it's not yet supported by your plugin.
https://www.amazon.fr/T%C3%A9l%C3%A9com ... B07PW3R574
Do you think it's possible to integrate it? :roll:
If not, no worries, and thank you again for your work !
Hi, IR is a problem. But maybe I can check jour JSON, perhaps something changed in the output from TinyTuya. Can you create a dump.json by running debug_discovery.py from the tools directory and mail it to [email protected].
HP T630 (256GB SSD/8GB Mem) - Ubuntu 24.04.4 LTS (64Bit) - Domoticz 2026.3 (Docker)
Tinytuya
pioupiou92
Posts: 8
Joined: Monday 16 May 2016 10:11
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

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

Post by pioupiou92 »

Thanks Xenomes for the work done.
Plugin just installed to control KSIX BXOUTL1 Model SLL04015-N. Unfortunately, only white on/off/dimmer is working.
Is it normal?

BXOUTL1 Product details https://www.amazon.fr/-/en/KSIX-Pack-Sm ... 225&sr=1-2
User avatar
Xenomes
Posts: 457
Joined: Tuesday 27 November 2018 19:05
Target OS: Linux
Domoticz version: 2026.3
Location: Netherlands
Contact:

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

Post by Xenomes »

pioupiou92 wrote: Friday 17 April 2026 16:53 Thanks Xenomes for the work done.
Plugin just installed to control KSIX BXOUTL1 Model SLL04015-N. Unfortunately, only white on/off/dimmer is working.
Is it normal?

BXOUTL1 Product details https://www.amazon.fr/-/en/KSIX-Pack-Sm ... 225&sr=1-2
This looks like an RGB(W) spotlight. To confirm, could you please run debug_discovery.py from the tools directory to create a dump.json file and then post it as a GitHub Issue on the Domoticz-TinyTUYA-Plugin page?
HP T630 (256GB SSD/8GB Mem) - Ubuntu 24.04.4 LTS (64Bit) - Domoticz 2026.3 (Docker)
Tinytuya
pioupiou92
Posts: 8
Joined: Monday 16 May 2016 10:11
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

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

Post by pioupiou92 »

Xenomes wrote: Friday 17 April 2026 18:55
pioupiou92 wrote: Friday 17 April 2026 16:53 Thanks Xenomes for the work done.
Plugin just installed to control KSIX BXOUTL1 Model SLL04015-N. Unfortunately, only white on/off/dimmer is working.
Is it normal?

BXOUTL1 Product details https://www.amazon.fr/-/en/KSIX-Pack-Sm ... 225&sr=1-2
This looks like an RGB(W) spotlight. To confirm, could you please run debug_discovery.py from the tools directory to create a dump.json file and then post it as a GitHub Issue on the Domoticz-TinyTUYA-Plugin page?
Hello Xenomes,

Issue #199 opened on GitHub.

Thanks
User avatar
Xenomes
Posts: 457
Joined: Tuesday 27 November 2018 19:05
Target OS: Linux
Domoticz version: 2026.3
Location: Netherlands
Contact:

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

Post by Xenomes »

pioupiou92 wrote: Tuesday 21 April 2026 17:33 Issue #199 opened on GitHub.
Thanks very good, i will take a look!
HP T630 (256GB SSD/8GB Mem) - Ubuntu 24.04.4 LTS (64Bit) - Domoticz 2026.3 (Docker)
Tinytuya
jbakel
Posts: 5
Joined: Wednesday 22 April 2026 22:13
Target OS: Linux
Domoticz version:
Contact:

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

Post by jbakel »

Hello,

When i want Extend Service Trial Periodn i get a message from tuya

All input parameters of the remote API are lost.
Do i do something wrong, i klik on the link in the pluggin

Nothing is working here at this moment because my trial period is ovber, and for a home automation 25.000 euro in a year to pay... no, thats to much

Jurgen
EskildP
Posts: 17
Joined: Monday 29 January 2024 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: 2026.1
Location: NO
Contact:

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

Post by EskildP »

Got this mail from Tuya:
"Your subscription IoT Core, Cloud Develop Base Resource Trial remaining usage is 1.00%. Once the quota limit is exceeded, the service will be suspended.

If you want to raise the limit,

you can click the link below to upgrade your plan.

https://www.tuya.com/vas/commodity/IOT_CORE_V2"

Cannot find any way to renew for free. Do I have some wrong subscription, or did Tuya change the conditions?

Any hints?
User avatar
Xenomes
Posts: 457
Joined: Tuesday 27 November 2018 19:05
Target OS: Linux
Domoticz version: 2026.3
Location: Netherlands
Contact:

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

Post by Xenomes »

EskildP wrote: Thursday 14 May 2026 8:45 Got this mail from Tuya:
"Your subscription IoT Core, Cloud Develop Base Resource Trial remaining usage is 1.00%. Once the quota limit is exceeded, the service will be suspended.

If you want to raise the limit,

you can click the link below to upgrade your plan.

https://www.tuya.com/vas/commodity/IOT_CORE_V2"

Cannot find any way to renew for free. Do I have some wrong subscription, or did Tuya change the conditions?

Any hints?
This appears to be a default automated message. However, Tuya has a history of changing their terms. My account dates back to 2021 and is on a legacy plan with unlimited API calls that doesn't expire. Newer accounts, on the other hand, are now limited to 26,000 calls per month and have a six-month expiration period.

See link for extension:
https://github.com/Xenomes/Domoticz-Tin ... on-expired
HP T630 (256GB SSD/8GB Mem) - Ubuntu 24.04.4 LTS (64Bit) - Domoticz 2026.3 (Docker)
Tinytuya
EskildP
Posts: 17
Joined: Monday 29 January 2024 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: 2026.1
Location: NO
Contact:

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

Post by EskildP »

Xenomes, thanks for answering :)
My account is from february this year, and was renewed after 1 month for 6 new months, so it will expire on september 17th. So the blocking must be caused by the amount of calls. But how can I have used that much? The polling interval is set to 15 minutes, and there is no automation in domoticz that I can see resulting in that amount of calls.

I got the metioned warning on april30th, and my devices has been working until may 11th. Will it possibly be working again when a new month starts, after may 17th?
User avatar
Xenomes
Posts: 457
Joined: Tuesday 27 November 2018 19:05
Target OS: Linux
Domoticz version: 2026.3
Location: Netherlands
Contact:

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

Post by Xenomes »

The plug-in is designed for Tuya WiFi devices and uses a pull system to update the status in Domoticz.
This means that the number of API calls to Tuya depends on the number of devices and the polling interval.

With a limit of 26,000 Tuya calls per month, you can calculate the polling interval as follows:

Example for 2 devices:
26,000 calls ÷ 2 devices ÷ 31 days ÷ 24 hours ≈ 17.47 calls per hour
60 minutes ÷ 17.47 ≈ 3.43 minutes per call → set the interval to once every 4 or 5 minutes.

Adjust the "API Polling interval" according to the total number of devices in your setup.
HP T630 (256GB SSD/8GB Mem) - Ubuntu 24.04.4 LTS (64Bit) - Domoticz 2026.3 (Docker)
Tinytuya
EskildP
Posts: 17
Joined: Monday 29 January 2024 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: 2026.1
Location: NO
Contact:

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

Post by EskildP »

Xenomes wrote: Thursday 14 May 2026 11:45 The plug-in is designed for Tuya WiFi devices and uses a pull system to update the status in Domoticz.
This means that the number of API calls to Tuya depends on the number of devices and the polling interval.

With a limit of 26,000 Tuya calls per month, you can calculate the polling interval as follows:

Example for 2 devices:
26,000 calls ÷ 2 devices ÷ 31 days ÷ 24 hours ≈ 17.47 calls per hour
60 minutes ÷ 17.47 ≈ 3.43 minutes per call → set the interval to once every 4 or 5 minutes.

Adjust the "API Polling interval" according to the total number of devices in your setup.
OK, I have 4 devices and 15 minutes interval, which is less than 12000 calls per month ...
User avatar
Xenomes
Posts: 457
Joined: Tuesday 27 November 2018 19:05
Target OS: Linux
Domoticz version: 2026.3
Location: Netherlands
Contact:

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

Post by Xenomes »

EskildP wrote: Thursday 14 May 2026 11:59 OK, I have 4 devices and 15 minutes interval, which is less than 12000 calls per month ...
That should be good, unless the TinyTuya module uses more calls for other devices. I have only an RGBWW light, all other devices are created from setup data from other users, so I cannot verify the actual call usage. You can check your call usage on your Tuya account. I am currently developing a hybrid version of the plugin that first attempts to connect to the device locally and only switches to the cloud if needed, which will significantly reduce the number of calls used.
https://github.com/Xenomes/Domoticz-Tin ... ree/Hybrid
HP T630 (256GB SSD/8GB Mem) - Ubuntu 24.04.4 LTS (64Bit) - Domoticz 2026.3 (Docker)
Tinytuya
EskildP
Posts: 17
Joined: Monday 29 January 2024 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: 2026.1
Location: NO
Contact:

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

Post by EskildP »

EskildP wrote: Thursday 14 May 2026 11:59
Xenomes wrote: Thursday 14 May 2026 11:45 The plug-in is designed for Tuya WiFi devices and uses a pull system to update the status in Domoticz.
This means that the number of API calls to Tuya depends on the number of devices and the polling interval.

With a limit of 26,000 Tuya calls per month, you can calculate the polling interval as follows:

Example for 2 devices:
26,000 calls ÷ 2 devices ÷ 31 days ÷ 24 hours ≈ 17.47 calls per hour
60 minutes ÷ 17.47 ≈ 3.43 minutes per call → set the interval to once every 4 or 5 minutes.

Adjust the "API Polling interval" according to the total number of devices in your setup.
OK, I have 4 devices and 15 minutes interval, which is less than 12000 calls per month ...
Checked again today, and now it works OK.
And I think I know the reason for this trouble, as there are two servers, one at home and one remote. Both servers have the same devices, 5 (not 4) at each server (4 at remote site, 1 at home) :)
EskildP
Posts: 17
Joined: Monday 29 January 2024 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: 2026.1
Location: NO
Contact:

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

Post by EskildP »

Installed this plugin with Domoticz Docker on Raspberry Pi OS "Trixie" 32 bit lite. Had to include

Code: Select all

apt install libffi-dev build-essential pkg-config libssl-dev -y
in customstart.sh, just as specified for "Bookworm".
EskildP
Posts: 17
Joined: Monday 29 January 2024 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: 2026.1
Location: NO
Contact:

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

Post by EskildP »

Struggling with version 3.2.1 on domotics 2026.4
My customstart.sh is as follows

Code: Select all

if [ -f /opt/domoticz/FIRSTRUN ]; then
	true
else
	echo '********************* updating packages'
	apt-get -qq update
	echo '********************* install tinytuya Trixie'
	apt install libffi-dev build-essential pkg-config libssl-dev -y
	# pip3 install tinytuya PyCryptodome==3.21.0 chardet==3.0.4 requests==2.23.0 charset-normalizer==3.0.1 --break-system-packages
	pip3 install tinytuya cryptography>=3.1 pycryptodomex -U
	echo 'creating FIRSTRUN file so script can check on next run'
	touch /opt/domoticz/FIRSTRUN
	cd /opt/domoticz || return
fi
TuyaCloud seems to start OK

Code: Select all

2026-10-05 09:55:48.996  Status: RxQueue: queue worker started...
2026-10-05 09:55:50.999  Status: TuyaCloud: Started.
2026-10-05 09:55:50.999  Status: TuyaCloud: Entering work loop.
2026-10-05 09:55:51.000  Status: NotificationSystem: thread started...
2026-10-05 09:55:51.002  Status: EventSystem: reset all events...
2026-10-05 09:55:51.004  Status: Mqtt hytta : Connecting to 10.26.42.10:1883
2026-10-05 09:55:51.007  Status: Mqtt hytta : Connected to: 10.26.42.10:1883
2026-10-05 09:55:51.008  Status: EventSystem: reset all device statuses...
2026-10-05 09:55:51.281  Status: PluginSystem: 1 plugins started.
2026-10-05 09:55:51.594  Status: Python EventSystem: Initializing event module.
2026-10-05 09:55:51.595  Status: Python EventSystem: Initializing event module.
2026-10-05 09:55:51.597  Status: EventSystem: Started
2026-10-05 09:55:51.599  Status: EventSystem: Queue thread started...
2026-10-05 09:55:53.246  Status: TuyaCloud: Initialized version 3.2.1, author 'Xenomes'
2026-10-05 09:55:53.264  TuyaCloud: [event=startup] Domoticz version: 2026.4
2026-10-05 09:55:53.264  TuyaCloud: [event=startup] TinyTUYA 3.2.1 plugin started
2026-10-05 09:55:53.265  TuyaCloud: [event=startup] TinyTuya Version: 1.20.0
2026-10-05 09:55:53.267  TuyaCloud: [event=cloud-usage] Tuya cloud usage (restored after start) - API calls: today 0, this week 0, this month 0 | Pulsar message              s: today 0, this week 0, this month 0
2026-10-05 09:55:53.268  TuyaCloud: [event=startup] Initializing Tuya plugin
2026-10-05 09:55:53.269  TuyaCloud: [event=cloud-init] Cloud mode: fetching device data from Tuya cloud
2026-10-05 09:55:55.334  TuyaCloud: [event=cloud-init] Successfully fetched 5 device(s) from Tuya cloud
2026-10-05 09:55:55.335  TuyaCloud: [event=cloud-init]   - Device: SH-P01 T04 (ID: xxxxxx6463baa92eaepayf)
2026-10-05 09:55:55.335  TuyaCloud: [event=cloud-init]   - Device: SH-P01 T03 (ID: xxxxxx22f7a03b39febdn0)
2026-10-05 09:55:55.336  TuyaCloud: [event=cloud-init]   - Device: SH-P01 T01 (ID: xxxxxxf7fe35ab6435ypb2)
2026-10-05 09:55:55.337  TuyaCloud: [event=cloud-init]   - Device: SH-P01 T05 (ID: xxxxxxcfecbea917clrdb)
2026-10-05 09:55:55.338  TuyaCloud: [event=cloud-init]   - Device: SH-P01 T02 (ID: xxxxxx57ef13e8851cylqi)
But then this happens

Code: Select all

2026-10-05 09:56:22.205  Error: TuyaCloud: Call to function 'onStart' failed, exception details:
2026-10-05 09:56:23.812  Error: TuyaCloud: Traceback (most recent call last):
2026-10-05 09:56:23.813  Error: TuyaCloud:   File "/opt/domoticz/userdata/plugins/Domoticz-TinyTUYA-Plugin/plugin.py", line 3536, in onHandleThread
2026-10-05 09:56:23.813  Error: TuyaCloud:     _log_local_scan_results(localtuya, devs, 'Initial Tuya IP scan', elapsed=time.time() - scan_start)
2026-10-05 09:56:23.813  Error: TuyaCloud:     ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2026-10-05 09:56:23.814  Error: TuyaCloud:   File "/opt/domoticz/userdata/plugins/Domoticz-TinyTUYA-Plugin/plugin.py", line 3288, in _log_local_scan_results
2026-10-05 09:56:23.814  Error: TuyaCloud:     Error(event="ip-scan", message=f"{label}: zero devices found on the local network at all. If this keeps happening for every scan, it usually points to a network-level problem rather than devices being offline: UDP ports 6666/6667/6668 blocked by a firewall on this host, Domoticz running in a Docker/VM network namespace that does not receive broadcast traffic, or this host being on a different subnet/VLAN than the Tuya devices.")
2026-10-05 09:56:23.814  Error: TuyaCloud:     ~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2026-10-05 09:56:23.815  Error: TuyaCloud: TypeError: 'NoneType' object is not callable
2026-10-05 09:56:23.815  Error: TuyaCloud: 
2026-10-05 09:56:23.815  Error: TuyaCloud: During handling of the above exception, another exception occurred:
2026-10-05 09:56:23.815  Error: TuyaCloud: 
2026-10-05 09:56:23.816  Error: TuyaCloud: Traceback (most recent call last):
2026-10-05 09:56:23.816  Error: TuyaCloud:   File "/opt/domoticz/userdata/plugins/Domoticz-TinyTUYA-Plugin/plugin.py", line 3539, in onHandleThread
2026-10-05 09:56:23.816  Error: TuyaCloud:     _log_local_scan_results(localtuya, devs, 'Initial Tuya IP scan', elapsed=time.time() - scan_start, scan_error=e)
2026-10-05 09:56:23.816  Error: TuyaCloud:     ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2026-10-05 09:56:23.817  Error: TuyaCloud:   File "/opt/domoticz/userdata/plugins/Domoticz-TinyTUYA-Plugin/plugin.py", line 3218, in _log_local_scan_results
2026-10-05 09:56:23.817  Error: TuyaCloud:     Error(event="ip-scan", message=f"{label} failed{duration_str}: [{err_type}] {err_text}")
2026-10-05 09:56:23.817  Error: TuyaCloud:     ~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2026-10-05 09:56:23.817  Error: TuyaCloud: TypeError: 'NoneType' object is not callable
2026-10-05 09:56:23.818  Error: TuyaCloud: 
2026-10-05 09:56:23.818  Error: TuyaCloud: During handling of the above exception, another exception occurred:
2026-10-05 09:56:23.818  Error: TuyaCloud: 
2026-10-05 09:56:23.819  Error: TuyaCloud: Traceback (most recent call last):
2026-10-05 09:56:23.819  Error: TuyaCloud:   File "/opt/domoticz/userdata/plugins/Domoticz-TinyTUYA-Plugin/plugin.py", line 3159, in onStart
2026-10-05 09:56:23.820  Error: TuyaCloud:     _plugin.onStart()
2026-10-05 09:56:23.820  Error: TuyaCloud:     ~~~~~~~~~~~~~~~^^
2026-10-05 09:56:23.820  Error: TuyaCloud:   File "/opt/domoticz/userdata/plugins/Domoticz-TinyTUYA-Plugin/plugin.py", line 1976, in onStart
2026-10-05 09:56:23.820  Error: TuyaCloud:     onHandleThread(True, False)
2026-10-05 09:56:23.821  Error: TuyaCloud:     ~~~~~~~~~~~~~~^^^^^^^^^^^^^
2026-10-05 09:56:23.821  Error: TuyaCloud:   File "/opt/domoticz/userdata/plugins/Domoticz-TinyTUYA-Plugin/plugin.py", line 6591, in onHandleThread
2026-10-05 09:56:23.821  Error: TuyaCloud:     Error(event='error', message=str(e))
2026-10-05 09:56:23.822  Error: TuyaCloud:     ~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2026-10-05 09:56:23.822  Error: TuyaCloud: TypeError: 'NoneType' object is not callable
The devices can still be turned on/off
Post Reply