Tuya Cloud Plugin [No custom firmware require]: Finally for Domoticz

Python and python framework

Moderator: leecollings

jforum
Posts: 3
Joined: Monday 01 July 2019 8:48
Target OS: -
Domoticz version:
Contact:

Tuya Cloud Plugin [No custom firmware require]: Finally for Domoticz

Post by jforum »

Recently, I found a plugin that don’t require you to flash the Tuya firmware. It works similar to the Homeassistant Tuya Plugin.
Created a video to show you how to integrate it and make it work with Tuya Smart Life App. As of today, this plugin need a little code to make it work with the Smart Life App else it will just work with Tuya App.

https://youtu.be/pBJZcwIDOUY

NOTE: This plugin is created and developed by “Tizzen33”. His github repo is: https://github.com/tizzen33/domoticz-tuyacloud-plugin
User avatar
remb0
Posts: 499
Joined: Thursday 11 July 2013 22:21
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: The Netherlands
Contact:

Re: Tuya Cloud Plugin [No custom firmware require]: Finally for Domoticz

Post by remb0 »

great news! thanks for sharing. :!:
DarkG
Posts: 89
Joined: Friday 15 September 2017 18:54
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.10076
Location: Germany
Contact:

Re: Tuya Cloud Plugin [No custom firmware require]: Finally for Domoticz

Post by DarkG »

What means that error?

Code: Select all

plugin/:/usr/lib/python37.zip:/usr/lib/python3.7:/usr/lib/python3.7/lib-dynload:/usr/local/lib/python3.7/dist-packages:/usr/lib/python3/dist-packages:/usr/lib/python3.7/dist-packages'.
2020-05-28 00:52:49.480 Error: (tuya) Module Import failed, exception: 'ModuleNotFoundError'
2020-05-28 00:52:49.480 Error: (tuya) Module Import failed: ' Name: requests'
2020-05-28 00:52:49.480 Error: (tuya) Error Line details not available.
2020-05-28 00:52:49.508 Error: (PiMonitor) 'onStart' failed 'KeyError'.
2020-05-28 00:52:49.508 Error: (PiMonitor) ----> Line 219 in '/home/pi/domoticz/plugins/PiMonitor/plugin.py', function onStart
2020-05-28 00:52:49.508 Error: (PiMonitor) ----> Line 77 in '/home/pi/domoticz/plugins/PiMonitor/plugin.py', function onStart
2020-05-28 00:53:37.373 Status: (tuya) Stop directive received.
2020-05-28 00:53:37.374 Status: (tuya) Stopping threads.
2020-05-28 00:53:37.374 Status: (tuya) Stopped.
2020-05-28 00:54:05.047 Status: (tuya) Started.
2020-05-28 00:54:05.163 Error: (tuyacloud) failed to load 'plugin.py', Python Path used was '/home/pi/domoticz/plugins/tuyacloud-plugin/:/usr/lib/python37.zip:/usr/lib/python3.7:/usr/lib/python3.7/lib-dynload:/usr/local/lib/python3.7/dist-packages:/usr/lib/python3/dist-packages:/usr/lib/python3.7/dist-packages'.
2020-05-28 00:54:05.163 Error: (tuya) Module Import failed, exception: 'ModuleNotFoundError'
2020-05-28 00:54:05.163 Error: (tuya) Module Import failed: ' Name: requests'
2020-05-28 00:54:05.164 Error: (tuya) Error Line details not available.
2020-05-28 00:55:07.072 Error: tuya hardware (19) thread seems to have ended unexpectedly
RPi4 Shelly1 Shelly2.5 ESPEasy Tuya Domoticz Beta Dashticz 3.6
jforum
Posts: 3
Joined: Monday 01 July 2019 8:48
Target OS: -
Domoticz version:
Contact:

Re: Tuya Cloud Plugin [No custom firmware require]: Finally for Domoticz

Post by jforum »

Hi, it seem like your python does not install the dependencies module "requests"

Try pip install requests
DarkG wrote: Thursday 28 May 2020 0:57 What means that error?

