Giter VIP home page Giter VIP logo

domoticz-tuya-smartplug-plugin's Introduction

NOTE I'm no longer using these devices so this is not actively maintained.

Domoticz-Tuya-SmartPlug-Plugin

A Domoticz plugin to manage Tuya Smart Plug (single and multi socket device)

ONLY TESTED FOR Raspberry Pi

With Python version 3.5 & Domoticz version 4.9700 (stable)

Prerequisites

This plugin is based on the pytuya Python library. For the installation of this library, follow the Installation guide below. See https://github.com/clach04/python-tuya/ for more information.

For the pytuya Python library, you need pycrypto. pycrypto can be installed with pip:

pip3 install pycrypto

See https://pypi.org/project/pycrypto/ for more information.

Installation

Assuming that domoticz directory is installed in your home directory.

cd ~/domoticz/plugins
git clone https://github.com/tixi/Domoticz-Tuya-SmartPlug-Plugin
cd Domoticz-Tuya-SmartPlug-Plugin
git clone https://github.com/clach04/python-tuya.git
ln -s ~/domoticz/plugins/Domoticz-Tuya-SmartPlug-Plugin/python-tuya/pytuya pytuya
# restart domoticz:
sudo /etc/init.d/domoticz.sh restart

In the web UI, navigate to the Hardware page. In the hardware dropdown there will be an entry called "Tuya SmartPlug".

Known issues

1/ python environment

Domoticz may not have the path to the pycrypto library in its python environment. In this case you will observe something starting like that in the log:

  • failed to load 'plugin.py', Python Path used was
  • Module Import failed, exception: 'ImportError'

To find where pycrypto is installed, in a shell:

pip3 show pycrypto

The Crypto directory should be present in the directory indicated with Location.

when you have it, just add a symbolic link to it in Domoticz-Tuya-SmartPlug-Plugin directory with ln -s. Example:

cd ~/domoticz/plugins/Domoticz-Tuya-SmartPlug-Plugin
ln -s /home/pi/.local/lib/python3.5/site-packages/Crypto Crypto

2/ Tuya app

The tuya app must be close. This limitation is due to the tuya device itself that support only one connection.

3/ Alternative crypto libraries

PyCryptodome or pyaes can be used instead of pycrypto.

Updating

Like other plugins, in the Domoticz-Tuya-SmartPlug-Plugin directory:

git pull
sudo /etc/init.d/domoticz.sh restart

Parameters

Parameter Value
IP address IP of the Smart Plug eg. 192.168.1.231
DevID devID of the Smart Plug
Local Key Local Key of the Smart Plug
DPS 1 for single socket device and a list of dps separated by ';' for multisocket device eg. 1;2;3;7
DPS group None for single socket device and a list of list of dps separated by ':' for multisocket device eg. 1;2 : 3;7
DPS always ON None for single socket device and a list of dps separated by ; for multisocket device eg. 1;2
Debug default is 0

DPS should only includes values that correspond to plug's dps id. Be careful some devices also have timers in the dps state.

DPS group can be used to group multiple sockets in one Domoticz switch.

DPS always ON can be used to force some sockets to be always on (usb for instance).

Helper scripts get_dps.py turnON.py and turnOFF.py can help:

  • to determine the dps list
  • to check that the needed information are valid (i.e. devID and Local Key) before using the plugin.

DevID & Local Key Extraction

Recommanded method: https://github.com/codetheweb/tuyapi/blob/master/docs/SETUP.md

All the information can be found here: https://github.com/clach04/python-tuya/

Acknowledgements

  • Special thanks for all the hard work of clach04, codetheweb and all the other contributers on python-tuya and tuyapi who have made communicating to Tuya devices possible with open source code.
  • Domoticz team

domoticz-tuya-smartplug-plugin's People

Contributors

tixi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

domoticz-tuya-smartplug-plugin's Issues

no device

Hi,

I'm sure I have the right ID/Key/... as I can access the devices with both Node-Red and python (turnON / turnOFF)

My problem is that after adding the hardware into Domoticz, no devices are created.
In the log I see these lines repeated 15".

Anyone's got an idea?
Is there some more elaborate log available?

Thanks

Detect the state but cant switch

Hello
i have the 4 switches in my domoticz. and if i turn on or off in the tuya android app, the domoticz update the status of the switches.
But if i change the status in domoticz (power on, or power off) nothing ocurrs. I think the problem is mine, maybe i forget something?

For bug report:

2018-11-11 22:00:33.860 Status: User: Admin initiated a switch command (248/Fri_Regleta - Tuya SmartPlug #7/On)
2018-11-11 22:00:35.792 (Fri_Regleta) 31 22 3a 74 72 75 65 2c 22 32 22 3a 74 72 75 65 2c 22 33 22 1":true,"2":true,"3"
2018-11-11 22:00:35.792 (Fri_Regleta) 3a 74 72 75 65 2c 22 34 22 3a 74 72 75 65 2c 22 37 22 3a 66 :true,"4":true,"7":f
2018-11-11 22:00:35.792 (Fri_Regleta) 61 6c 73 65 2c 22 31 30 31 22 3a 30 2c 22 31 30 32 22 3a 30 alse,"101":0,"102":0
2018-11-11 22:00:35.792 (Fri_Regleta) 2c 22 31 30 33 22 3a 30 2c 22 31 30 34 22 3a 30 2c 22 31 30 ,"103":0,"104":0,"10
2018-11-11 22:00:35.792 (Fri_Regleta) 35 22 3a 30 7d 7d 60 bc 99 33 00 00 aa 55 .. .. .. .. .. .. 5":0}}��3..�U 2018-11-11 22:00:35.793 (Fri_Regleta) Pushing 'onMessageCallback' on to queue 2018-11-11 22:00:35.793 (Fri_Regleta) Processing 'onMessageCallback' message 2018-11-11 22:00:35.793 (Fri_Regleta) Calling message handler 'onMessage'. 2018-11-11 22:00:35.793 (Fri_Regleta) onMessage called: 192.168.1.85:6668 b'\x00\x00U\xaa\x00\x00\x00\x00\x00\x00\x00\n\x00\x00\x00\x8a\x00\x00\x00\x00{"devId":"17007751600194afc4b0","dps":{"1":true,"2":true,"3":true,"4":true,"7":false,"101":0,"102":0,"103":0,"104":0,"105":0}}\xbc\x993\x00\x00\xaaU'
2018-11-11 22:00:35.794 (Fri_Regleta) Pushing 'WriteDirective' on to queue
2018-11-11 22:00:35.795 (Fri_Regleta) Pushing 'WriteDirective' on to queue
2018-11-11 22:00:35.795 (Fri_Regleta) Processing 'WriteDirective' message
2018-11-11 22:00:35.795 (Fri_Regleta) Sending 171 bytes of data
2018-11-11 22:00:35.795 (Fri_Regleta) 00 00 55 aa 00 00 00 00 00 00 00 07 00 00 00 9b 33 2e 31 35 ..U�...........�3.15
2018-11-11 22:00:35.795 (Fri_Regleta) 62 66 35 64 66 65 36 37 38 31 63 63 66 31 32 76 38 2b 6f 50 bf5dfe6781ccf12v8+oP
2018-11-11 22:00:35.795 (Fri_Regleta) 57 57 53 48 7a 77 46 4b 77 41 59 7a 65 72 35 6f 70 57 65 73 WWSHzwFKwAYzer5opWes
2018-11-11 22:00:35.795 (Fri_Regleta) 69 74 32 56 2b 45 56 5a 4e 36 58 33 59 72 6d 39 56 4a 57 68 it2V+EVZN6X3Yrm9VJWh
2018-11-11 22:00:35.795 (Fri_Regleta) 2b 72 61 58 54 4f 53 4d 79 4a 38 42 65 4d 4c 57 75 6b 4b 6e +raXTOSMyJ8BeMLWukKn
2018-11-11 22:00:35.795 (Fri_Regleta) 57 72 2f 37 39 33 61 79 6d 42 6a 6e 74 49 2f 4d 34 35 44 70 Wr/793aymBjntI/M45Dp
2018-11-11 22:00:35.795 (Fri_Regleta) 34 63 79 74 42 6d 55 6d 48 67 73 41 6e 77 6d 59 56 64 67 79 4cytBmUmHgsAnwmYVdgy
2018-11-11 22:00:35.795 (Fri_Regleta) 53 30 33 7a 37 51 49 41 68 75 71 75 35 73 6d 59 34 35 41 59 S03z7QIAhuqu5smY45AY
2018-11-11 22:00:35.795 (Fri_Regleta) 64 4b 2b 00 00 00 00 00 00 aa 55 .. .. .. .. .. .. .. .. .. dK+......�U
2018-11-11 22:00:35.799 (Fri_Regleta) Processing 'WriteDirective' message
2018-11-11 22:00:35.800 (Fri_Regleta) Sending 86 bytes of data
2018-11-11 22:00:35.800 (Fri_Regleta) 00 00 55 aa 00 00 00 00 00 00 00 0a 00 00 00 46 7b 22 64 65 ..U�...........F{"de
2018-11-11 22:00:35.800 (Fri_Regleta) 76 49 64 22 3a 22 31 37 30 30 37 37 35 31 36 30 30 31 39 34 vId":"17007751600194
2018-11-11 22:00:35.800 (Fri_Regleta) 61 66 63 34 62 30 22 2c 22 67 77 49 64 22 3a 22 31 37 30 30 afc4b0","gwId":"1700
2018-11-11 22:00:35.800 (Fri_Regleta) 37 37 35 31 36 30 30 31 39 34 61 66 63 34 62 30 22 7d 00 00 7751600194afc4b0"}..
2018-11-11 22:00:35.800 (Fri_Regleta) 00 00 00 00 aa 55 .. .. .. .. .. .. .. .. .. .. .. .. .. .. ....�U
2018-11-11 22:00:35.998 (Fri_Regleta) Pushing 'ReadEvent' on to queue
2018-11-11 22:00:36.001 (Fri_Regleta) Processing 'ReadEvent' message
2018-11-11 22:00:36.001 (Fri_Regleta) Received 154 bytes of data
2018-11-11 22:00:36.001 (Fri_Regleta) 00 00 55 aa 00 00 00 00 00 00 00 0a 00 00 00 8a 00 00 00 00 ..U�...........�....
2018-11-11 22:00:36.001 (Fri_Regleta) 7b 22 64 65 76 49 64 22 3a 22 31 37 30 30 37 37 35 31 36 30 {"devId":"1700775160
2018-11-11 22:00:36.001 (Fri_Regleta) 30 31 39 34 61 66 63 34 62 30 22 2c 22 64 70 73 22 3a 7b 22 0194afc4b0","dps":{"
2018-11-11 22:00:36.001 (Fri_Regleta) 31 22 3a 74 72 75 65 2c 22 32 22 3a 74 72 75 65 2c 22 33 22 1":true,"2":true,"3"
2018-11-11 22:00:36.001 (Fri_Regleta) 3a 74 72 75 65 2c 22 34 22 3a 74 72 75 65 2c 22 37 22 3a 66 :true,"4":true,"7":f
2018-11-11 22:00:36.001 (Fri_Regleta) 61 6c 73 65 2c 22 31 30 31 22 3a 30 2c 22 31 30 32 22 3a 30 alse,"101":0,"102":0
2018-11-11 22:00:36.001 (Fri_Regleta) 2c 22 31 30 33 22 3a 30 2c 22 31 30 34 22 3a 30 2c 22 31 30 ,"103":0,"104":0,"10
2018-11-11 22:00:36.001 (Fri_Regleta) 35 22 3a 30 7d 7d 60 bc 99 33 00 00 aa 55 .. .. .. .. .. .. 5":0}}��3..�U 2018-11-11 22:00:36.001 (Fri_Regleta) Pushing 'onMessageCallback' on to queue 2018-11-11 22:00:36.001 (Fri_Regleta) Processing 'onMessageCallback' message 2018-11-11 22:00:36.001 (Fri_Regleta) Calling message handler 'onMessage'. 2018-11-11 22:00:36.001 (Fri_Regleta) onMessage called: 192.168.1.85:6668 b'\x00\x00U\xaa\x00\x00\x00\x00\x00\x00\x00\n\x00\x00\x00\x8a\x00\x00\x00\x00{"devId":"17007751600194afc4b0","dps":{"1":true,"2":true,"3":true,"4":true,"7":false,"101":0,"102":0,"103":0,"104":0,"105":0}}\xbc\x993\x00\x00\xaaU'
2018-11-11 22:00:36.003 (Fri_Regleta) Pushing 'WriteDirective' on to queue
2018-11-11 22:00:36.004 (Fri_Regleta) Pushing 'WriteDirective' on to queue
2018-11-11 22:00:36.004 (Fri_Regleta) Processing 'WriteDirective' message
2018-11-11 22:00:36.004 (Fri_Regleta) Sending 171 bytes of data
2018-11-11 22:00:36.004 (Fri_Regleta) 00 00 55 aa 00 00 00 00 00 00 00 07 00 00 00 9b 33 2e 31 36 ..U�...........�3.16
2018-11-11 22:00:36.004 (Fri_Regleta) 33 66 35 38 61 62 62 34 64 61 33 33 65 31 30 76 38 2b 6f 50 3f58abb4da33e10v8+oP
2018-11-11 22:00:36.004 (Fri_Regleta) 57 57 53 48 7a 77 46 4b 77 41 59 7a 65 72 35 6f 70 57 65 73 WWSHzwFKwAYzer5opWes
2018-11-11 22:00:36.004 (Fri_Regleta) 69 74 32 56 2b 45 56 5a 4e 36 58 33 59 72 6d 39 56 4a 57 68 it2V+EVZN6X3Yrm9VJWh
2018-11-11 22:00:36.004 (Fri_Regleta) 2b 72 61 58 54 4f 53 4d 79 4a 38 42 65 4d 4c 57 75 6b 4b 6e +raXTOSMyJ8BeMLWukKn
2018-11-11 22:00:36.004 (Fri_Regleta) 57 72 2f 37 39 33 61 79 6d 42 6a 6e 74 49 2f 4d 34 35 44 70 Wr/793aymBjntI/M45Dp
2018-11-11 22:00:36.004 (Fri_Regleta) 34 63 79 74 42 6d 55 6d 48 67 73 41 6e 77 6d 59 56 64 67 79 4cytBmUmHgsAnwmYVdgy
2018-11-11 22:00:36.004 (Fri_Regleta) 53 32 42 6d 41 79 57 6c 4a 7a 56 65 51 5a 65 2b 76 63 6c 4d S2BmAyWlJzVeQZe+vclM
2018-11-11 22:00:36.004 (Fri_Regleta) 35 4e 30 00 00 00 00 00 00 aa 55 .. .. .. .. .. .. .. .. .. 5N0......�U
2018-11-11 22:00:36.005 (Fri_Regleta) Processing 'WriteDirective' message
2018-11-11 22:00:36.005 (Fri_Regleta) Sending 86 bytes of data
2018-11-11 22:00:36.005 (Fri_Regleta) 00 00 55 aa 00 00 00 00 00 00 00 0a 00 00 00 46 7b 22 64 65 ..U�...........F{"de
2018-11-11 22:00:36.005 (Fri_Regleta) 76 49 64 22 3a 22 31 37 30 30 37 37 35 31 36 30 30 31 39 34 vId":"17007751600194
2018-11-11 22:00:36.005 (Fri_Regleta) 61 66 63 34 62 30 22 2c 22 67 77 49 64 22 3a 22 31 37 30 30 afc4b0","gwId":"1700
2018-11-11 22:00:36.005 (Fri_Regleta) 37 37 35 31 36 30 30 31 39 34 61 66 63 34 62 30 22 7d 00 00 7751600194afc4b0"}..
2018-11-11 22:00:36.005 (Fri_Regleta) 00 00 00 00 aa 55 .. .. .. .. .. .. .. .. .. .. .. .. .. .. ....�U
2018-11-11 22:00:36.032 (Fri_Regleta) Pushing 'ReadEvent' on to queue
2018-11-11 22:00:36.055 (Fri_Regleta) Processing 'ReadEvent' message
2018-11-11 22:00:36.055 (Fri_Regleta) Received 154 bytes of data
2018-11-11 22:00:36.055 (Fri_Regleta) 00 00 55 aa 00 00 00 00 00 00 00 0a 00 00 00 8a 00 00 00 00 ..U�...........�....
2018-11-11 22:00:36.055 (Fri_Regleta) 7b 22 64 65 76 49 64 22 3a 22 31 37 30 30 37 37 35 31 36 30 {"devId":"1700775160
2018-11-11 22:00:36.055 (Fri_Regleta) 30 31 39 34 61 66 63 34 62 30 22 2c 22 64 70 73 22 3a 7b 22 0194afc4b0","dps":{"
2018-11-11 22:00:36.055 (Fri_Regleta) 31 22 3a 74 72 75 65 2c 22 32 22 3a 74 72 75 65 2c 22 33 22 1":true,"2":true,"3"
2018-11-11 22:00:36.056 (Fri_Regleta) 3a 74 72 75 65 2c 22 34 22 3a 74 72 75 65 2c 22 37 22 3a 66 :true,"4":true,"7":f
2018-11-11 22:00:36.056 (Fri_Regleta) 61 6c 73 65 2c 22 31 30 31 22 3a 30 2c 22 31 30 32 22 3a 30 alse,"101":0,"102":0
2018-11-11 22:00:36.056 (Fri_Regleta) 2c 22 31 30 33 22 3a 30 2c 22 31 30 34 22 3a 30 2c 22 31 30 ,"103":0,"104":0,"10
2018-11-11 22:00:36.056 (Fri_Regleta) 35 22 3a 30 7d 7d 60 bc 99 33 00 00 aa 55 .. .. .. .. .. .. 5":0}}��3..�U 2018-11-11 22:00:36.056 (Fri_Regleta) Pushing 'onMessageCallback' on to queue 2018-11-11 22:00:36.056 (Fri_Regleta) Processing 'onMessageCallback' message 2018-11-11 22:00:36.056 (Fri_Regleta) Calling message handler 'onMessage'. 2018-11-11 22:00:36.056 (Fri_Regleta) onMessage called: 192.168.1.85:6668 b'\x00\x00U\xaa\x00\x00\x00\x00\x00\x00\x00\n\x00\x00\x00\x8a\x00\x00\x00\x00{"devId":"17007751600194afc4b0","dps":{"1":true,"2":true,"3":true,"4":true,"7":false,"101":0,"102":0,"103":0,"104":0,"105":0}}\xbc\x993\x00\x00\xaaU'
2018-11-11 22:00:36.057 (Fri_Regleta) Pushing 'WriteDirective' on to queue
2018-11-11 22:00:36.058 (Fri_Regleta) Pushing 'WriteDirective' on to queue
2018-11-11 22:00:36.058 (Fri_Regleta) Processing 'WriteDirective' message
2018-11-11 22:00:36.058 (Fri_Regleta) Sending 171 bytes of data
2018-11-11 22:00:36.058 (Fri_Regleta) 00 00 55 aa 00 00 00 00 00 00 00 07 00 00 00 9b 33 2e 31 36 ..U�...........�3.16
2018-11-11 22:00:36.058 (Fri_Regleta) 33 66 35 38 61 62 62 34 64 61 33 33 65 31 30 76 38 2b 6f 50 3f58abb4da33e10v8+oP
2018-11-11 22:00:36.058 (Fri_Regleta) 57 57 53 48 7a 77 46 4b 77 41 59 7a 65 72 35 6f 70 57 65 73 WWSHzwFKwAYzer5opWes
2018-11-11 22:00:36.058 (Fri_Regleta) 69 74 32 56 2b 45 56 5a 4e 36 58 33 59 72 6d 39 56 4a 57 68 it2V+EVZN6X3Yrm9VJWh
2018-11-11 22:00:36.058 (Fri_Regleta) 2b 72 61 58 54 4f 53 4d 79 4a 38 42 65 4d 4c 57 75 6b 4b 6e +raXTOSMyJ8BeMLWukKn
2018-11-11 22:00:36.058 (Fri_Regleta) 57 72 2f 37 39 33 61 79 6d 42 6a 6e 74 49 2f 4d 34 35 44 70 Wr/793aymBjntI/M45Dp
2018-11-11 22:00:36.058 (Fri_Regleta) 34 63 79 74 42 6d 55 6d 48 67 73 41 6e 77 6d 59 56 64 67 79 4cytBmUmHgsAnwmYVdgy
2018-11-11 22:00:36.058 (Fri_Regleta) 53 32 42 6d 41 79 57 6c 4a 7a 56 65 51 5a 65 2b 76 63 6c 4d S2BmAyWlJzVeQZe+vclM
2018-11-11 22:00:36.058 (Fri_Regleta) 35 4e 30 00 00 00 00 00 00 aa 55 .. .. .. .. .. .. .. .. .. 5N0......�U
2018-11-11 22:00:36.059 (Fri_Regleta) Processing 'WriteDirective' message
2018-11-11 22:00:36.059 (Fri_Regleta) Sending 86 bytes of data
2018-11-11 22:00:36.059 (Fri_Regleta) 00 00 55 aa 00 00 00 00 00 00 00 0a 00 00 00 46 7b 22 64 65 ..U�...........F{"de
2018-11-11 22:00:36.059 (Fri_Regleta) 76 49 64 22 3a 22 31 37 30 30 37 37 35 31 36 30 30 31 39 34 vId":"17007751600194
2018-11-11 22:00:36.059 (Fri_Regleta) 61 66 63 34 62 30 22 2c 22 67 77 49 64 22 3a 22 31 37 30 30 afc4b0","gwId":"1700
2018-11-11 22:00:36.059 (Fri_Regleta) 37 37 35 31 36 30 30 31 39 34 61 66 63 34 62 30 22 7d 00 00 7751600194afc4b0"}..
2018-11-11 22:00:36.059 (Fri_Regleta) 00 00 00 00 aa 55 .. .. .. .. .. .. .. .. .. .. .. .. .. .. ....�U
2018-11-11 22:00:36.226 (Fri_Regleta) Pushing 'ReadEvent' on to queue
2018-11-11 22:00:40.749 (Fri_Regleta) 61 6c 73 65 2c 22 31 30 31 22 3a 30 2c 22 31 30 32 22 3a 30 alse,"101":0,"102":0
2018-11-11 22:00:40.750 (Fri_Regleta) 2c 22 31 30 33 22 3a 30 2c 22 31 30 34 22 3a 30 2c 22 31 30 ,"103":0,"104":0,"10
2018-11-11 22:00:40.750 (Fri_Regleta) 35 22 3a 30 7d 7d 60 bc 99 33 00 00 aa 55 .. .. .. .. .. .. 5":0}}��3..�U 2018-11-11 22:00:40.750 (Fri_Regleta) Pushing 'onMessageCallback' on to queue 2018-11-11 22:00:40.750 (Fri_Regleta) Processing 'onMessageCallback' message 2018-11-11 22:00:40.750 (Fri_Regleta) Calling message handler 'onMessage'. 2018-11-11 22:00:40.750 (Fri_Regleta) onMessage called: 192.168.1.85:6668 b'\x00\x00U\xaa\x00\x00\x00\x00\x00\x00\x00\n\x00\x00\x00\x8a\x00\x00\x00\x00{"devId":"17007751600194afc4b0","dps":{"1":true,"2":true,"3":true,"4":true,"7":false,"101":0,"102":0,"103":0,"104":0,"105":0}}\xbc\x993\x00\x00\xaaU'
2018-11-11 22:00:40.753 (Fri_Regleta) Pushing 'WriteDirective' on to queue
2018-11-11 22:00:40.754 (Fri_Regleta) Pushing 'WriteDirective' on to queue
2018-11-11 22:00:40.754 (Fri_Regleta) Processing 'WriteDirective' message
2018-11-11 22:00:40.754 (Fri_Regleta) Sending 171 bytes of data
2018-11-11 22:00:40.754 (Fri_Regleta) 00 00 55 aa 00 00 00 00 00 00 00 07 00 00 00 9b 33 2e 31 66 ..U�...........�3.1f
2018-11-11 22:00:40.754 (Fri_Regleta) 63 63 65 38 35 34 66 35 34 66 38 30 63 33 32 76 38 2b 6f 50 cce854f54f80c32v8+oP
2018-11-11 22:00:40.754 (Fri_Regleta) 57 57 53 48 7a 77 46 4b 77 41 59 7a 65 72 35 6f 70 57 65 73 WWSHzwFKwAYzer5opWes
2018-11-11 22:00:40.754 (Fri_Regleta) 69 74 32 56 2b 45 56 5a 4e 36 58 33 59 72 6d 39 56 4a 57 68 it2V+EVZN6X3Yrm9VJWh
2018-11-11 22:00:40.754 (Fri_Regleta) 2b 72 61 58 54 4f 53 4d 79 4a 38 42 65 4d 4c 57 75 6b 4b 6e +raXTOSMyJ8BeMLWukKn
2018-11-11 22:00:40.755 (Fri_Regleta) 57 72 2f 37 39 33 61 79 6d 42 6a 6e 74 49 2f 4d 34 35 44 70 Wr/793aymBjntI/M45Dp
2018-11-11 22:00:40.755 (Fri_Regleta) 34 63 79 74 42 6d 55 6d 48 67 73 41 6e 77 6d 59 56 64 67 79 4cytBmUmHgsAnwmYVdgy
2018-11-11 22:00:40.755 (Fri_Regleta) 53 31 6d 69 55 57 76 66 2f 43 34 6f 58 4f 76 77 44 68 66 38 S1miUWvf/C4oXOvwDhf8
2018-11-11 22:00:40.755 (Fri_Regleta) 2b 4a 73 00 00 00 00 00 00 aa 55 .. .. .. .. .. .. .. .. .. +Js......�U
2018-11-11 22:00:40.755 (Fri_Regleta) Processing 'WriteDirective' message
2018-11-11 22:00:40.755 (Fri_Regleta) Sending 86 bytes of data
2018-11-11 22:00:40.755 (Fri_Regleta) 00 00 55 aa 00 00 00 00 00 00 00 0a 00 00 00 46 7b 22 64 65 ..U�...........F{"de
2018-11-11 22:00:40.756 (Fri_Regleta) 76 49 64 22 3a 22 31 37 30 30 37 37 35 31 36 30 30 31 39 34 vId":"17007751600194
2018-11-11 22:00:40.756 (Fri_Regleta) 61 66 63 34 62 30 22 2c 22 67 77 49 64 22 3a 22 31 37 30 30 afc4b0","gwId":"1700
2018-11-11 22:00:40.756 (Fri_Regleta) 37 37 35 31 36 30 30 31 39 34 61 66 63 34 62 30 22 7d 00 00 7751600194afc4b0"}..
2018-11-11 22:00:40.756 (Fri_Regleta) 00 00 00 00 aa 55 .. .. .. .. .. .. .. .. .. .. .. .. .. .. ....�U
2018-11-11 22:00:40.977 (Fri_Regleta) Pushing 'ReadEvent' on to queue
2018-11-11 22:00:41.006 (Fri_Regleta) Processing 'ReadEvent' message
2018-11-11 22:00:41.007 (Fri_Regleta) Received 154 bytes of data
2018-11-11 22:00:41.007 (Fri_Regleta) 00 00 55 aa 00 00 00 00 00 00 00 0a 00 00 00 8a 00 00 00 00 ..U�...........�....
2018-11-11 22:00:41.007 (Fri_Regleta) 7b 22 64 65 76 49 64 22 3a 22 31 37 30 30 37 37 35 31 36 30 {"devId":"1700775160
2018-11-11 22:00:41.007 (Fri_Regleta) 30 31 39 34 61 66 63 34 62 30 22 2c 22 64 70 73 22 3a 7b 22 0194afc4b0","dps":{"
2018-11-11 22:00:41.007 (Fri_Regleta) 31 22 3a 74 72 75 65 2c 22 32 22 3a 74 72 75 65 2c 22 33 22 1":true,"2":true,"3"
2018-11-11 22:00:41.007 (Fri_Regleta) 3a 74 72 75 65 2c 22 34 22 3a 74 72 75 65 2c 22 37 22 3a 66 :true,"4":true,"7":f
2018-11-11 22:00:41.007 (Fri_Regleta) 61 6c 73 65 2c 22 31 30 31 22 3a 30 2c 22 31 30 32 22 3a 30 alse,"101":0,"102":0
2018-11-11 22:00:41.007 (Fri_Regleta) 2c 22 31 30 33 22 3a 30 2c 22 31 30 34 22 3a 30 2c 22 31 30 ,"103":0,"104":0,"10
2018-11-11 22:00:41.008 (Fri_Regleta) 35 22 3a 30 7d 7d 60 bc 99 33 00 00 aa 55 .. .. .. .. .. .. 5":0}}��3..�U 2018-11-11 22:00:41.008 (Fri_Regleta) Pushing 'onMessageCallback' on to queue 2018-11-11 22:00:41.008 (Fri_Regleta) Processing 'onMessageCallback' message 2018-11-11 22:00:41.008 (Fri_Regleta) Calling message handler 'onMessage'. 2018-11-11 22:00:41.008 (Fri_Regleta) onMessage called: 192.168.1.85:6668 b'\x00\x00U\xaa\x00\x00\x00\x00\x00\x00\x00\n\x00\x00\x00\x8a\x00\x00\x00\x00{"devId":"17007751600194afc4b0","dps":{"1":true,"2":true,"3":true,"4":true,"7":false,"101":0,"102":0,"103":0,"104":0,"105":0}}\xbc\x993\x00\x00\xaaU'
2018-11-11 22:00:41.011 (Fri_Regleta) Pushing 'WriteDirective' on to queue
2018-11-11 22:00:41.011 (Fri_Regleta) Pushing 'WriteDirective' on to queue
2018-11-11 22:00:41.012 (Fri_Regleta) Processing 'WriteDirective' message
2018-11-11 22:00:41.012 (Fri_Regleta) Sending 171 bytes of data
2018-11-11 22:00:41.012 (Fri_Regleta) 00 00 55 aa 00 00 00 00 00 00 00 07 00 00 00 9b 33 2e 31 66 ..U�...........�3.1f
2018-11-11 22:00:41.012 (Fri_Regleta) 32 63 36 66 32 36 30 66 61 61 31 31 64 61 65 76 38 2b 6f 50 2c6f260faa11daev8+oP
2018-11-11 22:00:41.012 (Fri_Regleta) 57 57 53 48 7a 77 46 4b 77 41 59 7a 65 72 35 6f 70 57 65 73 WWSHzwFKwAYzer5opWes
2018-11-11 22:00:41.012 (Fri_Regleta) 69 74 32 56 2b 45 56 5a 4e 36 58 33 59 72 6d 39 56 4a 57 68 it2V+EVZN6X3Yrm9VJWh
2018-11-11 22:00:41.012 (Fri_Regleta) 2b 72 61 58 54 4f 53 4d 79 4a 38 42 65 4d 4c 57 75 6b 4b 6e +raXTOSMyJ8BeMLWukKn
2018-11-11 22:00:41.012 (Fri_Regleta) 57 72 2f 37 39 33 61 79 6d 42 6a 6e 74 49 2f 4d 34 35 44 70 Wr/793aymBjntI/M45Dp
2018-11-11 22:00:41.013 (Fri_Regleta) 34 63 79 74 42 6d 55 6d 48 67 73 41 6e 77 6d 59 56 64 67 79 4cytBmUmHgsAnwmYVdgy
2018-11-11 22:00:41.013 (Fri_Regleta) 53 30 4b 30 46 65 50 31 66 67 73 30 34 2f 4f 57 53 49 6e 4e S0K0FeP1fgs04/OWSInN
2018-11-11 22:00:41.013 (Fri_Regleta) 33 7a 39 00 00 00 00 00 00 aa 55 .. .. .. .. .. .. .. .. .. 3z9......�U
2018-11-11 22:00:41.013 (Fri_Regleta) Processing 'WriteDirective' message
2018-11-11 22:00:41.013 (Fri_Regleta) Sending 86 bytes of data
2018-11-11 22:00:41.013 (Fri_Regleta) 00 00 55 aa 00 00 00 00 00 00 00 0a 00 00 00 46 7b 22 64 65 ..U�...........F{"de
2018-11-11 22:00:41.013 (Fri_Regleta) 76 49 64 22 3a 22 31 37 30 30 37 37 35 31 36 30 30 31 39 34 vId":"17007751600194
2018-11-11 22:00:41.013 (Fri_Regleta) 61 66 63 34 62 30 22 2c 22 67 77 49 64 22 3a 22 31 37 30 30 afc4b0","gwId":"1700
2018-11-11 22:00:41.014 (Fri_Regleta) 37 37 35 31 36 30 30 31 39 34 61 66 63 34 62 30 22 7d 00 00 7751600194afc4b0"}..
2018-11-11 22:00:41.014 (Fri_Regleta) 00 00 00 00 aa 55 .. .. .. .. .. .. .. .. .. .. .. .. .. .. ....�U
2018-11-11 22:00:41.157 (Fri_Regleta) Pushing 'onHeartbeatCallback' on to queue
2018-11-11 22:00:41.164 (Fri_Regleta) Processing 'onHeartbeatCallback' message
2018-11-11 22:00:41.164 (Fri_Regleta) Calling message handler 'onHeartbeat'.
2018-11-11 22:00:41.197 (Fri_Regleta) Pushing 'ReadEvent' on to queue
2018-11-11 22:00:41.214 (Fri_Regleta) Processing 'ReadEvent' message
2018-11-11 22:00:41.215 (Fri_Regleta) Received 154 bytes of data
2018-11-11 22:00:41.215 (Fri_Regleta) 00 00 55 aa 00 00 00 00 00 00 00 0a 00 00 00 8a 00 00 00 00 ..U�...........�....
2018-11-11 22:00:41.215 (Fri_Regleta) 7b 22 64 65 76 49 64 22 3a 22 31 37 30 30 37 37 35 31 36 30 {"devId":"1700775160
2018-11-11 22:00:41.215 (Fri_Regleta) 30 31 39 34 61 66 63 34 62 30 22 2c 22 64 70 73 22 3a 7b 22 0194afc4b0","dps":{"
2018-11-11 22:00:41.215 (Fri_Regleta) 31 22 3a 74 72 75 65 2c 22 32 22 3a 74 72 75 65 2c 22 33 22 1":true,"2":true,"3"
2018-11-11 22:00:41.215 (Fri_Regleta) 3a 74 72 75 65 2c 22 34 22 3a 74 72 75 65 2c 22 37 22 3a 66 :true,"4":true,"7":f
2018-11-11 22:00:41.215 (Fri_Regleta) 61 6c 73 65 2c 22 31 30 31 22 3a 30 2c 22 31 30 32 22 3a 30 alse,"101":0,"102":0
2018-11-11 22:00:41.215 (Fri_Regleta) 2c 22 31 30 33 22 3a 30 2c 22 31 30 34 22 3a 30 2c 22 31 30 ,"103":0,"104":0,"10
2018-11-11 22:00:41.216 (Fri_Regleta) 35 22 3a 30 7d 7d 60 bc 99 33 00 00 aa 55 .. .. .. .. .. .. 5":0}}��3..�U 2018-11-11 22:00:41.216 (Fri_Regleta) Pushing 'onMessageCallback' on to queue 2018-11-11 22:00:41.216 (Fri_Regleta) Processing 'onMessageCallback' message 2018-11-11 22:00:41.216 (Fri_Regleta) Calling message handler 'onMessage'. 2018-11-11 22:00:41.216 (Fri_Regleta) onMessage called: 192.168.1.85:6668 b'\x00\x00U\xaa\x00\x00\x00\x00\x00\x00\x00\n\x00\x00\x00\x8a\x00\x00\x00\x00{"devId":"17007751600194afc4b0","dps":{"1":true,"2":true,"3":true,"4":true,"7":false,"101":0,"102":0,"103":0,"104":0,"105":0}}\xbc\x993\x00\x00\xaaU'
2018-11-11 22:00:41.219 (Fri_Regleta) Pushing 'WriteDirective' on to queue
2018-11-11 22:00:41.220 (Fri_Regleta) Pushing 'WriteDirective' on to queue
2018-11-11 22:00:41.220 (Fri_Regleta) Processing 'WriteDirective' message
2018-11-11 22:00:41.220 (Fri_Regleta) Sending 171 bytes of data
2018-11-11 22:00:41.220 (Fri_Regleta) 00 00 55 aa 00 00 00 00 00 00 00 07 00 00 00 9b 33 2e 31 66 ..U�...........�3.1f
2018-11-11 22:00:41.220 (Fri_Regleta) 32 63 36 66 32 36 30 66 61 61 31 31 64 61 65 76 38 2b 6f 50 2c6f260faa11daev8+oP
2018-11-11 22:00:41.220 (Fri_Regleta) 57 57 53 48 7a 77 46 4b 77 41 59 7a 65 72 35 6f 70 57 65 73 WWSHzwFKwAYzer5opWes
2018-11-11 22:00:41.220 (Fri_Regleta) 69 74 32 56 2b 45 56 5a 4e 36 58 33 59 72 6d 39 56 4a 57 68 it2V+EVZN6X3Yrm9VJWh
2018-11-11 22:00:41.220 (Fri_Regleta) 2b 72 61 58 54 4f 53 4d 79 4a 38 42 65 4d 4c 57 75 6b 4b 6e +raXTOSMyJ8BeMLWukKn
2018-11-11 22:00:41.220 (Fri_Regleta) 57 72 2f 37 39 33 61 79 6d 42 6a 6e 74 49 2f 4d 34 35 44 70 Wr/793aymBjntI/M45Dp
2018-11-11 22:00:41.221 (Fri_Regleta) 34 63 79 74 42 6d 55 6d 48 67 73 41 6e 77 6d 59 56 64 67 79 4cytBmUmHgsAnwmYVdgy
2018-11-11 22:00:41.221 (Fri_Regleta) 53 30 4b 30 46 65 50 31 66 67 73 30 34 2f 4f 57 53 49 6e 4e S0K0FeP1fgs04/OWSInN
2018-11-11 22:00:41.221 (Fri_Regleta) 33 7a 39 00 00 00 00 00 00 aa 55 .. .. .. .. .. .. .. .. .. 3z9......�U
2018-11-11 22:00:41.221 (Fri_Regleta) Processing 'WriteDirective' message
2018-11-11 22:00:41.221 (Fri_Regleta) Sending 86 bytes of data
2018-11-11 22:00:41.221 (Fri_Regleta) 00 00 55 aa 00 00 00 00 00 00 00 0a 00 00 00 46 7b 22 64 65 ..U�...........F{"de
2018-11-11 22:00:41.221 (Fri_Regleta) 76 49 64 22 3a 22 31 37 30 30 37 37 35 31 36 30 30 31 39 34 vId":"17007751600194
2018-11-11 22:00:41.221 (Fri_Regleta) 61 66 63 34 62 30 22 2c 22 67 77 49 64 22 3a 22 31 37 30 30 afc4b0","gwId":"1700
2018-11-11 22:00:41.222 (Fri_Regleta) 37 37 35 31 36 30 30 31 39 34 61 66 63 34 62 30 22 7d 00 00 7751600194afc4b0"}..
2018-11-11 22:00:41.222 (Fri_Regleta) 00 00 00 00 aa 55 .. .. .. .. .. .. .. .. .. .. .. .. .. .. ....�U
2018-11-11 22:00:42.336 (Fri_Regleta) Debug logging mask set to: NONE

thanks

Unable to open Plugin.py

Domoticz version: Domoticz V4.9700

Issue Tthe platform you are using: Raspberry pi3b+
OS: Debian Stretch (32 bits); version 9.x
Python Version used: 3.5.3

Error:

2019-01-29 20:58:17.909 Error: (tixi_tuya_smartplug_plugin) failed to load 'plugin.py', Python Path used was '/root/domoticz/plugins/Domoticz-Tuya-SmartPlug-Plugin/:/usr/lib/python35.zip:/usr/lib/python3.5:/usr/lib/python3.5/plat-arm-linux-gnueabihf:/usr/lib/python3.5/lib-dynload'.

Python Location:

root@raspberrypi:/domoticz/plugins/Domoticz-Tuya-SmartPlug-Plugin# ls -lh /usr/bin/python3
lrwxrwxrwx 1 root root 9 Jan 20 2017 /usr/bin/python3 -> python3.5
root@raspberrypi:
/domoticz/plugins/Domoticz-Tuya-SmartPlug-Plugin# which python3
/usr/bin/python3
root@raspberrypi:/domoticz/plugins/Domoticz-Tuya-SmartPlug-Plugin# ls -lh /usr/bin/python3.5
-rwxr-xr-x 2 root root 3.8M Sep 27 19:25 /usr/bin/python3.5
root@raspberrypi:
/domoticz/plugins/Domoticz-Tuya-SmartPlug-Plugin#

Installed PyAES: pyaes in /usr/local/lib/python3.5/dist-packages

Please advise on how to fix it

Domoticz-Tuya-SmartPlug-Plugin K&L smartplug

Deze K&L smartplug werkt met de app wel. Ik kan de deviceid zien in de app, ip is ook bekend.
Harware geinstalleerd volgens jou plugin, 5 aparaten worden getoont.
Maar kan de configuratie niet goed afmaken want als ik get dps py uit voer volgt er een fout melding.
pi@raspberrypi:~/domoticz/plugins/Domoticz-Tuya-SmartPlug-Plugin $ sudo ./get_dps.py 192.. bfc79ab3333ea55***9feyu
A problem occur please retry...

Ook weet ik niet wat er bij local key ingevoerd moet worden.

Als vast bedankt voor hulp

Can work with "Tuya motion sensor" ?

Hello,

I just buy "Tuya motion sensor" :
image

And i want to know if the code is compatible with the "Tuya motion sensor" device ?
If not, what can be modified to be compliant ?

Thanks by advance !

Updated every 20 second the value of device

Hello
I'm using an oxaone plug wich works perfectly with your plugin. Thanks again.

This device has 2 plugs. Every 20 second I receive new informations about Volt, Amp, WH.
And I receive also an updated about the status of one plg (only one).

The log is huge with this update. Is it a way to avoid updated the value on/off ony if the status has changed ?

Here is some logs

Thanks a lot

2020-03-11 18:53:18.683 (Tuya) Pushing 'onMessageCallback' on to queue
2020-03-11 18:53:18.683 (Tuya) Processing 'onMessageCallback' message
2020-03-11 18:53:18.683 (Tuya) Calling message handler 'onMessage'.
2020-03-11 18:53:18.683 (Tuya) onMessage called: 192.168.1.8:6668 b'\x00\x00U\xaa\x00\x00\x00\x00\x00\x00\x00\n\x00\x00\x00\x9d\x00\x00\x00\x00{"devId":"55142707bcddc295f96a","dps":{"1":false,"2":false,"9":0,"10":0,"18":0,"19":0,"20":2278,"21":1,"22":609,"23":27297,"24":15519,"25":1340}}\xc5_\xed\xaa\x00\x00\xaaU'
2020-03-11 18:53:18.684 (Tuya - Gauche) Updating device from 0:'Off' to have values 0:'0.0'.
2020-03-11 18:53:18.688 (Tuya - Tuya SmartPlug (A)) Updating device from 0:'0.0' to have values 0:'0.0;0'.
2020-03-11 18:53:18.691 (Tuya - Tuya SmartPlug (kWh)) Updating device from 0:'0.0;74851.7' to have values 0:'227.8'.
2020-03-11 18:53:18.694 (Tuya - Tuya SmartPlug (V)) Updating device from 0:'227.8' to have values 0:'0.0'.
2020-03-11 18:53:18.696 (Tuya) Updated: 0.0 Ampere Key is:2
2020-03-11 18:53:18.696 (Tuya) Updated: 0.0 Watt Key is:13
2020-03-11 18:53:18.697 (Tuya) Updated: 227.8 Voltage Key is:14
2020-03-11 18:53:18.697 (Tuya - Gauche) Updating device from 0:'0.0' to have values 0:'Off'.
2020-03-11 18:53:18.702 (Tuya) Update Tuya - Gauche: 0 - 'Off'
2020-03-11 18:53:18.702 (Tuya - Tuya SmartPlug (A)) Updating device from 0:'0.0;0' to have values 0:'0.0'.
2020-03-11 18:53:18.704 (Tuya - Tuya SmartPlug (kWh)) Updating device from 0:'227.8;74851.7' to have values 0:'0.0;0'.
2020-03-11 18:53:18.707 (Tuya - Tuya SmartPlug (V)) Updating device from 0:'0.0' to have values 0:'227.8'.
2020-03-11 18:53:18.709 (Tuya - Tuya SmartPlug (W)) Updating device from 0:'0.0' to have values 0:'0.0'.
2020-03-11 18:53:18.712 (Tuya) Updated: 0.0 Ampere Key is:3
2020-03-11 18:53:18.712 (Tuya) Updated: 0.0 Watt Key is:14
2020-03-11 18:53:18.712 (Tuya) Updated: 227.8 Voltage Key is:15
2020-03-11 18:53:28.440 (Tuya) Pushing 'onHeartbeatCallback' on to queue
2020-03-11 18:53:28.478 (Tuya) Processing 'onHeartbeatCallback' message
2020-03-11 18:53:28.478 (Tuya) Calling message handler 'onHeartbeat'.
2020-03-11 18:53:38.443 (Tuya) Pushing 'onHeartbeatCallback' on to queue
2020-03-11 18:53:38.444 (Tuya) Processing 'onHeartbeatCallback' message
2020-03-11 18:53:38.444 (Tuya) Calling message handler 'onHeartbeat'.
2020-03-11 18:53:38.446 (Tuya) Pushing 'WriteDirective' on to queue
2020-03-11 18:53:38.446 (Tuya) Processing 'WriteDirective' message
2020-03-11 18:53:38.446 (Tuya) Sending 86 bytes of data
2020-03-11 18:53:38.446 (Tuya) 00 00 55 aa 00 00 00 00 00 00 00 0a 00 00 00 46 7b 22 64 65 ..U�...........F{"de
2020-03-11 18:53:38.446 (Tuya) 76 49 64 22 3a 22 35 35 31 34 32 37 30 37 62 63 64 64 63 32 vId":"55142707bcddc2
2020-03-11 18:53:38.447 (Tuya) 39 35 66 39 36 61 22 2c 22 67 77 49 64 22 3a 22 35 35 31 34 95f96a","gwId":"5514
2020-03-11 18:53:38.447 (Tuya) 32 37 30 37 62 63 64 64 63 32 39 35 66 39 36 61 22 7d 49 51 2707bcddc295f96a"}IQ
2020-03-11 18:53:38.447 (Tuya) d9 16 00 00 aa 55 .. .. .. .. .. .. .. .. .. .. .. .. .. .. �...�U
2020-03-11 18:53:38.524 (Tuya) Pushing 'ReadEvent' on to queue
2020-03-11 18:53:38.547 (Tuya) Processing 'ReadEvent' message
2020-03-11 18:53:38.547 (Tuya) Received 173 bytes of data
2020-03-11 18:53:38.547 (Tuya) 00 00 55 aa 00 00 00 00 00 00 00 0a 00 00 00 9d 00 00 00 00 ..U�...........�....
2020-03-11 18:53:38.547 (Tuya) 7b 22 64 65 76 49 64 22 3a 22 35 35 31 34 32 37 30 37 62 63 {"devId":"55142707bc
2020-03-11 18:53:38.547 (Tuya) 64 64 63 32 39 35 66 39 36 61 22 2c 22 64 70 73 22 3a 7b 22 ddc295f96a","dps":{"
2020-03-11 18:53:38.547 (Tuya) 31 22 3a 66 61 6c 73 65 2c 22 32 22 3a 66 61 6c 73 65 2c 22 1":false,"2":false,"
2020-03-11 18:53:38.547 (Tuya) 39 22 3a 30 2c 22 31 30 22 3a 30 2c 22 31 38 22 3a 30 2c 22 9":0,"10":0,"18":0,"
2020-03-11 18:53:38.548 (Tuya) 31 39 22 3a 30 2c 22 32 30 22 3a 32 32 37 38 2c 22 32 31 22 19":0,"20":2278,"21"
2020-03-11 18:53:38.548 (Tuya) 3a 31 2c 22 32 32 22 3a 36 30 39 2c 22 32 33 22 3a 32 37 32 :1,"22":609,"23":272
2020-03-11 18:53:38.548 (Tuya) 39 37 2c 22 32 34 22 3a 31 35 35 31 39 2c 22 32 35 22 3a 31 97,"24":15519,"25":1
2020-03-11 18:53:38.548 (Tuya) 33 34 30 7d 7d c5 5f ed aa 00 00 aa 55 .. .. .. .. .. .. .. 340}}�_��..�U
2020-03-11 18:53:38.548 (Tuya) Pushing 'onMessageCallback' on to queue
2020-03-11 18:53:38.548 (Tuya) Processing 'onMessageCallback' message
2020-03-11 18:53:38.548 (Tuya) Calling message handler 'onMessage'.
2020-03-11 18:53:38.548 (Tuya) onMessage called: 192.168.1.8:6668 b'\x00\x00U\xaa\x00\x00\x00\x00\x00\x00\x00\n\x00\x00\x00\x9d\x00\x00\x00\x00{"devId":"55142707bcddc295f96a","dps":{"1":false,"2":false,"9":0,"10":0,"18":0,"19":0,"20":2278,"21":1,"22":609,"23":27297,"24":15519,"25":1340}}\xc5_\xed\xaa\x00\x00\xaaU'
2020-03-11 18:53:38.549 (Tuya - Gauche) Updating device from 0:'Off' to have values 0:'0.0'.
2020-03-11 18:53:38.553 (Tuya - Tuya SmartPlug (A)) Updating device from 0:'0.0' to have values 0:'0.0;0'.
2020-03-11 18:53:38.555 (Tuya - Tuya SmartPlug (kWh)) Updating device from 0:'0.0;74851.7' to have values 0:'227.8'.
2020-03-11 18:53:38.558 (Tuya - Tuya SmartPlug (V)) Updating device from 0:'227.8' to have values 0:'0.0'.
2020-03-11 18:53:38.560 (Tuya) Updated: 0.0 Ampere Key is:2
2020-03-11 18:53:38.561 (Tuya) Updated: 0.0 Watt Key is:13
2020-03-11 18:53:38.561 (Tuya) Updated: 227.8 Voltage Key is:14
2020-03-11 18:53:38.561 (Tuya - Gauche) Updating device from 0:'0.0' to have values 0:'Off'.
2020-03-11 18:53:38.565 (Tuya) Update Tuya - Gauche: 0 - 'Off'
2020-03-11 18:53:38.565 (Tuya - Tuya SmartPlug (A)) Updating device from 0:'0.0;0' to have values 0:'0.0'.
2020-03-11 18:53:38.568 (Tuya - Tuya SmartPlug (kWh)) Updating device from 0:'227.8;74851.7' to have values 0:'0.0;0'.
2020-03-11 18:53:38.570 (Tuya - Tuya SmartPlug (V)) Updating device from 0:'0.0' to have values 0:'227.8'.
2020-03-11 18:53:38.572 (Tuya - Tuya SmartPlug (W)) Updating device from 0:'0.0' to have values 0:'0.0'.
2020-03-11 18:53:38.575 (Tuya) Updated: 0.0 Ampere Key is:3
2020-03-11 18:53:38.575 (Tuya) Updated: 0.0 Watt Key is:14
2020-03-11 18:53:38.575 (Tuya) Updated: 227.8 Voltage Key is:15
2020-03-11 18:53:48.448 (Tuya) Pushing 'onHeartbeatCallback' on to queue
2020-03-11 18:53:48.490 (Tuya) Processing 'onHeartbeatCallback' message

I can't read the dps

Hello, I bought a multi plug.
http://www.aliexpress.com/item/WiFi-Smart-Power-Strip-EU-Plug-Surge-Protector-6-Socket-with-USB-Port-Remote-Control-Switch/32931245092.html?spm= a2g0s.9042311.0.0.1ec65c0fLypEZr
I extracted the tuya.cli key.
I can't read the dps.
A prompt is displayed to try again.
I added 1 dps to the trial.
Nothing happens when the switch is pressed.
In Domoticz I have this error:
2019-11-26 21:08:09.655 (Smart-Power-Strip-EU-Plug) requeuing 'onHeartbeatCallback' message for 'shelly_mqtt'

2019-11-26 21:08:09.974 (Smart-Power-Strip-EU-Plug) Debug logging mask set to: NONE

2019-11-26 21:08:09.244 Status: (Smart-Power-Strip-EU-Plug) Stop directive received.

2019-11-26 21:08:09.245 Status: (Smart-Power-Strip-EU-Plug) Exiting work loop.

2019-11-26 21:08:09.746 Status: (Smart-Power-Strip-EU-Plug) Stopping threads.

2019-11-26 21:08:09.746 Status: (Smart-Power-Strip-EU-Plug) Stopped.

2019-11-26 21:08:09.746 Status: (Smart-Power-Strip-EU-Plug) Started.

2019-11-26 21:08:09.971 Status: (Smart-Power-Strip-EU-Plug) Entering work loop.

2019-11-26 21:08:09.972 Status: (Smart-Power-Strip-EU-Plug) Initialized version 3.0.0, author 'tixi'

Warning in log

Hello
From today I can read this in the log every 20 seconds

2019-09-27 23:28:30.699 Status: Warning: Notification NOT handled (Hardware: 24 - Tuya, ID: , Unit: 3, Type: 00 - Interface Control, SubType: 0 - Unknown), please report on GitHub!
2019-09-27 23:28:30.704 Status: Warning: Notification NOT handled (Hardware: 24 - Tuya, ID: , Unit: 5, Type: 00 - Interface Control, SubType: 0 - Unknown), please report on GitHub!
2019-09-27 23:28:30.711 Status: Warning: Notification NOT handled (Hardware: 24 - Tuya, ID: , Unit: 3, Type: 00 - Interface Control, SubType: 0 - Unknown), please report on GitHub!
2019-09-27 23:28:30.715 Status: Warning: Notification NOT handled (Hardware: 24 - Tuya, ID: , Unit: 5, Type: 00 - Interface Control, SubType: 0 - Unknown), please report on GitHub!
2019-09-27 23:28:30.717 Status: Warning: Notification NOT handled (Hardware: 24 - Tuya, ID: , Unit: 6, Type: 00 - Interface Control, SubType: 0 - Unknown), please report on GitHub!
2019-09-27 23:28:50.808 Status: Warning: Notification NOT handled (Hardware: 24 - Tuya, ID: , Unit: 3, Type: 00 - Interface Control, SubType: 0 - Unknown), please report on GitHub!

Any ideas ?

Thermostat Tuya

Hello, I don't know English so I use a translator. I apologize for the mistakes.
I bought Cronos Ir heaters.
I installed a plugin, thermostat but unfortunately it doesn't work.
https://github.com/iasmanis/Domoticz-Tuya-Thermostat-Plugin.git
My dps list
1 switch
2 thermostat
4 switch but I don't know from what.
5 temperature sensor
7 timer
8 timer switch.
Can you improve the plugin to add 3 devices to domoticz.
a> switch
b> thermostat
c> temperature sensor

Get_dps.py results:
Plug State Information:
{'devId': '10401808xxxxxxxx5340', 'dps': {'4': False, '7': 60, '5': 19, '8': False, '2': 25, '1': True}}

Plug DPS List:
4;8;1
Domoticz Error list:
2019-11-08 12:14:46.756 Status: (heaters) Started.

2019-11-08 12:14:47.047 (heaters) Debug logging mask set to: NONE

2019-11-08 12:14:47.048 (heaters) Tuya Thermostat Control #1 created.

2019-11-08 12:14:47.049 (heaters) Tuya Thermostat #1 created.

2019-11-08 12:14:47.050 (heaters) Tuya Thermostat Control #2 created.

2019-11-08 12:14:47.051 (heaters) Tuya Thermostat #2 created.

2019-11-08 12:14:47.044 Status: (heaters) Entering work loop.

2019-11-08 12:14:47.044 Status: (heaters) Initialized version 3.0.0, author 'tixi'

2019-11-08 12:14:50.071 Error: (heaters): Async Read Exception (192.168.1.33:6668): 104, Connection reset by peer

2019-11-08 12:14:50.076 Error: (heaters) No transport, write directive to 'Tuya' ignored.

Confused instruction

A haven't a proxy on my Android and tryed the adb method. but no localKey, only deviceId and productId are present in the log

Tuya 3.3 version support

As Many know Action Sells some Tuya Device

I have a Smart Plug (FW 1.1.5) and a led strip (1.1.6)

They doesn't work with the plugin because they need Tuya 3.3 version support.

Python Lib used on this plugin allow Tuya 3.3 version support since 3 mounth know :

https://github.com/clach04/python-tuya/blob/master/pytuya/__init__.py

I Try Tuya-Cli using v3.3 spec and i can connect and read DSP of my device.

This can be great if this plugin can be update and allow use to choose version to use.

Thanx

Key Error

Hello
I could see some errors in Domoticz logs.
In the line 445

for key in self.__plugs:				
			error = error or self.__plugs[key].update_state(state[str(key)])	
			Devices[key+1].Update(0,str(state[str(self.__ampere)]/1000))	# TypeName="Current (Single)
			Devices[key+2].Update(0,str(state[str(self.__watt)]/10) + ";0")	# kWh / Calculated
			Devices[key+3].Update(0,str(state[str(self.__voltage)]/10)) 	# TypeName="Voltage"
		#	Devices[key+4].Update(0,str(state[str(self.__watt)]/10)) 		# TypeName="Usage"

If I comment this line , no error.

It seems that the "usage" is added and we can collect 4 indicators.

But I've got an error message if I add more than 3 dps in the UI.

I can't find a solution for this.

Thanks for any feedback.

Domoticz crashes or hangs with plugin

Hi
I'm want to use this plugin with the LSC/Tuya bulbs.
the get_dsp.py and on/off scripts are working fine,
after changing the version from 3.1 to 3.3
the plugin is not working,
after creating the first bulb, domoticz crashes:

Error: (tixi_tuya_smartplug_plugin) failed to load 'plugin.py', Python Path used was ':/usr/lib/python3.4/:/usr/lib/python3.4/plat-arm-linux-gnueabihf:/usr/lib/python3.4/lib-dynload:/usr/local/lib/python3.4/dist-packages:/usr/lib/python3/dist-packages:/usr/lib/python3.4/dist-packages:/usr/lib/dist-python'.
2020-02-04 13:59:10.320 Error: (LedLamp01) Module Import failed, exception: 'ImportError'
2020-02-04 13:59:10.320 Error: (LedLamp01) Module Import failed: ' Name: plugin'
2020-02-04 13:59:10.320 Error: (LedLamp01) Error Line details not available.

after restaring domoticz, you see in the log:
Status: (LedLamp01) Started.

but after a short time domoticz hangs and is not reacting on anything
have to remove the plugin to get it working again.
using Domoticz 4.11652

Power/Ampere/Current Support

I have a tuya smart plug with energy meter.
https://www.amazon.co.uk/gp/product/B07K24QZHN/ref=ppx_yo_dt_b_asin_title_o00__o00_s00?ie=UTF8&psc=1

I managed to get work this plugin in Domoticz but it can only turn off and on and doesn't provide information from the meter.

The get_dps.py request returns info from the meter, I guess:

`domoticz@housespririt:~/domoticz/plugins/Domoticz-Tuya-SmartPlug-Plugin$ sudo python3 get_dps.py 192.168.10.172 11444708600194c04232

Plug State Information:
{'dps': {'1': False, '5': 0, '2': 0, '6': 2385, '4': 0}, 'devId': '11444708600194c04232'}

Plug DPS List:
1
domoticz@housespririt:~/domoticz/plugins/Domoticz-Tuya-SmartPlug-Plugin$`

kwh

Hi Tixi, i am using a BW-SHP6, works perfectly. ON/OFF
But do you think there is a way to get the kwh meter working with this ?
Thanks

Originally posted by @hikey in #2 (comment)

Problem with getting DevID and Local Key or something else

I don't know if I use bad DevID and LocalKey or is there a bug in this scripts. I cannot connect to Tuya-SmartPlug from domoticz. There is no error on log in Domoticz but when I use CLI and start script ./turnOFF.py I've got A problem occur please retry... [Errno 104] Connection reset by peer. Also in the official app is diffrent IP that I set static on my router.

I think I'm doing something wrong when I getting DevID and LocalKey but dunno what. Could you help me?

Interrupteur wifi et DZ

bonjour,
Je viens d'associer des interrupteur wifi acheté sur Ali qui fonctionnent avec SMARTLIFE.
Il y en à 1 que je n'ai pas mis à jour et fonctionne très bien avec DZ
J'en ai 3 avec le dernier firmware WIFI et MCU 1.1.5 et j'ai maintenant cette erreurnn sur ces peripheriques:
Async Read Exception: 104, Connection reset by peer

Plugin does not work. Plugin.py expects decoded data

The latest antela tuya smart plug sends encrypted data to to the plugin. The plugin.py however expects non-crypted for the onMessage handling. What to do? The plugin was written couple of years ago, but things changed. Is there still support to update the plugin for encoded tuya data??
This is the data I receive:

00 00 55 aa 00 00 00 00 00 00 00 0a 00 00 00 9c 00 00 00 00
fc 10 74 3f f3 67 30 d3 ee 1a c8 f6 6d 3c 12 b7 b9 fc 4c ae
0c 61 27 95 5a 56 a1 64 15 1c 9b 92 3b 7e 96 b5 d5 3f d7 74
da 33 44 c6 32 d7 44 85 58 e1 3d ef 26 3c cb 13 15 5c e4 16
78 79 da dc 60 b1 c6 4b c4 6f 93 20 35 f1 4d 9b 47 da d1 93
06 ad b1 c1 06 b5 a8 67 77 fb b8 2c 71 fd ff c5 a0 98 79 ad
b6 06 c7 57 2b 4a 30 f5 e4 f3 33 d3 ed e9 6e f7 e2 e5 78 19
d7 d4 f8 a3 a3 f3 79 0d c8 06 3d 31 7e ad 9c 12 c9 2a c5 5c
4a fd 9a a6 53 3b cc 86 00 00 aa 55 .. .. .. .. .. .. .. ..

doesnt look decoded to me. Anyone an idea how to decrypt?

Error pytuya m’y mistake

I dont know what to do now Pls help

2020-09-06 07:13:52.335 Error: (tixi_tuya_smartplug_plugin) failed to load 'plugin.py', Python Path used was '/usr/local/domoticz/var/plugins/Domoticz-Tuya-SmartPlug-Plugin/:/volume3/@appstore/py3k/usr/local/lib/python35.zip:/volume3/@appstore/py3k/usr/local/lib/python3.5/:/volume3/@appstore/py3k/usr/local/lib/python3.5/plat-linux:/volume3/@appstore/py3k/usr/local/lib/python3.5/lib-dynload:/volume3/@appstore/py3k/usr/local/lib/python3.5/site-packages'. 2020-09-06 07:13:52.335 Error: (Mon lit) Module Import failed, exception: 'ImportError' 2020-09-06 07:13:52.335 Error: (Mon lit) Module Import failed: ' Name: pytuya' 2020-09-06 07:13:52.335 Error: (Mon lit) Error Line details not available.

Plugin not working

Hello.

I have Domoticz 2020.2, installed everything, but the plugin not working. In the Domoticz log I have:

'onMessage' failed 'TypeError':'onMessage() missing 2 required positional arguments: 'Connection' and 'Data''.

When I try to use the get_dps.py, I have:

Unexpected status() payload=b'\xb3\xc9\x80\xfd\x8a5a\xf1DB\xa2\xb8U\xf6\x08k\xbf\xab\xd6\x9bZ\xecO\xc7)\xb7\xb6}*\x02\xf5 '

Plug State Information:
b'\xb3\xc9\x80\xfd\x8a5a\xf1DB\xa2\xb8U\xf6\x08k\xbf\xab\xd6\x9bZ\xecO\xc7)\xb7\xb6}*\x02\xf5 '

Plug DPS List:
Traceback (most recent call last):
File "./get_dps.py", line 58, in
for key in data['dps'].keys():
TypeError: byte indices must be integers or slices, not str

I have the key etc, but something goes wrong :( . Help please.

Thanks

DPS 101 not recognized.

Strange issue. Got the device ID and local ID. See the device in domoticz. But when trying to switch, only the colour of the LED goes off.

Plug State Information:
{'devId': '12716401807d3a7b5c6b', 'dps': {'6': '00ff0000000000', '4': 255, '106' : 2272, '101': True, '1': True, '2': 'colour', '10': 'ffff0505ff000000ff00ffff00 ff00ff0000ff000000', '7': 'ffff500100ff00', '104': 0, '9': 'ffff5001ff0000', '8' : 'ffff8003ff000000ff000000ff000000000000000000', '3': 180, '5': '171918009c1919 ', '105': 0}}

This is what I see in domoticz. DPS 1 only shuts the LED off, but not the plug. DPS 101 is also in the list, but does nothing. Confused here. The device is lonsonho power plug from ali with power measurement.

with the turnoff.py and turnon.py I can seem to switch it with the DPS 101, but not in domoticz

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.