Page 4 of 26

Re: Python Plugin: TUYA

Posted: Monday 07 December 2020 10:18
by wkossen
Hi,

i am currently using the tuyaha based plugin. should i migrate to this one and if so, why, and if so, how?

does or will this support other devices than switches and lamps? I got a door sensor recently and would like to automate a lamp in a cupboard with it using domoticz.

Thanks

Re: Python Plugin: TUYA

Posted: Tuesday 08 December 2020 21:51
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.

Re: Python Plugin: TUYA

Posted: Thursday 10 December 2020 12:52
by TiXav
Hi Xenomes,

I saw 2 days ago that there is a new version of tuyaha librairy @ https://github.com/PaulAnnekov/tuyaha/commits/master
I uninstall pip3 tuyaha and I place the new librairy in the plugins folder because pip3 version is still at 0.08
It is working without error since 2 days

Regards

Re: Python Plugin: TUYA

Posted: Monday 14 December 2020 9:52
by LucVolders
Hi,
I bought some lamps and sockets both from the Action store and from Lild.
Action works on wifi and Lidl has a Zigbee hub.

I installed the Tuya APP on my android phone and from there I can
connect to both the Action and the Lidl devices. Works flawless.

Then I added the Python script to Domoticz (the original not the Xenomes version).
It works but only shows the Action (wifi) devices and not the Lidl (Zigbee devices).

Anyone any experience with this.

Luc

Re: Python Plugin: TUYA

Posted: Sunday 20 December 2020 16:36
by Rolandet
itguy78 wrote: Wednesday 24 June 2020 3:26
For Downloads/Install steps/Source see this link:
https://github.com/guino/tuyaha
Thanks for the script. Adding devices works just fine :D

I've added my blinds, and it shows up in the Switches tab. Unfortunately it's just OPEN/CLOSE
I've tried with 'Venetian blinds', which adds a "STOP ' button. But that button doesn't do anything.

Any suggestions on how to fix that?

tnx

Re: Python Plugin: TUYA

Posted: Sunday 20 December 2020 17:38
by martin82
can you tell us which type switch, you use to connect your blinds?

Re: Python Plugin: TUYA

Posted: Monday 21 December 2020 17:42
by gawel31
Hi Rolandet,
i had same problem. I made a manual scene into Smart Life that stops blind. When you make a manual scene into smart life, tuya plugin automatically make a device into domoticz....so now, it's easy to make a "stop button" !! ;)

Re: Python Plugin: TUYA

Posted: Monday 21 December 2020 17:53
by gawel31
hi,
This plugin is very useful! Thanks to his author! But i also need help. I have tuya switches for blinds. It works perfectly: up, down, stop, half open, etc...When i push "up button", Domoticz tells me that blind is open... It's OK. But one minute later, when tuya script run, blind is updated, and is now closed in domoticz (but open in reality) ! :( So all my blinds are always closed in domoticz... :( My brother has same problem, and an other user in domoticz french forum has also same problem. Could you help us please? Thanks ! ;)

edit: same problem with wifi plugs tuya

Re: Python Plugin: TUYA

Posted: Monday 21 December 2020 19:10
by Rolandet
gawel31 wrote: Monday 21 December 2020 17:42 Hi Rolandet,
i had same problem. I made a manual scene into Smart Life that stops blind. When you make a manual scene into smart life, tuya plugin automatically make a device into domoticz....so now, it's easy to make a "stop button" !! ;)
That works for me. Merci !

Re: Python Plugin: TUYA

Posted: Friday 25 December 2020 13:07
by GeorgeW
nice plugin, great job :-)
I'm solving a problem :
OS: Windows 10

