[REQUEST] Plugin for Tuya

Python and python framework

Moderator: leecollings

mike14
Posts: 1
Joined: Sunday 05 January 2020 19:55
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: [REQUEST] Plugin for Tuya

Post by mike14 »

I have the exact dame issue. I see you need to add version 3.3 next to the localkey and devid. Hope someone can edit the plug-in files and send them here.
User avatar
FearNaBoinne
Posts: 144
Joined: Tuesday 30 April 2019 10:08
Target OS: Linux
Domoticz version: 2021.1
Location: Sector 0
Contact:

Re: [REQUEST] Plugin for Tuya

Post by FearNaBoinne »

I have almost got the RGB plugin working with the 3.3 protocol... There's more to adjust than just the version... Message formats are slightly different, etc. Just don't have enough time to work on it all the time! :(

I will share mine once it works!
RasPi, Raspbian , Domoticz v2021.1, Z-Wave Stick, RFLink, RFXtrx433e, Hue, Tuya (Tasmota/Mosquitto with Discovery), ESP(easy), MySensors.org, OTGW
tgunator
Posts: 3
Joined: Monday 18 November 2019 16:04
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: [REQUEST] Plugin for Tuya

Post by tgunator »

FearNaBoinne wrote: Sunday 05 January 2020 21:14 I have almost got the RGB plugin working with the 3.3 protocol... There's more to adjust than just the version... Message formats are slightly different, etc. Just don't have enough time to work on it all the time! :(

I will share mine once it works!
Waiting... :roll:
User avatar
FearNaBoinne
Posts: 144
Joined: Tuesday 30 April 2019 10:08
Target OS: Linux
Domoticz version: 2021.1
Location: Sector 0
Contact:

Re: [REQUEST] Plugin for Tuya

Post by FearNaBoinne »

tgunator wrote: Tuesday 14 January 2020 12:59
FearNaBoinne wrote: Sunday 05 January 2020 21:14 I have almost got the RGB plugin working with the 3.3 protocol... There's more to adjust than just the version... Message formats are slightly different, etc. Just don't have enough time to work on it all the time! :(

I will share mine once it works!
Waiting... :roll:
So am I! :lol:
RasPi, Raspbian , Domoticz v2021.1, Z-Wave Stick, RFLink, RFXtrx433e, Hue, Tuya (Tasmota/Mosquitto with Discovery), ESP(easy), MySensors.org, OTGW
User avatar
ledfreak3d
Posts: 98
Joined: Sunday 01 November 2015 15:30
Target OS: Linux
Domoticz version: 3.8025
Location: Hoorn
Contact:

Re: [REQUEST] Plugin for Tuya

Post by ledfreak3d »

Keeping an eye on this one
Unleashe the magic smoke ;)
southmind
Posts: 11
Joined: Wednesday 22 January 2020 10:07
Target OS: Raspberry Pi / ODroid
Domoticz version: 2023.2 -
Location: French Riviera
Contact:

Re: [REQUEST] Plugin for Tuya

Post by southmind »

Hello all. New here and new to Domoticz... I installed this plugin : https://github.com/iasmanis/Domoticz-Tu ... tat-Plugin. My Domoticz (on RPI4) works well with Hue lamps, some other zigbee devices, Netatmo meteo station ... I own a thermostat MOES 16A-002BB-WiFi and try to use it with Domoticz. The plugin works well with Domoticz, I see connexion in Logs , but the temperatures values are always to 0...

Here the log (I removed data containing devID and Local key values)
2020-01-22 10:30:57.232 (Thermostat Chambre) Debug logging mask set to: PYTHON PLUGIN QUEUE IMAGE DEVICE CONNECTION MESSAGE ALL
2020-01-22 10:30:57.232 (Thermostat Chambre) onStart called
2020-01-22 10:30:57.232 (Thermostat Chambre) Pushing 'ConnectDirective' on to queue
2020-01-22 10:30:57.232 (Thermostat Chambre) Processing 'ConnectDirective' message
2020-01-22 10:30:57.232 (Thermostat Chambre) Protocol for 'Tuya' not specified, 'None' assumed.
2020-01-22 10:30:57.232 (Thermostat Chambre) Transport set to: 'TCP/IP', 192.168.1.51:6668.
2020-01-22 10:30:57.232 (Thermostat Chambre) Connect directive received, action initiated successfully.
2020-01-22 10:30:57.297 (Thermostat Chambre) Pushing 'onConnectCallback' on to queue
2020-01-22 10:30:57.333 (Thermostat Chambre) Processing 'onConnectCallback' message
2020-01-22 10:30:57.333 (Thermostat Chambre) Calling message handler 'onConnect'.
2020-01-22 10:30:57.333 (Thermostat Chambre) Connected successfully to: 192.168.1.51:6668
2020-01-22 10:30:57.333 (Thermostat Chambre) Pushing 'WriteDirective' on to queue
2020-01-22 10:30:57.333 (Thermostat Chambre) Processing 'WriteDirective' message
2020-01-22 10:30:57.333 (Thermostat Chambre) Sending 86 bytes of data

2020-01-22 10:30:57.099 Status: (Thermostat Chambre) Started.
2020-01-22 10:30:57.230 Status: (Thermostat Chambre) Entering work loop.
2020-01-22 10:30:57.230 Status: (Thermostat Chambre) Initialized version 3.0.0, author 'iasmanis'

Any idea ?
Version: 2023.2
User avatar
FearNaBoinne
Posts: 144
Joined: Tuesday 30 April 2019 10:08
Target OS: Linux
Domoticz version: 2021.1
Location: Sector 0
Contact:

Re: [REQUEST] Plugin for Tuya

Post by FearNaBoinne »

Honesty required me to do this disclosure...

Yesterday I have tried reflashing one of my tuya plugs with Tasmota using tuya-convert to do OTA firmware replacement, and I have to say, it went remarkably well and easy!

Added it to my Mosquitto, added a virtual switch and it just works™

So if this also works for my other devices (filament bulb and RGBW lightstrip), I will probably abandon all the work required on getting the TUYA plugin to work for 3.3!

If that happens I will share what I did so far, but cannot guarantee I will do any more work on it! As you can see from my speed of responding, I just don't have a lot of free time to do this stuff! I haven't gamed in months because I don't have the time, andthe few times when I do have a bit of time, I don't have energy left to do anything that costs more than a low effort involvement!
RasPi, Raspbian , Domoticz v2021.1, Z-Wave Stick, RFLink, RFXtrx433e, Hue, Tuya (Tasmota/Mosquitto with Discovery), ESP(easy), MySensors.org, OTGW
User avatar
Xenomes
Posts: 379
Joined: Tuesday 27 November 2018 19:05
Target OS: Linux
Domoticz version: 2024.7
Location: Netherlands
Contact:

Re: [REQUEST] Plugin for Tuya

Post by Xenomes »

Thanks for your sacrifice, i hope you will share you findings so that the Tuya(realtek chip) users can benefit from it.
I have personal a LSC E27 RBGW in use with the latest version of the Tuya plugin and updated pytuya forced to 3.3. The other LSC Smart Connect slimme filament-ledlamp and multicolor ledstrip are freed from the cloud. :D
The current script generating several error and can only control the RGB and not the W channel.

Code: Select all

2020-01-23 10:10:38.209 Error: (Tuya SmartBulb) No transport, write directive to 'Tuya' ignored.
2020-01-23 10:11:06.833 Error: (Tuya SmartBulb): Async Read Exception (192.168.100.112:6668): 104, Connection reset by peer
2020-01-23 10:13:21.097 Error: handleWrite: Exception thrown: 'write: Broken pipe' 
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
southmind
Posts: 11
Joined: Wednesday 22 January 2020 10:07
Target OS: Raspberry Pi / ODroid
Domoticz version: 2023.2 -
Location: French Riviera
Contact:

Re: [REQUEST] Plugin for Tuya

Post by southmind »

southmind wrote: Wednesday 22 January 2020 10:36 Hello all. New here and new to Domoticz... I installed this plugin : https://github.com/iasmanis/Domoticz-Tu ... tat-Plugin. My Domoticz (on RPI4) works well with Hue lamps, some other zigbee devices, Netatmo meteo station ... I own a thermostat MOES 16A-002BB-WiFi and try to use it with Domoticz. The plugin works well with Domoticz, I see connexion in Logs , but the temperatures values are always to 0...

blah blah....
Well in fact, my model is more a BHT-002 GBWP with both internal and external sensors (floor heating).
I believe the problem came from tuya protocol version used in the plugin AND additional fields of my thermostats.

I did some successful tests with python scripts I wrote, so I think I will stop to try to use this plugin,
and "just" have to write py scripts for my needs...
Version: 2023.2
deennoo
Posts: 784
Joined: Wednesday 10 December 2014 13:06
Target OS: Linux
Domoticz version: beta
Location: Bordeaux France
Contact:

Re: [REQUEST] Plugin for Tuya

Post by deennoo »

Xenomes wrote:Thanks for your sacrifice, i hope you will share you findings so that the Tuya(realtek chip) users can benefit from it.
I have personal a LSC E27 RBGW in use with the latest version of the Tuya plugin and updated pytuya forced to 3.3. The other LSC Smart Connect slimme filament-ledlamp and multicolor ledstrip are freed from the cloud. :D
The current script generating several error and can only control the RGB and not the W channel.

Code: Select all

2020-01-23 10:10:38.209 Error: (Tuya SmartBulb) No transport, write directive to 'Tuya' ignored.
2020-01-23 10:11:06.833 Error: (Tuya SmartBulb): Async Read Exception (192.168.100.112:6668): 104, Connection reset by peer
2020-01-23 10:13:21.097 Error: handleWrite: Exception thrown: 'write: Broken pipe' 
I use to have the same error when smartlife is open, check this.

How did you force 3.3?
Domoticz stable 3.5877 for real & Domoticz beta for test
Rfxtrxe / RFLink / Milight / Yeelight / Tasmota / MQTT / BLE / Zigate
http://domo-attitude.fr
User avatar
Xenomes
Posts: 379
Joined: Tuesday 27 November 2018 19:05
Target OS: Linux
Domoticz version: 2024.7
Location: Netherlands
Contact:

Re: [REQUEST] Plugin for Tuya

Post by Xenomes »

deennoo wrote: Friday 24 January 2020 19:38 How did you force 3.3?
In the 'pytuya' directory, edit '__init__.py' search 'self.version' change 3.1 to 3.3 and save.
I don't if this is the right way, putting "device.set_version(3.3)" in the script did not work for me.
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
FearNaBoinne
Posts: 144
Joined: Tuesday 30 April 2019 10:08
Target OS: Linux
Domoticz version: 2021.1
Location: Sector 0
Contact:

Re: [REQUEST] Plugin for Tuya

Post by FearNaBoinne »

FearNaBoinne wrote: Thursday 23 January 2020 10:46 Honesty required me to do this disclosure...

Yesterday I have tried reflashing one of my tuya plugs with Tasmota using tuya-convert to do OTA firmware replacement, and I have to say, it went remarkably well and easy!

Added it to my Mosquitto, added a virtual switch and it just works™

So if this also works for my other devices (filament bulb and RGBW lightstrip), I will probably abandon all the work required on getting the TUYA plugin to work for 3.3!

If that happens I will share what I did so far, but cannot guarantee I will do any more work on it! As you can see from my speed of responding, I just don't have a lot of free time to do this stuff! I haven't gamed in months because I don't have the time, andthe few times when I do have a bit of time, I don't have energy left to do anything that costs more than a low effort involvement!
Filament bulb and RGBWZ ledstrip working too...

Tuya-convert + TASMOTA + MQTT with Discovery Plugin == bliss!
(You do have to find the correct template information, but for most of these that is already listed!)
RasPi, Raspbian , Domoticz v2021.1, Z-Wave Stick, RFLink, RFXtrx433e, Hue, Tuya (Tasmota/Mosquitto with Discovery), ESP(easy), MySensors.org, OTGW
deennoo
Posts: 784
Joined: Wednesday 10 December 2014 13:06
Target OS: Linux
Domoticz version: beta
Location: Bordeaux France
Contact:

Re: [REQUEST] Plugin for Tuya

Post by deennoo »

I'm ok with tasmota fw + plugin. I run most sonoff and now LSC plug and led strip.

Only problem is that mqtt Discovery plugin update device even if there is no change
Domoticz stable 3.5877 for real & Domoticz beta for test
Rfxtrxe / RFLink / Milight / Yeelight / Tasmota / MQTT / BLE / Zigate
http://domo-attitude.fr
User avatar
FearNaBoinne
Posts: 144
Joined: Tuesday 30 April 2019 10:08
Target OS: Linux
Domoticz version: 2021.1
Location: Sector 0
Contact:

Re: [REQUEST] Plugin for Tuya

Post by FearNaBoinne »

deennoo wrote: Saturday 25 January 2020 18:29 Only problem is that mqtt Discovery plugin update device even if there is no change
What do you mean, it updates device even if there is no change?
RasPi, Raspbian , Domoticz v2021.1, Z-Wave Stick, RFLink, RFXtrx433e, Hue, Tuya (Tasmota/Mosquitto with Discovery), ESP(easy), MySensors.org, OTGW
RezaRose
Posts: 65
Joined: Sunday 09 February 2020 11:34
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Holland
Contact:

Re: [REQUEST] Plugin for Tuya

Post by RezaRose »

Does anyone has a working way of getting the key of tuya devices? I tried bluestacks, but i cant open the xml file. I tried install a older version of tuya, but i cant install it on bluestacks. I tried to sign up as a developer at tuya but the tuya cli does not work.

With the prooxy i also cant get the keys. Is there a way that works? What did work for u guys?
Raspberry Pi 4 - Raspbian bullseye - Python 3.9 - stable
Dashticz on apache2 - Mqqt - node red
Zigate - USB Tll - Philips hue - Ikea - Innr - Xiaomi - TPlink - Nest -v3
User avatar
Xenomes
Posts: 379
Joined: Tuesday 27 November 2018 19:05
Target OS: Linux
Domoticz version: 2024.7
Location: Netherlands
Contact:

Re: [REQUEST] Plugin for Tuya

Post by Xenomes »

The app 'packet capture' for android did the trick for me.
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
FearNaBoinne
Posts: 144
Joined: Tuesday 30 April 2019 10:08
Target OS: Linux
Domoticz version: 2021.1
Location: Sector 0
Contact:

Re: [REQUEST] Plugin for Tuya

Post by FearNaBoinne »

southmind wrote: Wednesday 22 January 2020 10:36 Hello all. New here and new to Domoticz... I installed this plugin : https://github.com/iasmanis/Domoticz-Tu ... tat-Plugin. My Domoticz (on RPI4) works well with Hue lamps, some other zigbee devices, Netatmo meteo station ... I own a thermostat MOES 16A-002BB-WiFi and try to use it with Domoticz. The plugin works well with Domoticz, I see connexion in Logs , but the temperatures values are always to 0...

Here the log (I removed data containing devID and Local key values)
2020-01-22 10:30:57.232 (Thermostat Chambre) Debug logging mask set to: PYTHON PLUGIN QUEUE IMAGE DEVICE CONNECTION MESSAGE ALL
2020-01-22 10:30:57.232 (Thermostat Chambre) onStart called
2020-01-22 10:30:57.232 (Thermostat Chambre) Pushing 'ConnectDirective' on to queue
2020-01-22 10:30:57.232 (Thermostat Chambre) Processing 'ConnectDirective' message
2020-01-22 10:30:57.232 (Thermostat Chambre) Protocol for 'Tuya' not specified, 'None' assumed.
2020-01-22 10:30:57.232 (Thermostat Chambre) Transport set to: 'TCP/IP', 192.168.1.51:6668.
2020-01-22 10:30:57.232 (Thermostat Chambre) Connect directive received, action initiated successfully.
2020-01-22 10:30:57.297 (Thermostat Chambre) Pushing 'onConnectCallback' on to queue
2020-01-22 10:30:57.333 (Thermostat Chambre) Processing 'onConnectCallback' message
2020-01-22 10:30:57.333 (Thermostat Chambre) Calling message handler 'onConnect'.
2020-01-22 10:30:57.333 (Thermostat Chambre) Connected successfully to: 192.168.1.51:6668
2020-01-22 10:30:57.333 (Thermostat Chambre) Pushing 'WriteDirective' on to queue
2020-01-22 10:30:57.333 (Thermostat Chambre) Processing 'WriteDirective' message
2020-01-22 10:30:57.333 (Thermostat Chambre) Sending 86 bytes of data

2020-01-22 10:30:57.099 Status: (Thermostat Chambre) Started.
2020-01-22 10:30:57.230 Status: (Thermostat Chambre) Entering work loop.
2020-01-22 10:30:57.230 Status: (Thermostat Chambre) Initialized version 3.0.0, author 'iasmanis'

Any idea ?
I got myself one of these thermostats and installed the plugin. AFAICT the plugin doesn't handle protocol 3.3 at all. When you use tuya-cli get with the protocol version 3.3, you do get valid numbers.
Again - as usual - all these pytuya based plugins are poorly maintained, and none actually support the new 3.3 protocol version.

When I see messages like these in the debug:

Code: Select all

2020-02-15 12:13:22.403 (Floorthermostat #1) Got non dps response: b'\x00\x00U\xaa\x00\x00\x00\x00\x00\x00\x00\n\x00\x00\x00|\x00\x00\x00\x00\tN\x94\xb7c\xdd\xd8\xfd\x9a\xd0H\x91\xfd\xbfm\xcd|\xa3\xd3\xd0ux\xa5\x0b7\xcc\xf9\x0f\x8c\x93!^\xaa\xf2a\xa8T\n\xf6@s\xe9\xe8\xe6`bU\x0c\xb9\xb7\x16\xeb"\x96k\xe9|\x81\x1a\x9aN\xca\x94\xa7\x93\xd4)\xe3\\n\x9d\x1d\xf1\xa9Y\xa4Y\xcaclb\x89\xd8^h~Z>\x9f\x17\x9e\xeb\x99\xa1\x99\\\r\x97\x89\x7f\xb8O\xba\x91\xe02\xe2\xa6\xda\xfd\x9bE\\Kh\xa0\x00\x00\xaaU', probably set response 
I get spontaneous headaches...

Additionally iasmanis has turned off 'issues' in his fork, so you cannot even discuss issues with him... He apparently is only interested in ready made fixes in the form of PULL requests...

I am still wondering why tuya-cli handles 3.3 just fine, and there's such a big issue with python-tuya... :(
RasPi, Raspbian , Domoticz v2021.1, Z-Wave Stick, RFLink, RFXtrx433e, Hue, Tuya (Tasmota/Mosquitto with Discovery), ESP(easy), MySensors.org, OTGW
RezaRose
Posts: 65
Joined: Sunday 09 February 2020 11:34
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Holland
Contact:

Re: [REQUEST] Plugin for Tuya

Post by RezaRose »

Xenomes wrote: Sunday 09 February 2020 20:56 The app 'packet capture' for android did the trick for me.
That does not work anymore... :(
Raspberry Pi 4 - Raspbian bullseye - Python 3.9 - stable
Dashticz on apache2 - Mqqt - node red
Zigate - USB Tll - Philips hue - Ikea - Innr - Xiaomi - TPlink - Nest -v3
User avatar
gielie
Posts: 290
Joined: Tuesday 12 January 2016 11:40
Target OS: Raspberry Pi / ODroid
Domoticz version: latest β
Location: The Netherlands (Alkmaar)
Contact:

Re: [REQUEST] Plugin for Tuya

Post by gielie »

Id like to add my tuya smart plugs to my domoticz setup. I installed the python plugin but I need the dev id and local key, how dpi get this?
I read the tuya-cli but I can’t figure out how to do this. What do I need for this? I created an dev account but still I can’t figure out howto connect to the plug and extract the keys I need.

Can someone help me with this?
- Aeon Labs USB Stick met Z-wave plus
- Aeotec MultiSensor 6
- FIBARO FGS223
- FIBARO FGWPE Wall Plug
- Neo CoolCam Power plug
- Popp Smoke Detector
- Toon
- Kodi Media Server
User avatar
FearNaBoinne
Posts: 144
Joined: Tuesday 30 April 2019 10:08
Target OS: Linux
Domoticz version: 2021.1
Location: Sector 0
Contact:

Re: [REQUEST] Plugin for Tuya

Post by FearNaBoinne »

1) Download Tuya-Cli latest version
2) Create account on iot.tuya.com
3) Request API Access
4) Create Application API profile
5) Wait for API Access approval
6) Record API ID and key provided by Tuya
7) Put device in pairing mode (quick flash)
8) Run tuya-cli:

Code: Select all

tuya-cli link --api-key [your API ID] --api-secret [your API key] --schema [name of App API profile] --ssid [your WiFi name] --password [your WiFi Pass] -t [your timezone in linux format] -r [your region]
where timezone is in the format 'Europe/Berlin'
where region is EU/AZ/US

After a while the device should stop blinking, and less then a minute after that the app should spit out the type, id, key and name of the device

Make sure the device you're running tuya-cli on is on a 2.4Ghz WLAN, and if it has multiple network devices, disable all but the WiFi you're using!
RasPi, Raspbian , Domoticz v2021.1, Z-Wave Stick, RFLink, RFXtrx433e, Hue, Tuya (Tasmota/Mosquitto with Discovery), ESP(easy), MySensors.org, OTGW
Post Reply

Who is online

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