Page 12 of 26

Re: Python Plugin: TUYA

Posted: Wednesday 14 April 2021 22:11
by Xenomes
This
EdwinK wrote: Wednesday 14 April 2021 22:04 Aaaaaaand....

it's back.
2021-04-14 22:01:32.027 Status: Tuya: (Tuya) Initialized version 1.0.6, author 'Wagner Oliveira'
2021-04-14 22:01:32.734 Error: Tuya: (Tuya) handleThread: login rate limited line 195
Just the second after restarting the plugin.
This a error from the Tuya api, the restart trigger a second login in a time period of 60 sec. I have a idea, I don't if it will work.

Re: Python Plugin: TUYA

Posted: Friday 16 April 2021 9:27
by manjh
What is the best way to switch a Tuya lamp from LUA? On/off and color temp?

Re: Python Plugin: TUYA

Posted: Friday 16 April 2021 20:40
by Xenomes
manjh wrote: Friday 16 April 2021 9:27 What is the best way to switch a Tuya lamp from LUA? On/off and color temp?
I use DzVents setColorBrightness(r, g, b, br, cw, ww, m, t)
https://www.domoticz.com/wiki/DzVents:_ ... .2FApplamp

Re: Python Plugin: TUYA

Posted: Friday 16 April 2021 20:43
by Xenomes
EdwinK wrote: Wednesday 14 April 2021 22:04
Xenomes wrote: Wednesday 14 April 2021 22:11 This a error from the Tuya api, the restart trigger a second login in a time period of 60 sec. I have a idea, I don't if it will work.
Made a new update there is now a start-up time out for 60 seconds to prevent the login in the same minute.

Re: Python Plugin: TUYA

Posted: Friday 16 April 2021 22:00
by EdwinK
Xenomes wrote: Friday 16 April 2021 20:43
EdwinK wrote: Wednesday 14 April 2021 22:04
Xenomes wrote: Wednesday 14 April 2021 22:11 This a error from the Tuya api, the restart trigger a second login in a time period of 60 sec. I have a idea, I don't if it will work.
Made a new update there is now a start-up time out for 60 seconds to prevent the login in the same minute.

Thanks. Will update and see ;)

Re: Python Plugin: TUYA

Posted: Friday 16 April 2021 22:18
by EdwinK
Updated to version 1.0.7, and now the error is:

2021-04-16 22:06:28.657 Error: Tuya: (Tuya) handleThread: Expecting value: line 1 column 1 (char 0) line 207
2021-04-16 22:06:37.243 Error: Tuya: (Tuya) handleThread: Expecting value: line 1 column 1 (char 0) line 207

Re: Python Plugin: TUYA

Posted: Saturday 17 April 2021 18:02
by Xenomes
EdwinK wrote: Friday 16 April 2021 22:18 Updated to version 1.0.7, and now the error is:

2021-04-16 22:06:28.657 Error: Tuya: (Tuya) handleThread: Expecting value: line 1 column 1 (char 0) line 207
2021-04-16 22:06:37.243 Error: Tuya: (Tuya) handleThread: Expecting value: line 1 column 1 (char 0) line 207
I can't recreate your error, change a command hopefully it will fix this error.

Re: Python Plugin: TUYA

Posted: Saturday 17 April 2021 20:59
by EdwinK
At the moment it isn't working at all :(
2021-04-17 20:57:42.154 Tuya: (Tuya) Waiting 60 seconds to connect TuyaApi login timeout
2021-04-17 20:57:48.895 Status: User: Admin (IP: 192.168.0.14) initiated a switch command (1039/Tuya - LED Strip RGB+W/On)
2021-04-17 20:58:16.088 Status: User: Admin (IP: 192.168.0.14) initiated a switch command (1039/Tuya - LED Strip RGB+W/On)
2021-04-17 20:58:36.160 Error: Tuya hardware (52) thread seems to have ended unexpectedly
2021-04-17 20:58:42.214 Tuya: (Tuya) TUYA plugin started
2021-04-17 20:58:42.214 Tuya: (Tuya) Debug logging mask set to: PYTHON CONNECTION
2021-04-17 20:58:42.214 Tuya: (Tuya) 'HardwareID':'52'
2021-04-17 20:58:42.214 Tuya: (Tuya) 'HomeFolder':'/home/pi/domoticz/plugins/TUYA/'
2021-04-17 20:58:42.214 Tuya: (Tuya) 'StartupFolder':'/home/pi/domoticz/'
2021-04-17 20:58:42.214 Tuya: (Tuya) 'UserDataFolder':'/home/pi/domoticz/'
2021-04-17 20:58:42.214 Tuya: (Tuya) 'Database':'/home/pi/domoticz/domoticz.db'
2021-04-17 20:58:42.214 Tuya: (Tuya) 'Language':'en'
2021-04-17 20:58:42.214 Tuya: (Tuya) 'Version':'1.0.6'

Re: Python Plugin: TUYA

Posted: Saturday 17 April 2021 21:12
by EdwinK
It seemst that the connector in the LED-string has brokken, so it might be that that is the problem. Not having another device to try it with.