Code: Select all

plugin/:/usr/lib/python37.zip:/usr/lib/python3.7:/usr/lib/python3.7/lib-dynload:/usr/local/lib/python3.7/dist-packages:/usr/lib/python3/dist-packages:/usr/lib/python3.7/dist-packages'.
2020-05-28 00:52:49.480 Error: (tuya) Module Import failed, exception: 'ModuleNotFoundError'
2020-05-28 00:52:49.480 Error: (tuya) Module Import failed: ' Name: requests'
2020-05-28 00:52:49.480 Error: (tuya) Error Line details not available.
2020-05-28 00:52:49.508 Error: (PiMonitor) 'onStart' failed 'KeyError'.
2020-05-28 00:52:49.508 Error: (PiMonitor) ----> Line 219 in '/home/pi/domoticz/plugins/PiMonitor/plugin.py', function onStart
2020-05-28 00:52:49.508 Error: (PiMonitor) ----> Line 77 in '/home/pi/domoticz/plugins/PiMonitor/plugin.py', function onStart
2020-05-28 00:53:37.373 Status: (tuya) Stop directive received.
2020-05-28 00:53:37.374 Status: (tuya) Stopping threads.
2020-05-28 00:53:37.374 Status: (tuya) Stopped.
2020-05-28 00:54:05.047 Status: (tuya) Started.
2020-05-28 00:54:05.163 Error: (tuyacloud) failed to load 'plugin.py', Python Path used was '/home/pi/domoticz/plugins/tuyacloud-plugin/:/usr/lib/python37.zip:/usr/lib/python3.7:/usr/lib/python3.7/lib-dynload:/usr/local/lib/python3.7/dist-packages:/usr/lib/python3/dist-packages:/usr/lib/python3.7/dist-packages'.
2020-05-28 00:54:05.163 Error: (tuya) Module Import failed, exception: 'ModuleNotFoundError'
2020-05-28 00:54:05.163 Error: (tuya) Module Import failed: ' Name: requests'
2020-05-28 00:54:05.164 Error: (tuya) Error Line details not available.
2020-05-28 00:55:07.072 Error: tuya hardware (19) thread seems to have ended unexpectedly
nico4sen
Posts: 6
Joined: Saturday 15 February 2020 13:41
Target OS: -
Domoticz version:
Contact:

Re: Tuya Cloud Plugin [No custom firmware require]: Finally for Domoticz

Post by nico4sen »

It works. Nice. Thx for sharing.

Verstuurd vanaf mijn TA-1021 met Tapatalk

MrRikkie
Posts: 11
Joined: Monday 18 July 2016 11:39
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.2
Location: Eindhoven
Contact:

Re: Tuya Cloud Plugin [No custom firmware require]: Finally for Domoticz

Post by MrRikkie »

Hi, one question does this plugin also work for a motion detector ? I do not know how the app will register this, in principle it’s a switch.
kabaret10
Posts: 3
Joined: Sunday 26 July 2020 9:13
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Tuya Cloud Plugin [No custom firmware require]: Finally for Domoticz

Post by kabaret10 »

Hello, I've got the same problem as nico4sen but I'm using domoticz in docker container.
Inside container there's python 2.7

Code: Select all

Python 2.7.16 (default, Jan 14 2020, 07:22:01)
How to make this work? Do I need to update python inside container and then add dependencies?
Or can I just pull python ver.3 image on other container and somehow connect it eachother?
What ports this plugin use?
I'm kinda new to docker and I'm trying to figure it out. ;)


@EDIT Solved.
Need to rebuild current domoticz image with dockerfile.
TIPS
1. Create somewhere file named Dockerfile and go to that location in shell.
2. Edit it with:

Code: Select all

FROM linuxserver/domoticz:latest      # current configured domoticz image with some stuff.
RUN python3 -m pip install requests
and that's it, now:

Code: Select all

sudo docker build . 

Output: New name of image.
Now create your container with this image.
ismo67
Posts: 13
Joined: Friday 21 April 2017 23:21
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Finland, Kerava
Contact:

