Page 17 of 19

Re: [REQUEST] Plugin for Tuya

Posted: Sunday 05 January 2020 19:59
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.

Re: [REQUEST] Plugin for Tuya

Posted: Sunday 05 January 2020 21:14
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!

Re: [REQUEST] Plugin for Tuya

Posted: Tuesday 14 January 2020 12:59
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:

Re: [REQUEST] Plugin for Tuya

Posted: Saturday 18 January 2020 20:50
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:

Re: [REQUEST] Plugin for Tuya

Posted: Monday 20 January 2020 11:54
by ledfreak3d
Keeping an eye on this one

Re: [REQUEST] Plugin for Tuya

Posted: Wednesday 22 January 2020 10:36
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 ?

Re: [REQUEST] Plugin for Tuya

Posted: Thursday 23 January 2020 10:46
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!

Re: [REQUEST] Plugin for Tuya

Posted: Thursday 23 January 2020 11:22
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' 

Re: [REQUEST] Plugin for Tuya

Posted: Thursday 23 January 2020 18:35
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...

Re: [REQUEST] Plugin for Tuya

Posted: Friday 24 January 2020 19:38
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?

Re: [REQUEST] Plugin for Tuya

Posted: Friday 24 January 2020 19:47
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.

Re: [REQUEST] Plugin for Tuya

Posted: Saturday 25 January 2020 17:42
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!)

Re: [REQUEST] Plugin for Tuya

Posted: Saturday 25 January 2020 18:29
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

Re: [REQUEST] Plugin for Tuya

Posted: Monday 27 January 2020 0:17
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?

Re: [REQUEST] Plugin for Tuya

Posted: Sunday 09 February 2020 15:54
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?

Re: [REQUEST] Plugin for Tuya

Posted: Sunday 09 February 2020 20:56
by Xenomes
The app 'packet capture' for android did the trick for me.

Re: [REQUEST] Plugin for Tuya

Posted: Saturday 15 February 2020 12:18
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... :(

Re: [REQUEST] Plugin for Tuya

Posted: Thursday 20 February 2020 13:11
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... :(

Re: [REQUEST] Plugin for Tuya

Posted: Friday 21 February 2020 20:28
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?

Re: [REQUEST] Plugin for Tuya

Posted: Friday 21 February 2020 21:45
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!