Re: Python Plugin: TUYA

Posted: Saturday 17 April 2021 21:15
by Xenomes
EdwinK wrote: Saturday 17 April 2021 20:59 At the moment it isn't working at all :(
2021-04-17 20:57:42.154 Tuya: (Tuya) Waiting 60 seconds to connect TuyaApi login timeout
2021-04-17 20:57:48.895 Status: User: Admin (IP: 192.168.0.14) initiated a switch command (1039/Tuya - LED Strip RGB+W/On)
2021-04-17 20:58:16.088 Status: User: Admin (IP: 192.168.0.14) initiated a switch command (1039/Tuya - LED Strip RGB+W/On)
2021-04-17 20:58:36.160 Error: Tuya hardware (52) thread seems to have ended unexpectedly
2021-04-17 20:58:42.214 Tuya: (Tuya) TUYA plugin started
2021-04-17 20:58:42.214 Tuya: (Tuya) Debug logging mask set to: PYTHON CONNECTION
2021-04-17 20:58:42.214 Tuya: (Tuya) 'HardwareID':'52'
2021-04-17 20:58:42.214 Tuya: (Tuya) 'HomeFolder':'/home/pi/domoticz/plugins/TUYA/'
2021-04-17 20:58:42.214 Tuya: (Tuya) 'StartupFolder':'/home/pi/domoticz/'
2021-04-17 20:58:42.214 Tuya: (Tuya) 'UserDataFolder':'/home/pi/domoticz/'
2021-04-17 20:58:42.214 Tuya: (Tuya) 'Database':'/home/pi/domoticz/domoticz.db'
2021-04-17 20:58:42.214 Tuya: (Tuya) 'Language':'en'
2021-04-17 20:58:42.214 Tuya: (Tuya) 'Version':'1.0.6'
These are normal startup messages. Ps. you are on version 1.0.6 or didn't restart Domoticz after update.
EdwinK wrote: Saturday 17 April 2021 21:12 It seemst that the connector in the LED-string has brokken, so it might be that that is the problem. Not having another device to try it with.
That's not good ...

Re: Python Plugin: TUYA

Posted: Sunday 18 April 2021 11:53
by EdwinK
It said on the the hardware ta it is version 1.0.7 but since I have no Tuya stuff at the moment, cant' test it

Re: Python Plugin: TUYA

Posted: Sunday 18 April 2021 12:54
by manjh
Xenomes wrote: Friday 16 April 2021 20:40
manjh wrote: Friday 16 April 2021 9:27 What is the best way to switch a Tuya lamp from LUA? On/off and color temp?
I use DzVents setColorBrightness(r, g, b, br, cw, ww, m, t)
https://www.domoticz.com/wiki/DzVents:_ ... .2FApplamp
Good. That way I can set all lamps to the same color temperature. The color picker wheel just doesn't allow that kind of precision.

Re: Python Plugin: TUYA

Posted: Thursday 22 April 2021 12:27
by MacJL
Hello,

I have un problem while running this plug-in :

Code: Select all

2021-04-22 12:23:52.523 Tuya: (Tuya) TUYA plugin started
2021-04-22 12:23:52.523 Tuya: (Tuya) Debug logging mask set to: PYTHON PLUGIN QUEUE IMAGE DEVICE CONNECTION MESSAGE
2021-04-22 12:23:52.523 Tuya: (Tuya) 'HardwareID':'15'
2021-04-22 12:23:52.523 Tuya: (Tuya) 'HomeFolder':'/domoticz/plugins/Domoticz-TUYA-Plugin/'
2021-04-22 12:23:52.523 Tuya: (Tuya) 'StartupFolder':'/domoticz/'
2021-04-22 12:23:52.523 Tuya: (Tuya) 'UserDataFolder':'/domoticz/'
2021-04-22 12:23:52.523 Tuya: (Tuya) 'Database':'/config/domoticz.db'
2021-04-22 12:23:52.523 Tuya: (Tuya) 'Language':'fr'
2021-04-22 12:23:52.523 Tuya: (Tuya) 'Version':'1.0.7b'
2021-04-22 12:23:52.523 Tuya: (Tuya) 'Author':'Wagner Oliveira'
2021-04-22 12:23:52.523 Tuya: (Tuya) 'Name':'Tuya'
2021-04-22 12:23:52.524 Tuya: (Tuya) 'Port':'0'
2021-04-22 12:23:52.524 Tuya: (Tuya) 'Username':'******@******.***'
2021-04-22 12:23:52.524 Tuya: (Tuya) 'Password':'*************'
2021-04-22 12:23:52.524 Tuya: (Tuya) 'Key':'tuya'
2021-04-22 12:23:52.524 Tuya: (Tuya) 'Mode1':'33'
2021-04-22 12:23:52.524 Tuya: (Tuya) 'Mode2':'tuya'
2021-04-22 12:23:52.524 Tuya: (Tuya) 'Mode6':'-1'
2021-04-22 12:23:52.524 Tuya: (Tuya) 'DomoticzVersion':'2021.1'
2021-04-22 12:23:52.524 Tuya: (Tuya) 'DomoticzHash':'8547c5b7e'
2021-04-22 12:23:52.524 Tuya: (Tuya) 'DomoticzBuildTime':'2021-04-17 17:29:11'
2021-04-22 12:23:52.524 Tuya: (Tuya) Device count: 0
2021-04-22 12:23:52.525 Tuya: (Tuya) in handlethread
2021-04-22 12:23:52.577 Tuya: (Tuya) Pushing 'onHeartbeatCallback' on to queue
2021-04-22 12:23:52.627 (Tuya) Processing 'onHeartbeatCallback' message
2021-04-22 12:23:52.687 Tuya: (Tuya) Calling message handler 'onHeartbeat'.
2021-04-22 12:23:52.687 Tuya: (Tuya) onHeartbeat called time=1619087032.6875422
2021-04-22 12:23:52.687 Tuya: (Tuya) in handlethread
2021-04-22 12:23:53.915 Error: Tuya: (Tuya) handleThread: Expecting value: line 1 column 1 (char 0) line 207 
I'm running domoticz in a container, so with a minimal OS. Is there something missing?

