Page 13 of 19
Re: [REQUEST] Plugin for Tuya
Posted: Thursday 08 August 2019 15:34
by merlot
Hi,
If the devID ànd localkey are correct, you might have a different device and you'll have to investigate further.
For instance try to print the data you receive
Enviado desde mi Redmi Note 4 mediante Tapatalk
Re: [REQUEST] Plugin for Tuya
Posted: Friday 09 August 2019 22:23
by Loky31
Hello all,
Many Thanks for the work performed.
By any chance, will i be able to command, with the plugin, the following switch :
https://m.ru.aliexpress.com/item/32963064005.html
Thanks in avance for the answer
Re: [REQUEST] Plugin for Tuya
Posted: Saturday 10 August 2019 13:16
by sincze
Nice job!
As I don't have any devices of these kind I was unable to contribute.
Build the plugin for a friend.
I guess a pull request with modified source would be preferred in this case?
So we can keep wild growth of plugins under control
?
Re: [REQUEST] Plugin for Tuya
Posted: Saturday 10 August 2019 14:33
by merlot
Hello,
I don't know. It's adapted for some plugs, with measurement option. A switch, if the protocol is the same, perhaps it works, but I can't say
Thank you
Enviado desde mi Redmi Note 4 mediante Tapatalk
Re: [REQUEST] Plugin for Tuya
Posted: Saturday 10 August 2019 14:36
by merlot
sincze wrote:Nice job!
As I don't have any devices of these kind I was unable to contribute.
Build the plugin for a friend.
I guess a pull request with modified source would be preferred in this case?
So we can keep wild growth of plugins under control
?
It should be tested for previous plugs, where your plugin worked, before pulling.
Meanwhile, I'm trying to improve and define some actions after connections errors or timeouts.
Thanks
Enviado desde mi Redmi Note 4 mediante Tapatalk
Re: [REQUEST] Plugin for Tuya
Posted: Sunday 11 August 2019 13:57
by Loky31
Many Thanks for the answer.
Is an évolution to support this kind of switch to be supported ?
Someone would kindly do that please ?
Many Thanks
Re: [REQUEST] Plugin for Tuya
Posted: Friday 16 August 2019 9:34
by EmileD
I received my Lonsonho smart plug and installed the necessary tools for Domoticz. I connected the Smart plug to Smart life and want to connect the smart plug to Domoticz. Can anyone tell where I can find the local key? Maybe @dorenberg?
Re: [REQUEST] Plugin for Tuya
Posted: Friday 16 August 2019 11:23
by merlot
I think that in the pytuya readme you can see some options.
I'have used PacketCapture app in my android device, capturing packets from SmartLife app and searching in the packets for the keys or DPS.
Enviado desde mi Redmi Note 4 mediante Tapatalk
Re: [REQUEST] Plugin for Tuya
Posted: Wednesday 21 August 2019 12:51
by bce626
Question involving Tuya Bulp pluging, is this suitable for the LED strip of Tuya? I have tried linking it only I get an asychroon error message. Have the app shut down and the voltage is on it.
Re: [REQUEST] Plugin for Tuya
Posted: Wednesday 21 August 2019 17:42
by Loky31
merlot wrote: ↑Friday 16 August 2019 11:23
I think that in the pytuya readme you can see some options.
I'have used PacketCapture app in my android device, capturing packets from SmartLife app and searching in the packets for the keys or DPS.
Enviado desde mi Redmi Note 4 mediante Tapatalk
By any chance, can you give more detail on how you did that please?
Edit: I find a way with packet capture to get there... Unfortunately it seems that the plugin does not work for this switch :
https://fr.aliexpress.com/item/32963064 ... 6c37ymRV73
I tried to consider it as 3 plugs (for the 3 buttons) but seems something went wrong with the DevID...
Re: [REQUEST] Plugin for Tuya
Posted: Friday 23 August 2019 15:34
by AllesVanZelf
Hello,
I have a Toya RGB lightbulb. bought at Action (the Netherlands €7) as LSC Smart Connect. There is a whole lot of different products now in that name. Including sirene en powerplug.
I did some research and found out that port 6668 was open and discovered that this probably is a Tuya device. LSC has it's own app, but the Tuya app is working well too.
I tried the tixi's github python plugin:
Domoticz-Tuya-SmartBulb-Plugin
recovered the device id and local key with proxy "tuya-cli list app"
With debug to true, I get:
Code: Select all
2019-08-23 15:32:52.100 (SmartLamp) Sending 195 bytes of data
2019-08-23 15:32:52.100 (SmartLamp) 00 00 55 aa 00 00 00 00 00 00 00 07 00 00 00 b3 33 2e 31 36 ..U�...........�3.16
2019-08-23 15:32:52.100 (SmartLamp) 37 62 64 32 31 35 30 61 34 35 30 37 30 66 37 6c 73 31 2f 39 7bd2150a45070f7ls1/9
2019-08-23 15:32:52.100 (SmartLamp) 30 4e 4e 6d 76 5a 45 34 65 37 68 69 56 67 64 68 71 42 52 35 0NNmvZE4e7hiVgdhqBR5
2019-08-23 15:32:52.100 (SmartLamp) 56 58 68 4e 4a 55 66 7a 39 34 68 67 75 79 74 78 42 57 6e 39 VXhNJUfz94hguytxBWn9
2019-08-23 15:32:52.100 (SmartLamp) 44 5a 42 5a 4d 33 55 57 62 4b 4e 4c 4e 43 58 54 6c 36 63 44 DZBZM3UWbKNLNCXTl6cD
2019-08-23 15:32:52.100 (SmartLamp) 69 34 42 4a 4a 73 34 79 36 30 76 58 46 72 44 49 30 45 59 5a i4BJJs4y60vXFrDI0EYZ
2019-08-23 15:32:52.100 (SmartLamp) 4b 42 52 35 56 58 68 4e 4a 55 66 7a 39 34 68 67 75 79 74 78 KBR5VXhNJUfz94hguytx
2019-08-23 15:32:52.100 (SmartLamp) 42 55 38 6b 49 54 54 51 32 58 68 39 39 79 71 75 54 4d 53 41 BU8kITTQ2Xh99yquTMSA
2019-08-23 15:32:52.100 (SmartLamp) 78 57 50 36 4f 49 65 35 6f 43 70 63 64 70 78 5a 59 41 62 49 xWP6OIe5oCpcdpxZYAbI
2019-08-23 15:32:52.100 (SmartLamp) 4a 31 71 6c 77 3d 3d 0b d0 93 c1 00 00 aa 55 .. .. .. .. .. J1qlw==.Г�..�U
2019-08-23 15:32:52.100 (SmartLamp) Processing 'WriteDirective' message
2019-08-23 15:32:52.100 (SmartLamp) Sending 90 bytes of data
2019-08-23 15:32:52.100 (SmartLamp) 00 00 55 aa 00 00 00 00 00 00 00 0a 00 00 00 4a 7b 22 64 65 ..U�...........J{"de
2019-08-23 15:32:52.100 (SmartLamp) 76 49 64 22 3a 22 62 66 38 65 62 64 64 62 34 62 66 34 32 37 vId":"bf8ebddb4bf427
2019-08-23 15:32:52.100 (SmartLamp) 61 32 65 39 32 35 69 70 22 2c 22 67 77 49 64 22 3a 22 62 66 a2e925ip","gwId":"bf
2019-08-23 15:32:52.100 (SmartLamp) 38 65 62 64 64 62 34 62 66 34 32 37 61 32 65 39 32 35 69 70 8ebddb4bf427a2e925ip
2019-08-23 15:32:52.100 (SmartLamp) 22 7d 4f cb f9 ff 00 00 aa 55 .. .. .. .. .. .. .. .. .. .. "}O���..�U
2019-08-23 15:32:52.108 (SmartLamp) Pushing 'ReadEvent' on to queue
2019-08-23 15:32:52.150 (SmartLamp) Processing 'ReadEvent' message
2019-08-23 15:32:52.150 (SmartLamp) Received 60 bytes of data
2019-08-23 15:32:52.150 (SmartLamp) 00 00 55 aa 00 00 00 00 00 00 00 07 00 00 00 2c 00 00 00 01 ..U�...........,....
2019-08-23 15:32:52.150 (SmartLamp) c2 81 3e 44 1e 84 2c 48 24 5f e8 8b 09 2b a0 16 2b 58 2d 3b >D.�,H$_�.+�.+X-;
2019-08-23 15:32:52.150 (SmartLamp) 12 0d 97 38 a5 c9 a6 f5 4b 08 42 e1 19 7e 5b 94 00 00 aa 55 ..�8�ɦ�K.B�.~[�..�U
2019-08-23 15:32:52.151 (SmartLamp) Pushing 'onMessageCallback' on to queue
2019-08-23 15:32:52.151 (SmartLamp) Processing 'onMessageCallback' message
2019-08-23 15:32:52.151 (SmartLamp) Calling message handler 'onMessage'.
2019-08-23 15:32:52.151 (SmartLamp) onMessage called: 192.168.188.116:6668 b'\x00\x00U\xaa\x00\x00\x00\x00\x00\x00\x00\x07\x00\x00\x00,\x00\x00\x00\x01\xc2\x81>D\x1e\x84,H$_\xe8\x8b\t+\xa0\x16+X-;\x12\r\x978\xa5\xc9\xa6\xf5K\x08B\xe1\x19~[\x94\x00\x00\xaaU'
2019-08-23 15:32:52.152 (SmartLamp) Pushing 'WriteDirective' on to queue
2019-08-23 15:32:52.152 (SmartLamp) Pushing 'WriteDirective' on to queue
2019-08-23 15:32:52.152 (SmartLamp) Processing 'WriteDirective' message
2019-08-23 15:32:52.152 (SmartLamp) Sending 195 bytes of data
2019-08-23 15:32:52.152 (SmartLamp) 00 00 55 aa 00 00 00 00 00 00 00 07 00 00 00 b3 33 2e 31 36 ..U�...........�3.16
2019-08-23 15:32:52.152 (SmartLamp) 37 62 64 32 31 35 30 61 34 35 30 37 30 66 37 6c 73 31 2f 39 7bd2150a45070f7ls1/9
2019-08-23 15:32:52.152 (SmartLamp) 30 4e 4e 6d 76 5a 45 34 65 37 68 69 56 67 64 68 71 42 52 35 0NNmvZE4e7hiVgdhqBR5
2019-08-23 15:32:52.152 (SmartLamp) 56 58 68 4e 4a 55 66 7a 39 34 68 67 75 79 74 78 42 57 6e 39 VXhNJUfz94hguytxBWn9
2019-08-23 15:32:52.152 (SmartLamp) 44 5a 42 5a 4d 33 55 57 62 4b 4e 4c 4e 43 58 54 6c 36 63 44 DZBZM3UWbKNLNCXTl6cD
2019-08-23 15:32:52.152 (SmartLamp) 69 34 42 4a 4a 73 34 79 36 30 76 58 46 72 44 49 30 45 59 5a i4BJJs4y60vXFrDI0EYZ
2019-08-23 15:32:52.153 (SmartLamp) 4b 42 52 35 56 58 68 4e 4a 55 66 7a 39 34 68 67 75 79 74 78 KBR5VXhNJUfz94hguytx
2019-08-23 15:32:52.153 (SmartLamp) 42 55 38 6b 49 54 54 51 32 58 68 39 39 79 71 75 54 4d 53 41 BU8kITTQ2Xh99yquTMSA
2019-08-23 15:32:52.153 (SmartLamp) 78 57 50 36 4f 49 65 35 6f 43 70 63 64 70 78 5a 59 41 62 49 xWP6OIe5oCpcdpxZYAbI
2019-08-23 15:32:52.153 (SmartLamp) 4a 31 71 6c 77 3d 3d 0b d0 93 c1 00 00 aa 55 .. .. .. .. .. J1qlw==.Г�..�U
2019-08-23 15:32:52.153 (SmartLamp) Processing 'WriteDirective' message
2019-08-23 15:32:52.153 (SmartLamp) Sending 90 bytes of data
But bulb does not switch on or off or change colour.
app on phone is off. Someone has a solution?
Re: [REQUEST] Plugin for Tuya
Posted: Friday 23 August 2019 17:39
by Loky31
Hello AllesVanZelf ,
I have reached the same point as you are...
No obvious problem, but nothing happen!
On my side I did retrieve the key and devId with packet capture and I assume they are the good one but without any real way to confirm that.
I didn't found a level of debug that confirms that it is correctly connected, did you?
Or the logs with data sent are already a confirmation of the connection is established?
Re: [REQUEST] Plugin for Tuya
Posted: Friday 23 August 2019 18:06
by AllesVanZelf
Loky31 wrote: ↑Friday 23 August 2019 17:39
Hello AllesVanZelf ,
I have reached the same point as you are...
No obvious problem, but nothing happen!
On my side I did retrieve the key and devId with packet capture and I assume they are the good one but without any real way to confirm that.
I didn't found a level of debug that confirms that it is correctly connected, did you?
Or the logs with data sent are already a confirmation of the connection is established?
I'm not sure if there is a connection made. In the log I see messages about sending, processing, pushing data, but also: "Received 60 bytes of data". I do not fully understand what the log is saying. But that sounds as if a connection is made.
DeviceId and local key are the right one in my case. I used this method:
codetheweb/tuyapi/
Re: [REQUEST] Plugin for Tuya
Posted: Friday 23 August 2019 22:08
by merlot
Have you tried the get_dps and turnON, turnOFF scripts?
Enviado desde mi Redmi Note 4 mediante Tapatalk
Re: [REQUEST] Plugin for Tuya
Posted: Friday 23 August 2019 22:41
by AllesVanZelf
I thought that these scripts where made for the powerplug, not the bulb.
There is no dps setting for the bulb under domoticz hardware.
Or am I wrong here?
Re: [REQUEST] Plugin for Tuya
Posted: Saturday 24 August 2019 8:51
by merlot
I don't have any bulb but I guessed that you'd need at least one DPS to turn it on or off. But not sure at all
Enviado desde mi Redmi Note 4 mediante Tapatalk
Re: [REQUEST] Plugin for Tuya
Posted: Saturday 24 August 2019 15:23
by Loky31
merlot wrote: ↑Friday 23 August 2019 22:08
Have you tried the get_dps and turnON, turnOFF scripts?
Enviado desde mi Redmi Note 4 mediante Tapatalk
I tried that but didn't worked, smart life app turned off and domoticz hw desactivated to avoid double connection.
It's weird...
I tried to use the app with domoticz hw turned on and thé plug appeared offline as expected (solo connection allowed).
I still have no lead on what goes wrong then...
The message I have with the .py scripts is the following :
A problem occur please retry...
When looking in the script :
except (ConnectionResetError, socket.timeout, OSError) as e:
print("A problem occur please retry...")
exit(1)
So I assume I have some connection trouble
Re: [REQUEST] Plugin for Tuya
Posted: Sunday 25 August 2019 10:52
by Loky31
Hi,
Is Someone able to provide logs from a working one ?
Just to have an idea of what to expect.
Re: [REQUEST] Plugin for Tuya
Posted: Sunday 25 August 2019 21:19
by Bigted
Hi I don't understand the error I get when I'm running get_dps for a plug
Code: Select all
Unexpected status() payload=b'\xa1H;\xd5\n\xadT\x9b\xc7^5A\xb5\xc3-\x1d\xe8T\xe0\xe6\xdb\xa3\xac7\x96i\x1d\x837&\x91\xc3'
Plug State Information:
b'\xa1H;\xd5\n\xadT\x9b\xc7^5A\xb5\xc3-\x1d\xe8T\xe0\xe6\xdb\xa3\xac7\x96i\x1d\x837&\x91\xc3'
Plug DPS List:
Traceback (most recent call last):
File "get_dps.py", line 58, in <module>
for key in data['dps'].keys():
TypeError: byte indices must be integers or slices, not str
Re: [REQUEST] Plugin for Tuya
Posted: Thursday 29 August 2019 10:42
by Loky31
Hello all,
I'm coming back on this topic as I'm still truggling with my two tuya plugs and my switch.
For tuya plugs I reached a weird state...
Domoticz seems to connect and is sending regularly some 86 bytes.
In the logs something looks weird to me :
"Protocol for Tuya not specified. 'None' assumed"
What this log means?
Other thing which is strange is that while the plugin is runinng I still can connect through the smart life app and access the plug UI.
When I initiate a switch through the app, then domoticz receive some bytes.
But still the switch on domoticz side is not updated, neither able to activate the plug.
Is someone having a lead for me to solve that?