Domoticz does not find light 'Smart Strip Light-rdjl' (Smart LED Zigbee MINI Strip Controller RGB LED Strip Light Controller TUYA)
after editing plugyn.py it will add to Domoticz:
*******************************************************************************************************************
if dev_type == "light":
..... etc.
else:
Domoticz.Device(Name=dev.name(), Unit=unit, Type=241, Subtype=2, Switchtype=7, DeviceID=dev.object_id()).Create()
Domoticz.Debug("No controls found for your light device!")
********************************************************************************************************************
Domoticz Devices:
TUYA Xenomes - Smart Strip Light-rdjl Color Switch RGB On

Domoticz log:
(TUYA Xenomes) DEV name=Smart Strip Light-rdjl state=True id=bf921bxxxxxx online=True
(TUYA Xenomes) Update 1:'On' (TUYA Xenomes - Smart Strip Light-rdjl) TimedOut=False

Domoticz change color. plugyn.py original ..... works on / off:
Error: (TUYA Xenomes) 'onCommand' failed 'TypeError':'int() argument must be a string, a bytes-like object or a number, not 'NoneType''.
Eror: (TUYA Xenomes) ----> Line 276 in 'C:\Program Files (x86)\Domoticz\plugins\Domoticz-TUYA-Plugin-master\plugin.py'
Error: (TUYA Xenomes) ----> Line 150 in 'C:\Program Files (x86)\Domoticz\plugins\Domoticz-TUYA-Plugin-master\plugin.py'
Error: (TUYA Xenomes) ----> Line 79 in 'C:\Program Files (x86)\Domoticz\plugins\Domoticz-TUYA-Plugin-master\tuyaha\devices\light.py'
(TUYA Xenomes) onCommand called for Unit 4: Parameter 'Set Color', Level: 15
(TUYA Xenomes) Sending command for DeviceID=bf921bxxxxxxxx
(TUYA Xenomes) color={'b': 98, 'cw': 0, 'g': 199, 'm': 3, 'r': 255, 't': 0, 'ww': 0} h=0.10721868365180466 s=0.615686274509804
Status: setcolbrightnessvalue: ID: 8, bri: 15, color: '{m: 3, RGB: ffc762, CWWW: 0000, CT: 0}'

Domoticz change color. plugyn.py edit .... works on / off and brightness not works color:
*******************************************************************************************************************
Domoticz.Debug("color="+str(rgb)+" h="+str(h)+" s="+str(s))
# If color changed
if Devices[Unit].Color != Hue:
# if mode == 3:
# dev.set_color( [ h*360, s*100 ] )
# Domoticz.Debug("Set color called")
# if mode == 2:
temp = round(2700+((6500-2700)/255*(255-t)))
Domoticz.Debug("temp = " + str(temp))
dev.set_color_temp( temp )
Domoticz.Debug("Set white called")
# If level changed
*******************************************************************************************************************
Domoticz change color:
(TUYA Xenomes) Sending command for DeviceID=bf921bxxxxxxxx
(TUYA Xenomes) color={'b': 107, 'cw': 0, 'g': 144, 'm': 3, 'r': 255, 't': 0, 'ww': 0} h=0.041666666666666664 s=0.5803921568627451
Status: setcolbrightnessvalue: ID: 8, bri: 15, color: '{m: 3, RGB: ff906b, CWWW: 0000, CT: 0}'
Status: setcolbrightnessvalue: ID: 8, bri: 15, color: '{m: 3, RGB: ff906b, CWWW: 0000, CT: 0}'

Domoticz change brightness
(TUYA Xenomes) onCommand called for Unit 4: Parameter 'Set Color', Level: 74
2020-12-25 12:47:12.082 (TUYA Xenomes) Sending command for DeviceID=bf921bxxxxxxxxxxxxxxx
2020-12-25 12:47:12.083 (TUYA Xenomes) color={'b': 106, 'cw': 0, 'g': 143, 'm': 3, 'r': 255, 't': 0, 'ww': 0} h=0.04138702460850112 s=0.5843137254901961
2020-12-25 12:47:12.084 (TUYA Xenomes) temp = 6500
2020-12-25 12:47:12.288 (TUYA Xenomes) Set white called
2020-12-25 12:47:12.471 (TUYA Xenomes) Set bright called

******************************************************************************************************************
debug_discovery.py :
'header': {'code': 'SUCCESS', 'payloadVersion': 1},
'payload': { 'devices': [ { 'data': { 'color_mode': 'colour',
'online': True,
'state': 'true'},
'dev_type': 'light',
'ha_type': 'light',
'icon': 'https://images.tuyaeu.com/smart/icon/ay ... fd4c91.png',
'id': 'bf921bxxxxxxxxxxxx',
'name': 'Smart Strip Light-rdjl'}, ..... etc.
1. debug_discovery.py isn't there an TUYA extension?
2. how to edit * .py win10? (notepad not exactly ideal :-))
3. some tool for monitoring communication TUYA and Android mobile?

thank you for answer
GW

Re: Python Plugin: TUYA

Posted: Wednesday 30 December 2020 16:56
by Rolandet
2. how to edit * .py win10? (notepad not exactly ideal :-))
Try Bash shell for windows.

Re: Python Plugin: TUYA

Posted: Wednesday 30 December 2020 21:28
by elbennito
tried this plugin to get my smart life "IR remote control" in domoticz. but I get this error; handleThread: you cannot auth exceed once in 60 seconds. looks Like smart life blocks if you check every 10 seconds the status of device. Anybdoy a solution? Or am I the only one with this problem?

Re: Python Plugin: TUYA

Posted: Monday 04 January 2021 22:00
by Meeki
I also have a problem with a led strip light and bulbs:

When i use the guino/tuyaha Plugin all devices are directed to a switch, but i cannot set lights temperature for the bulbs and color for the led strip.

But when i use the Xenomes/Domoticz-TUYA-Plugin i can set the color temperature for the bulb but the led strip is not assigned to a switch. Tried removing and addin several times.

2021-01-04 21:57:09.972 (Tuya nieuw) DEV name=Led Strip Lights state=True id=bfd13777feb40bfe129fcc online=True
2021-01-04 21:57:09.972 (Tuya nieuw) No controls found for your light device!

2021-01-04 21:57:09.972 (Tuya nieuw) DEV name=If Schema:08:00 Alle Dagen,\"Led Strip Lights\"On/Off:OFF state=False id=DwzAA2IUA6IRYXaN online=True
2021-01-04 21:57:09.972 (Tuya nieuw) DEV name=If Schema:19:00 Alle Dagen,\"Led Strip Lights\"On/Off:ON... state=False id=zWkFUoJotVjiIxB9 online=True
2021-01-04 21:57:19.685 (Tuya nieuw) onHeartbeat called time=1609793839.685206
2021-01-04 21:57:29.657 (Tuya nieuw) onHeartbeat called time=1609793849.6575963
2021-01-04 21:57:39.680 (Tuya nieuw) onHeartbeat called time=1609793859.6799166
2021-01-04 21:57:49.701 (Tuya nieuw) onHeartbeat called time=1609793869.7016788
2021-01-04 21:57:59.674 (Tuya nieuw) onHeartbeat called time=1609793879.6742349
2021-01-04 21:58:09.696 (Tuya nieuw) onHeartbeat called time=1609793889.6961265
2021-01-04 21:58:09.697 (Tuya nieuw) in handlethread
2021-01-04 21:58:09.946 (Tuya nieuw) DEV name=A60 806lm state=True id=30217610500291097a91 online=True
2021-01-04 21:58:09.947 (Tuya nieuw) DEV name=Led Strip Lights state=True id=bfd13777feb40bfe129fcc online=True
2021-01-04 21:58:09.947 (Tuya nieuw) No controls found for your light device!
2021-01-04 21:58:09.947 (Tuya nieuw) DEV name=If Schema:08:00 Alle Dagen,\"Led Strip Lights\"On/Off:OFF state=False id=DwzAA2IUA6IRYXaN online=True
2021-01-04 21:58:09.947 (Tuya nieuw) DEV name=If Schema:19:00 Alle Dagen,\"Led Strip Lights\"On/Off:ON... state=False id=zWkFUoJotVjiIxB9 online=True
2021-01-04 21:58:19.677 (Tuya nieuw) onHeartbeat called time=1609793899.6776757
2021-01-04 21:58:29.699 (Tuya nieuw) onHeartbeat called time=1609793909.6994908
2021-01-04 21:58:39.675 (Tuya nieuw) onHeartbeat called time=1609793919.6749253
2021-01-04 21:58:49.697 (Tuya nieuw) onHeartbeat called time=1609793929.6972575