Re: Python Plugin: TUYA

Posted: Thursday 22 April 2021 21:22
by Xenomes
MacJL wrote: Thursday 22 April 2021 12:27 Hello,

I have un problem while running this plug-in :

I'm running domoticz in a container, so with a minimal OS. Is there something missing?
Thanks for the include log, I saw the problem and create a fix. Please check version 1.0.8

Re: Python Plugin: TUYA

Posted: Thursday 22 April 2021 22:02
by MacJL
Xenomes wrote: Thursday 22 April 2021 21:22 Thanks for the include log, I saw the problem and create a fix. Please check version 1.0.8
Thank you. No more errors anymore!

But I don’t see my Tuya device in Domoticz. Device count stay at 0. I have a eMylo EAI-90 that I can control with Tuya App.
How can I check what is happening?

Re: Python Plugin: TUYA

Posted: Thursday 22 April 2021 22:17
by Xenomes
MacJL wrote: Thursday 22 April 2021 22:02
Xenomes wrote: Thursday 22 April 2021 21:22 Thanks for the include log, I saw the problem and create a fix. Please check version 1.0.8
Thank you. No more errors anymore!

But I don’t see my Tuya device in Domoticz. Device count stay at 0. I have a eMylo EAI-90 that I can control with Tuya App.
How can I check what is happening?
You can run the debug_discovery.py from the tools directory it will show if your device is detected by the tuyaapi.

Re: Python Plugin: TUYA

Posted: Thursday 22 April 2021 22:28
by MacJL
Here is the result :

Code: Select all

 Getting credentials
Got credentials
{   'access_token': 'EUxxxxx',
    'expires_in': 864000,
    'refresh_token': 'EUxxx',
    'token_type': 'bearer'}
Getting devices
Got devices
{   'header': {'code': 'SUCCESS', 'payloadVersion': 1},
    'payload': {'devices': [], 'scenes': []}}
!!! NOW REMOVE THIS FILE, SO YOUR CREDENTIALS (username, password) WON'T LEAK !!!
Does it mean the device is not supported ? Is that on Tuyaapi side, or Tuya side?

Re: Python Plugin: TUYA

Posted: Thursday 22 April 2021 22:44
by Xenomes
MacJL wrote: Thursday 22 April 2021 22:28 Here is the result :

Code: Select all

 Getting credentials
Got credentials
{   'access_token': 'EUxxxxx',
    'expires_in': 864000,
    'refresh_token': 'EUxxx',
    'token_type': 'bearer'}
Getting devices
Got devices
{   'header': {'code': 'SUCCESS', 'payloadVersion': 1},
    'payload': {'devices': [], 'scenes': []}}
!!! NOW REMOVE THIS FILE, SO YOUR CREDENTIALS (username, password) WON'T LEAK !!!
Does it mean the device is not supported ? Is that on Tuyaapi side, or Tuya side?
Sorry the device is not supported by api of Tuya. Result devices': [],
The only thing what you can do is https://github.com/Xenomes/Domoticz-TUY ... hould-i-do

Re: Python Plugin: TUYA

Posted: Thursday 22 April 2021 22:50
by MacJL
Xenomes wrote: Thursday 22 April 2021 22:44 Sorry the device is not supported by api of Tuya. Result devices': [],
The only thing what you can do is https://github.com/Xenomes/Domoticz-TUY ... hould-i-do
Thank you for your help.
What’s frustrating, is that I can control this device with the tuyaapi project. Does someone know if there is an other maintained Domoticz plug-in that use this API instead of tuyaha ?

Re: Python Plugin: TUYA

Posted: Saturday 24 April 2021 17:32
by MacJL
For those who are interested, I just found a workaround... ...by developing my own plugin!

As this Tuya device was supported by an Homebridge plugin, I developed a Domoticz plugin to get infos and control Homebridge in Insecure mode.
https://github.com/macjl/Domoticz-HomekitInsecureClient

Now I’m able to switch on and off this Tuya Devive from Domoticz!