Re: Tuya Cloud Plugin [No custom firmware require]: Finally for Domoticz

Post by ismo67 »

This plugin works very well after checking the video as instructions are not perfect for non Linux person at Github right now.
But at the video is everything explained.
https://www.youtube.com/watch?v=pBJZcwIDOUY

Has there been plans also to get the electricity consumption values of the plugs this plugin can switch on and off?

Also I can see this plugin recognized my Tuya thermostats but those does not show any temperature values.
Attachments
Domoticz devices at Desktop.jpg
Domoticz devices at Desktop.jpg (305.88 KiB) Viewed 12081 times
Tuya Devices at Domoticz.png
Tuya Devices at Domoticz.png (179.77 KiB) Viewed 12082 times
Rasperry Pi4, Shelly, Yeelights, Xiaomi, Tuya, Tahoma, ESPEASY, Google Home
YrBo
Posts: 3
Joined: Friday 13 November 2020 14:08
Target OS: Raspberry Pi / ODroid
Domoticz version: 2023.2
Location: Netherlands
Contact:

Re: Tuya Cloud Plugin [No custom firmware require]: Finally for Domoticz

Post by YrBo »

Hi,

Thanks to this post i managed to add two Tuya devices.
One for floor heating Thermostat and a Neo Coolcam Smart Plug Wifi Socket (NAS-WR01W)
I've Domoticz running on a Synology 218+
Both devices i can switch On and Off with Domoticz.
For the WiFi socket i would like to measure used electricity.
The thermostat temperature i would like to manage the temperature and schedules.

Is this possible?

Thanks in advance
DarkG
Posts: 89
Joined: Friday 15 September 2017 18:54
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.10076
Location: Germany
Contact:

Re: Tuya Cloud Plugin [No custom firmware require]: Finally for Domoticz

Post by DarkG »

YrBo wrote: Friday 13 November 2020 14:20 For the WiFi socket i would like to measure used electricity.
The thermostat temperature i would like to manage the temperature and schedules.
https://github.com/guino/tuyaha#how-to- ... our-device

this is important to check if you get the values you need
RPi4 Shelly1 Shelly2.5 ESPEasy Tuya Domoticz Beta Dashticz 3.6
YrBo
Posts: 3
Joined: Friday 13 November 2020 14:08
Target OS: Raspberry Pi / ODroid
Domoticz version: 2023.2
Location: Netherlands
Contact:

Re: Tuya Cloud Plugin [No custom firmware require]: Finally for Domoticz

Post by YrBo »

Thanks,

After running is get the following;

File "debug_discovery.py", line 30
print("Got credentials")
^
IndentationError: unexpected indent
DarkG
Posts: 89
Joined: Friday 15 September 2017 18:54
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.10076
Location: Germany
Contact:

Re: Tuya Cloud Plugin [No custom firmware require]: Finally for Domoticz

Post by DarkG »

this is a syntax error

I think there is a layout error like a space or so
RPi4 Shelly1 Shelly2.5 ESPEasy Tuya Domoticz Beta Dashticz 3.6
schijndela
Posts: 17
Joined: Thursday 05 July 2018 19:36
Target OS: Raspberry Pi / ODroid
Domoticz version: V4.10717
Contact:

Re: Tuya Cloud Plugin [No custom firmware require]: Finally for Domoticz

Post by schijndela »

Hi,

Last week I installed the Plugin in my Domoticz to control my smart Sockets, entered all the neccessary information on the hardware tab like username, password and country code.
But the only thing is I don't see any devices appearing in Domoticz.
I modified the debug_discovery.py script in the Tools directory with my settings and ran it. I don't see any error messages but to be honest I don't know how to read the message I receive.

Am I overseeing something?
Attachments
Tuya Domoticz.jpg
Tuya Domoticz.jpg (78.95 KiB) Viewed 11011 times
User avatar
Xenomes
Posts: 379
Joined: Tuesday 27 November 2018 19:05
Target OS: Linux
Domoticz version: 2024.7
Location: Netherlands
Contact:

Re: Tuya Cloud Plugin [No custom firmware require]: Finally for Domoticz

Post by Xenomes »

There is nothing in the payload the devices section in empty. Do you used the corrected account?
2020-12-05 20_03_10-Clipboard.png
2020-12-05 20_03_10-Clipboard.png (160.61 KiB) Viewed 10965 times
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
schijndela
Posts: 17
Joined: Thursday 05 July 2018 19:36
Target OS: Raspberry Pi / ODroid
Domoticz version: V4.10717
Contact:

Re: Tuya Cloud Plugin [No custom firmware require]: Finally for Domoticz

Post by schijndela »

I use the same account (E-mailaddress) and password which I use for access in the smartlife app
User avatar
Xenomes
Posts: 379
Joined: Tuesday 27 November 2018 19:05
Target OS: Linux
Domoticz version: 2024.7
Location: Netherlands
Contact:

Re: Tuya Cloud Plugin [No custom firmware require]: Finally for Domoticz

Post by Xenomes »

The builder of the tuyaha library as added this to the readme. The tuyaha library is the base Tuya plugin.
My device is not listed in Tuya API response or contains incomplete state, what should I do?

Write an email to [email protected] and mention the tuyapy library and https://px1.tuya{}.com API endpoint. Usually they ignore incoming emails, but perhaps, if they get a lot of emails, they will start fixing the API.
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
schijndela
Posts: 17
Joined: Thursday 05 July 2018 19:36
Target OS: Raspberry Pi / ODroid
Domoticz version: V4.10717
Contact:

Re: Tuya Cloud Plugin [No custom firmware require]: Finally for Domoticz

Post by schijndela »

Thank you, I will send him / her an E-mail if feedback comes I will give an update.
schijndela
Posts: 17
Joined: Thursday 05 July 2018 19:36
Target OS: Raspberry Pi / ODroid
Domoticz version: V4.10717
Contact:

Re: Tuya Cloud Plugin [No custom firmware require]: Finally for Domoticz

Post by schijndela »

Hi Xenomes, you mention that I need to write an E-mail to tuya and mention the tuyapy library and the https link!? Is that enough information?!
Or do I need to add additional information from these Smart Sockets? if that's the case what kind of information of the Sockect they need?

Many thanks in advance for your reply.

Xenomes wrote: Tuesday 08 December 2020 21:51 The builder of the tuyaha library as added this to the readme. The tuyaha library is the base Tuya plugin.
My device is not listed in Tuya API response or contains incomplete state, what should I do?

Write an email to [email protected] and mention the tuyapy library and https://px1.tuya{}.com API endpoint. Usually they ignore incoming emails, but perhaps, if they get a lot of emails, they will start fixing the API.
famous
Posts: 4
Joined: Tuesday 08 December 2020 20:00
Target OS: NAS (Synology & others)
Domoticz version: 2020.2
Contact:

Re: Tuya Cloud Plugin [No custom firmware require]: Finally for Domoticz

Post by famous »

MrRikkie wrote: Tuesday 21 July 2020 17:59 Hi, one question does this plugin also work for a motion detector ? I do not know how the app will register this, in principle it’s a switch.
I tried today, but no succes with the LSC motion sensor from Action :(
If i run the debug_discovery it also noticed 0 devices ...
User avatar
Xenomes
Posts: 379
Joined: Tuesday 27 November 2018 19:05
Target OS: Linux
Domoticz version: 2024.7
Location: Netherlands
Contact:

Re: Tuya Cloud Plugin [No custom firmware require]: Finally for Domoticz

Post by Xenomes »

schijndela wrote: Friday 11 December 2020 16:45 Hi Xenomes, you mention that I need to write an E-mail to tuya and mention the tuyapy library and the https link!? Is that enough information?!
Or do I need to add additional information from these Smart Sockets? if that's the case what kind of information of the Sockect they need?

Many thanks in advance for your reply.
I wouldn't know either, I would mention brand and type of the device and the comment of PaulAnnekov.
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
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest