Python Plugin: TUYA

Python and python framework

Moderator: leecollings

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

Re: Python Plugin: TUYA

Post by Xenomes »

adelafug wrote: Wednesday 01 September 2021 19:28 {"payload":{"devices":[],"scenes":[]},"header":{"code":"SUCCESS","payloadVersion":1}}
The devices string of the api is empty so there is noting for the plug-in to detect. Tuya is developing a new api tuya-iot-python-sdk maybe there is a programmer that will create a Tuya plug-in around it. I only have one Tuya device left to phase out then I have only Zigbee and Tasmota converted devices.
HP T630 (32GB SSD/8GB Mem) - Ubuntu 22.04.4 LTS (64Bit) - Domoticz 2024.7 with Machinon theme - RFLink - KaKu - Sonoff - Tasmota - Shelly - MQTT2Zigbee - OpenTherm Gateway - Tinytuya - IR Blaster - P1 Smart Meter - NPN Watermeter - Google Assistant
adelafug
Posts: 3
Joined: Wednesday 01 September 2021 19:24
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: TUYA

Post by adelafug »

Its posible flash with tasmota this device?

| PGST PB69 Tuya inteligente WiFi en casa Sensor de puerta App Ventana de notificación de protección de seguridad alerta de alarma de seguridad
https://a.aliexpress.com/_vPlJxU
User avatar
rolandtwilt
Posts: 74
Joined: Monday 05 October 2020 18:55
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: TUYA

Post by rolandtwilt »

I don't know if I'm good on this topic?
but I have the following question:
I bought a Tuya Zigbee gateway and connected it to Domoticz via the plugin (Tuya Cloud).
(https://github.com/guino/tuyaha) followed all instructions and it seems to work....
however when starting Domoticz I get the following message:

2021-09-12 10:08:01.535 Tuya: (Tuya) Device count: 0

And so no devices were found, anyone have an idea?
User avatar
Xenomes
Posts: 379
Joined: Tuesday 27 November 2018 19:05
Target OS: Linux
Domoticz version: 2024.7
Location: Netherlands
Contact:

Re: Python Plugin: TUYA

Post by Xenomes »

rolandtwilt wrote: Monday 13 September 2021 12:31 I don't know if I'm good on this topic?
but I have the following question:
I bought a Tuya Zigbee gateway and connected it to Domoticz via the plugin (Tuya Cloud).
(https://github.com/guino/tuyaha) followed all instructions and it seems to work....
however when starting Domoticz I get the following message:

2021-09-12 10:08:01.535 Tuya: (Tuya) Device count: 0

And so no devices were found, anyone have an idea?
The plug-in is working with the first version of the Tuya API, this version does not work with the Zigbee gateway.
HP T630 (32GB SSD/8GB Mem) - Ubuntu 22.04.4 LTS (64Bit) - Domoticz 2024.7 with Machinon theme - RFLink - KaKu - Sonoff - Tasmota - Shelly - MQTT2Zigbee - OpenTherm Gateway - Tinytuya - IR Blaster - P1 Smart Meter - NPN Watermeter - Google Assistant
User avatar
rolandtwilt
Posts: 74
Joined: Monday 05 October 2020 18:55
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: TUYA

Post by rolandtwilt »

Thanks for your comment!
Are there multiple versions?
And where can I find the right one?
kalinkamaen
Posts: 52
Joined: Sunday 04 January 2015 15:57
Target OS: Windows
Domoticz version: 2022.2
Location: Norway
Contact:

Re: Python Plugin: TUYA

Post by kalinkamaen »

Hello i am trying to get Tuya plugin to work, but I am stuck now :(

I am using windows 10 PC,
About Domoticz
Version: 2021.1 (build 13669) (beta)
Build Hash: f30dc726c
Compile Date: 2021-10-01 18:47:35
dzVents Version: 3.1.8
Python Version: 3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:01:18) [MSC v.1900 32 bit (Intel)]

Domoticz find my Python but when I try to open Tuya plugin i get this error message:
2021-10-02 09:08:02.221 Error: Smartlife: (tuya) failed to load 'plugin.py', Python Path used was 'C:\Program Files (x86)\Domoticz\plugins\tuyaha-master\;C:\Program Files (x86)\Python35-32\python35.zip;C:\Program Files (x86)\Python35-32\Lib\;C:\Program Files (x86)\Python35-32\DLLs\;C:\Program Files (x86)\Domoticz;C:\Program Files (x86)\Python35-32;C:\Program Files (x86)\Python35-32\lib\site-packages'.
2021-10-02 09:08:02.221 Error: Smartlife: (Smartlife) Module Import failed, exception: 'ImportError'
2021-10-02 09:08:02.221 Error: Smartlife: (Smartlife) Module Import failed: ' Name: requests'
2021-10-02 09:08:02.221 Error: Smartlife: (Smartlife) Error Line details not available.
2021-10-02 09:08:02.221 Error: Smartlife: (Smartlife) Exception traceback:
2021-10-02 09:08:02.221 Error: Smartlife: (Smartlife) ----> Line 57 in 'C:\Program Files (x86)\Domoticz\plugins\tuyaha-master\plugin.py', function <module>
2021-10-02 09:08:02.221 Error: Smartlife: (Smartlife) ----> Line 2 in 'C:\Program Files (x86)\Domoticz\plugins\tuyaha-master\tuyaha\__init__.py', function <module>
2021-10-02 09:08:02.221 Error: Smartlife: (Smartlife) ----> Line 5 in 'C:\Program Files (x86)\Domoticz\plugins\tuyaha-master\tuyaha\tuyaapi.py', function <module>
Image

Also a guestion, do I need gateway to make this work?
Windows 10, Domoticz 14784
User avatar
waltervl
Posts: 5152
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Python Plugin: TUYA

Post by waltervl »

If you used this Tuya plugin https://github.com/Xenomes/Domoticz-TUYA-Plugin (there are others) you need to install the python module "requests" too.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
kalinkamaen
Posts: 52
Joined: Sunday 04 January 2015 15:57
Target OS: Windows
Domoticz version: 2022.2
Location: Norway
Contact:

Re: Python Plugin: TUYA

Post by kalinkamaen »

waltervl wrote: Saturday 02 October 2021 10:05 If you used this Tuya plugin https://github.com/Xenomes/Domoticz-TUYA-Plugin (there are others) you need to install the python module "requests" too.
I did nopt use this plugin. But now I have tried this plugin that you linked me, and installed requests with command promt pr installation guide.

And now i get this error:
2021-10-02 10:49:41.537 Error: Smart life 2: (tuya) failed to load 'plugin.py', Python Path used was 'C:\Program Files (x86)\Domoticz\plugins\Tuya\;C:\Program Files (x86)\Python35-32\python35.zip;C:\Program Files (x86)\Python35-32\Lib\;C:\Program Files (x86)\Python35-32\DLLs\;C:\Program Files (x86)\Domoticz;C:\Program Files (x86)\Python35-32;C:\Program Files (x86)\Python35-32\lib\site-packages'.
2021-10-02 10:49:41.557 Error: Smart life 2: (Smart life 2) Module Import failed, exception: 'ImportError'
2021-10-02 10:49:41.568 Error: Smart life 2: (Smart life 2) Module Import failed: ' Name: tuyaha'
2021-10-02 10:49:41.638 Error: Smart life 2: (Smart life 2) Error Line details not available.
2021-10-02 10:49:41.689 Error: Smart life 2: (Smart life 2) Exception traceback:
2021-10-02 10:49:41.729 Error: Smart life 2: (Smart life 2) ----> Line 65 in 'C:\Program Files (x86)\Domoticz\plugins\Tuya\plugin.py', function <module>
Could it be that my Tuya devices are not compatible with this plugin?
https://www.aliexpress.com/item/1005002 ... 4c4dCa0nZs
Windows 10, Domoticz 14784
User avatar
Xenomes
Posts: 379
Joined: Tuesday 27 November 2018 19:05
Target OS: Linux
Domoticz version: 2024.7
Location: Netherlands
Contact:

Re: Python Plugin: TUYA

Post by Xenomes »

kalinkamaen wrote: Saturday 02 October 2021 10:52

Code: Select all

2021-10-02 10:49:41.568 Error: Smart life 2: (Smart life 2) Module Import failed: ' Name: tuyaha'
The Tuyaha module is missing, you need to install it see https://github.com/Xenomes/Domoticz-TUY ... stallation
kalinkamaen wrote: Saturday 02 October 2021 10:52 Could it be that my Tuya devices are not compatible with this plugin?
That one is unknown, some devices work with the old api some don't.
HP T630 (32GB SSD/8GB Mem) - Ubuntu 22.04.4 LTS (64Bit) - Domoticz 2024.7 with Machinon theme - RFLink - KaKu - Sonoff - Tasmota - Shelly - MQTT2Zigbee - OpenTherm Gateway - Tinytuya - IR Blaster - P1 Smart Meter - NPN Watermeter - Google Assistant
kalinkamaen
Posts: 52
Joined: Sunday 04 January 2015 15:57
Target OS: Windows
Domoticz version: 2022.2
Location: Norway
Contact:

Re: Python Plugin: TUYA

Post by kalinkamaen »

Xenomes wrote: Saturday 02 October 2021 15:51
kalinkamaen wrote: Saturday 02 October 2021 10:52

Code: Select all

2021-10-02 10:49:41.568 Error: Smart life 2: (Smart life 2) Module Import failed: ' Name: tuyaha'
The Tuyaha module is missing, you need to install it see https://github.com/Xenomes/Domoticz-TUY ... stallation
kalinkamaen wrote: Saturday 02 October 2021 10:52 Could it be that my Tuya devices are not compatible with this plugin?
That one is unknown, some devices work with the old api some don't.
There is install guide for Linux. But I am using windows. WHat and how do I copy paste the files in to plugin directory?

Image
Windows 10, Domoticz 14784
User avatar
Xenomes
Posts: 379
Joined: Tuesday 27 November 2018 19:05
Target OS: Linux
Domoticz version: 2024.7
Location: Netherlands
Contact:

Re: Python Plugin: TUYA

Post by Xenomes »

kalinkamaen wrote: Saturday 02 October 2021 16:20 There is install guide for Linux. But I am using windows. WHat and how do I copy paste the files in to plugin directory?
You don't need to put something in the plug-in directory 😆 install pip for python in your windows. https://phoenixnap.com/kb/install-pip-windows then install the modules with the pip install command.
HP T630 (32GB SSD/8GB Mem) - Ubuntu 22.04.4 LTS (64Bit) - Domoticz 2024.7 with Machinon theme - RFLink - KaKu - Sonoff - Tasmota - Shelly - MQTT2Zigbee - OpenTherm Gateway - Tinytuya - IR Blaster - P1 Smart Meter - NPN Watermeter - Google Assistant
kalinkamaen
Posts: 52
Joined: Sunday 04 January 2015 15:57
Target OS: Windows
Domoticz version: 2022.2
Location: Norway
Contact:

Re: Python Plugin: TUYA

Post by kalinkamaen »

Xenomes wrote: Saturday 02 October 2021 19:42
kalinkamaen wrote: Saturday 02 October 2021 16:20 There is install guide for Linux. But I am using windows. WHat and how do I copy paste the files in to plugin directory?
You don't need to put something in the plug-in directory 😆 install pip for python in your windows. https://phoenixnap.com/kb/install-pip-windows then install the modules with the pip install command.
Thank you guys, I have managed to make it work.I am a noob so I did not know about pip. I had to download TUYA plugin, put it in directory and pip install it from directory. I was not able to install it from github.
Windows 10, Domoticz 14784
kalinkamaen
Posts: 52
Joined: Sunday 04 January 2015 15:57
Target OS: Windows
Domoticz version: 2022.2
Location: Norway
Contact:

Re: Python Plugin: TUYA

Post by kalinkamaen »

Any plugins for door sensors and or temperatur sensor?
Windows 10, Domoticz 14784
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 am using TUYA Plugin v.1.0.6, this has worked flawless for several months. But suddenly I have weird problems: lamps no longer react, and the log show strange messages:

Code: Select all

2021-10-03 22:24:53.155 (Tuya_devices) onHeartbeat called time=1633292693.1554873
2021-10-03 22:24:53.157 (Tuya_devices) in handlethread
2021-10-03 22:24:53.312 Error: (Tuya_devices) handleThread: Expecting value: line 1 column 1 (char 0) line 198
When I try to enable and disable the plugin, it freezes Domoticz. Have to go into the Pi thru Putty, stop/start Domoticz to resolve. Also strange: Domoticz restart does not work, it has to be stop/start!

Any clues?

edit: the weird part is that Domoticz was doing OK when switching the devices on earlier this evening. The problem developed during the evening!
The Tuya Smart app that I used to pair the lamps does work, although it takes several seconds before I can see the status of the lamps.
Could there be a problem in the Tuya server somehow?
Last edited by manjh on Sunday 03 October 2021 22:46, edited 1 time in total.
Hans
User avatar
EdwinK
Posts: 1820
Joined: Sunday 22 January 2017 21:46
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Rhoon
Contact:

Re: Python Plugin: TUYA

Post by EdwinK »

I just read that there was some problems with the Tuya servers.
Running latest BETA on a Pi-3 | Toon® Thermostat (rooted) | Hue | Tuya | IKEA tradfri | Dashticz V3 on Lenovo Huawei Tablet | Conbee
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 »

EdwinK wrote: Sunday 03 October 2021 22:46 I just read that there was some problems with the Tuya servers.
Ah, that's a relief. I thought I was going crazy.. :shock:

Where did you read that? Is there a way to get a status update> Would be great to know when the problem is fixed!
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 »

Looks like the Tuya people fixed the problem. This morning the app worked again, although I had to change the password. After changing it in Domoticz as well, everything was OK. :)
Hans
gorstj
Posts: 41
Joined: Tuesday 13 December 2016 18:06
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: TUYA

Post by gorstj »

Given server outage yesterday it highlight fragility of using the cloud

It looks like there is a new HA Tuya v2 API that may be a replacement for the python module that this plugin utilises?

https://peyanski.com/home-assistant-tuy ... -official/

It looks like it is more reliable, more features and will soon have built in local control

Will this plugin migrate to using this backend?
User avatar
Xenomes
Posts: 379
Joined: Tuesday 27 November 2018 19:05
Target OS: Linux
Domoticz version: 2024.7
Location: Netherlands
Contact:

Re: Python Plugin: TUYA

Post by Xenomes »

gorstj wrote: Monday 04 October 2021 20:58 Will this plugin migrate to using this backend?
I won't be creating a new plug-in with the new Tuya_V2 API and DomoticzEX, I phased out Tuya devices in my environment.
HP T630 (32GB SSD/8GB Mem) - Ubuntu 22.04.4 LTS (64Bit) - Domoticz 2024.7 with Machinon theme - RFLink - KaKu - Sonoff - Tasmota - Shelly - MQTT2Zigbee - OpenTherm Gateway - Tinytuya - IR Blaster - P1 Smart Meter - NPN Watermeter - Google Assistant
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 »

gorstj wrote: Monday 04 October 2021 20:58 Given server outage yesterday it highlight fragility of using the cloud
I fully agree, and I wouldgreatly appreciate a plugin that controls the Tuya devices locally, so without involving a cloud server. I know about flashing deices with Tasmota, but also read about the ongoing battle between Tuya-convert and Tuya (trying to prohibit flashing their devices).
So until there is a simple way to achieve this, I will stick to the current Tuya plugin.

I noticed a post from the author of the plugin (Xenomes) that the Tuya devices have been phased out of his house... so I guess we will have to live current version....
Hans
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 1 guest