Re: Python Plugin: TUYA

Posted: Monday 04 January 2021 23:55
by waltervl
Both plugins have been added to the Wiki Plugin list https://www.domoticz.com/wiki/Plugins (by me)

Re: Python Plugin: TUYA

Posted: Tuesday 05 January 2021 19:40
by Xenomes
Meeki wrote: Monday 04 January 2021 22:00 I also have a problem with a led strip light and bulbs:

When i use the guino/tuyaha Plugin all devices are directed to a switch, but i cannot set lights temperature for the bulbs and color for the led strip.

But when i use the Xenomes/Domoticz-TUYA-Plugin i can set the color temperature for the bulb but the led strip is not assigned to a switch. Tried removing and addin several times.

2021-01-04 21:57:09.972 (Tuya nieuw) DEV name=Led Strip Lights state=True id=bfd13777feb40bfe129fcc online=True
2021-01-04 21:57:09.972 (Tuya nieuw) No controls found for your light device!
Can you provide me with the json result of this script? debug_discovery.py

Re: Python Plugin: TUYA

Posted: Tuesday 05 January 2021 19:41
by Xenomes
waltervl wrote: Monday 04 January 2021 23:55 Both plugins have been added to the Wiki Plugin list https://www.domoticz.com/wiki/Plugins (by me)
Thnx! I couldn't make a account to edit the page, never tried it later.

Re: Python Plugin: TUYA

Posted: Wednesday 06 January 2021 20:43
by Meeki
Can you provide me with the json result of this script? debug_discovery.py
Can you explain me how to do this? don't know how to run the script.

Kind regards/Groeten

Dennis

Re: Python Plugin: TUYA

Posted: Wednesday 06 January 2021 21:37
by Xenomes
Meeki wrote: Wednesday 06 January 2021 20:43 Can you explain me how to do this? don't know how to run the script.

Kind regards/Groeten

Dennis
It is not difficult, edit the file and add you credentials and set it up as in Domoticz run it and post the output. edit it again and remove your credentials.

The setting to change:

Code: Select all

# CHANGE THIS - BEGGINING
USERNAME = ""
PASSWORD = ""
REGION = "eu" # cn, eu, us
COUNTRY_CODE = "1" # Your account country code, e.g., 1 for USA or 86 for China
BIZ_TYPE = "smart_life" # tuya, smart_life, jinvoo_smart

Re: Python Plugin: TUYA

Posted: Wednesday 06 January 2021 23:03
by rbosch
I have bought some Tuya Wifi based light bulbs. Added the plugin to Domoticz, but keep getting login errors.

Code: Select all

2021-01-06 22:59:30.658 Error: (Tuya) handleThread: Get accesstoken failed. Username or password error! line 194
Also ran the debug_discovery script - using exactly the same credentials - and that worked fine, producing a nice overview of all my devices.

Can anyone think of what goes wrong?

Re: Python Plugin: TUYA

Posted: Monday 11 January 2021 12:14
by rbosch
A few days later and it spontaneously started working. Probably an issue with too many authentication requests in a short timeframe.
Very happy with this plug-in!