Page 10 of 19

Re: [REQUEST] Plugin for Tuya

Posted: Thursday 28 February 2019 17:59
by dorenberg
yes stupid me. It works with the setting computed. THe plug was 11.50 euros incl shipping so not that expensive hahaha
sincze wrote: Thursday 28 February 2019 16:51
dorenberg wrote: Thursday 28 February 2019 12:41 The counting seems not to work over here. Keeps 0.000 kwh. So maybe I did something wrong.

all info is available in the plug. Just in another json block.....

0.02 is in kWh of today. 0.43 is total.

{
"result": {
"thisDay": "0.02",
"sum": "0.43",
"years": {
"2019": {
"02": "0.43"
}
}
},
"t": 1549792047291,
"success": true,
"status": "ok"
}
Ok you have a more expensive plug that is for sure :lol:
I have it solved like this:
computed.JPG

Re: [REQUEST] Plugin for Tuya

Posted: Thursday 28 February 2019 19:20
by jslegers
Yes I'm very happy like a little kid nearly. :lol: :lol:
Sinze (my neighbor) did a excellent job. This is what I was looking for.

Image

I'm verry pleased with it.

This is the plug I used :

A 16A smart plug :
https://www.aliexpress.com/item/Mini-Sm ... 4c4dkWKHkb

The one Sinze tested is the following :

https://www.aliexpress.com/item/Smart-P ... 4c4dkWKHkb

Again I want to thank Sinze for making this in a very short time. :D :D

Re: [REQUEST] Plugin for Tuya

Posted: Thursday 28 February 2019 19:32
by dorenberg
Yes I share these thoughts completely. Going to order some more hahaha. Maybe better to order the ones you mentioned as these look better.

Re: [REQUEST] Plugin for Tuya

Posted: Sunday 03 March 2019 14:39
by sincze
The plugin was just updated.

Now it is possible to use the plugin "as-is".
No modification needed anymore in the constructor part. :lol:
It should work for all single sockets just fine.

I added the possibilitie to add the ID's for Amp. Watt. Volt in the hardware menu.
This is a huge advantage for additional plugs.
For each additional plug... Add a new hardware instance using the plugin and modify appropriate fields (IP, DevID, Local Key) as well.

Re: [REQUEST] Plugin for Tuya

Posted: Sunday 03 March 2019 16:29
by dorenberg
Just replaced my version with yours. Seems to work fine with the DPS selection

Re: [REQUEST] Plugin for Tuya

Posted: Sunday 03 March 2019 16:36
by sincze
dorenberg wrote: Sunday 03 March 2019 16:29 Just replaced my version with yours. Seems to work fine with the DPS selection
Excellent. Now you can buy more plugs :lol:

Re: [REQUEST] Plugin for Tuya

Posted: Sunday 03 March 2019 18:22
by dorenberg
Just looking into the computed power usage. It seems not correct anymore. Plug is contantly at 8-9watt and after 2 hours only 0.002kwh on the counter. What can be the cause for this?

Edit. With higher usage it seems correct.....

Re: [REQUEST] Plugin for Tuya

Posted: Monday 04 March 2019 22:49
by ZaGaPonG
Hi guys,

I got this error in Domoticz when I try to activate the plugin:

Code: Select all

Error: (sincze_tuya_smartplug_plugin) failed to load 'plugin.py', Python Path used was '/usr/local/domoticz/var/plugins/Domoticz-Tuya-SmartPlug-Plugin/:/volume1/@appstore/py3k/usr/local/lib/python35.zip:/volume1/@appstore/py3k/usr/local/lib/python3.5/:/volume1/@appstore/py3k/usr/local/lib/python3.5/plat-linux:/volume1/@appstore/py3k/usr/local/lib/python3.5/lib-dynload'
I have others Python plugins which works well and i could control my plug by lua event and dummy switch like this:

Code: Select all

if (devicechanged['Prise Gauche'] == "On") then
    os.execute('/volume1/@appstore/py3k/usr/local/bin/python3.5 /volume1/@appstore/domoticz/var/plugins/Domoticz-Tuya-SmartPlug-Plugin/turnON.py 192.168.0.33 66376420XXXXXX2a7e7e 5e2aeXXXXXX01d4 2')
elseif ....
But that would be really more easier if I could make workable your plugin on my device (my Domoticz his install on Synology by package).

cryptodome and other element install by pip3 are located there: /volume1/@appstore/py3k/usr/local/lib/python3.5/site-packages

Thanks in adavance.

Re: [REQUEST] Plugin for Tuya

Posted: Tuesday 05 March 2019 14:38
by sincze
ZaGaPonG wrote: Monday 04 March 2019 22:49 Hi guys,

I got this error in Domoticz when I try to activate the plugin:

Code: Select all

Error: (sincze_tuya_smartplug_plugin) failed to load 'plugin.py', Python Path used was '/usr/local/domoticz/var/plugins/Domoticz-Tuya-SmartPlug-Plugin/:/volume1/@appstore/py3k/usr/local/lib/python35.zip:/volume1/@appstore/py3k/usr/local/lib/python3.5/:/volume1/@appstore/py3k/usr/local/lib/python3.5/plat-linux:/volume1/@appstore/py3k/usr/local/lib/python3.5/lib-dynload'
I have others Python plugins which works well and i could control my plug by lua event and dummy switch like this:

Code: Select all

if (devicechanged['Prise Gauche'] == "On") then
    os.execute('/volume1/@appstore/py3k/usr/local/bin/python3.5 /volume1/@appstore/domoticz/var/plugins/Domoticz-Tuya-SmartPlug-Plugin/turnON.py 192.168.0.33 66376420XXXXXX2a7e7e 5e2aeXXXXXX01d4 2')
elseif ....
But that would be really more easier if I could make workable your plugin on my device (my Domoticz his install on Synology by package).

cryptodome and other element install by pip3 are located there: /volume1/@appstore/py3k/usr/local/lib/python3.5/site-packages

Thanks in adavance.
A you are using not a python plugin for this plug. Nor did you use the original tixi plugin but the external script.
That is missing the vital "import domoticz" part.
Can you check your other plugins are using the 'import domoticz" part in them? So we can figure out what goes wrong?

Re: [REQUEST] Plugin for Tuya

Posted: Tuesday 05 March 2019 15:57
by ZaGaPonG
sincze wrote: Tuesday 05 March 2019 14:38
ZaGaPonG wrote: Monday 04 March 2019 22:49 Hi guys,

I got this error in Domoticz when I try to activate the plugin:

Code: Select all

Error: (sincze_tuya_smartplug_plugin) failed to load 'plugin.py', Python Path used was '/usr/local/domoticz/var/plugins/Domoticz-Tuya-SmartPlug-Plugin/:/volume1/@appstore/py3k/usr/local/lib/python35.zip:/volume1/@appstore/py3k/usr/local/lib/python3.5/:/volume1/@appstore/py3k/usr/local/lib/python3.5/plat-linux:/volume1/@appstore/py3k/usr/local/lib/python3.5/lib-dynload'
I have others Python plugins which works well and i could control my plug by lua event and dummy switch like this:

Code: Select all

if (devicechanged['Prise Gauche'] == "On") then
    os.execute('/volume1/@appstore/py3k/usr/local/bin/python3.5 /volume1/@appstore/domoticz/var/plugins/Domoticz-Tuya-SmartPlug-Plugin/turnON.py 192.168.0.33 66376420XXXXXX2a7e7e 5e2aeXXXXXX01d4 2')
elseif ....
But that would be really more easier if I could make workable your plugin on my device (my Domoticz his install on Synology by package).

cryptodome and other element install by pip3 are located there: /volume1/@appstore/py3k/usr/local/lib/python3.5/site-packages

Thanks in adavance.
A you are using not a python plugin for this plug. Nor did you use the original tixi plugin but the external script.
That is missing the vital "import domoticz" part.
Can you check your other plugins are using the 'import domoticz" part in them? So we can figure out what goes wrong?
Hi,

Yes, i'm using NUT UPS (https://www.domoticz.com/wiki/Plugins/NUT_UPS.html) and just checking the plugin.py of this plugin, he use well "import Domoticz"

If that can help, full error below:

Code: Select all

 2019-03-05 15:42:44.241 Error: (sincze_tuya_smartplug_plugin) failed to load 'plugin.py', Python Path used was '/usr/local/domoticz/var/plugins/Domoticz-Tuya-SmartPlug-Plugin/:/volume1/@appstore/py3k/usr/local/lib/python35.zip:/volume1/@appstore/py3k/usr/local/lib/python3.5/:/volume1/@appstore/py3k/usr/local/lib/python3.5/plat-linux:/volume1/@appstore/py3k/usr/local/lib/python3.5/lib-dynload'.
2019-03-05 15:42:44.242 Error: (Test) Module Import failed, exception: 'ImportError'
2019-03-05 15:42:44.242 Error: (Test) Module Import failed: ' Name: pyaes'
2019-03-05 15:42:44.242 Error: (Test) Error Line details not available. 
As I don't know what is "pyaes" I have made a "pip show pyaes" and it seems stored in: "usr/lib/python2.7/site-packages" and used by pytuya, that's could be the problem no?
I'm waiting your feedback before trying something because I have already made too much muddle :lol:

Thanks for your support guy

Re: [REQUEST] Plugin for Tuya

Posted: Tuesday 05 March 2019 16:26
by sincze
ZaGaPonG wrote: Tuesday 05 March 2019 15:57 As I don't know what is "pyaes" I have made a "pip show pyaes" and it seems stored in: "usr/lib/python2.7/site-packages" and used by pytuya, that's could be the problem no?
I'm waiting your feedback before trying something because I have already made too much muddle :lol:

Thanks for your support guy
:D Nice work.
Looks like you found the missing part why the plugin is not working for you with Python 3.x
I assume that is why the plug_on / off is working as it is probably using the 2.7 version.

Re: [REQUEST] Plugin for Tuya

Posted: Tuesday 05 March 2019 17:38
by ZaGaPonG
sincze wrote: Tuesday 05 March 2019 16:26
ZaGaPonG wrote: Tuesday 05 March 2019 15:57 As I don't know what is "pyaes" I have made a "pip show pyaes" and it seems stored in: "usr/lib/python2.7/site-packages" and used by pytuya, that's could be the problem no?
I'm waiting your feedback before trying something because I have already made too much muddle :lol:

Thanks for your support guy
:D Nice work.
Looks like you found the missing part why the plugin is not working for you with Python 3.x
I assume that is why the plug_on / off is working as it is probably using the 2.7 version.
Haha, thanks.
But have you a tips for me... I'm lost :oops:
I have installed pyaes from pip3 and uninstall it with pip.
So pyaes is present into python3.5/site-packages and not in python2.7/site-packages --> Nice

But the problem seems being the same. Did you know how to specify using python3.5 "library"?

I have tried to add a "sys.path.insert" into "__init__.py" from pytuya but my Domoticz crash totally, too much muddle :lol:

Re: [REQUEST] Plugin for Tuya

Posted: Monday 01 April 2019 14:33
by emylive
Hi everybody,

do you know if the rolling shutter switch tuya/smartlife could be supported in Domoticz?
https://www.aliexpress.com/item/Tuya-Sm ... Title=true

Re: [REQUEST] Plugin for Tuya

Posted: Sunday 14 April 2019 12:14
by merlot
Hello,

I'm just beginning with domoticz, which I've installed 4.97 in a raspi, and I have set up a Xiaomi Control Hub, and its devices, and I've been struggling with a Tuya Smat Plug for a few days now. But, unsuccessfully :(

I've solved some missing libraries, I've got the ID's with Packet Capture, but now I can't go further.

In the register, with Degug=1, I just see
Spoiler: show
2019-04-14 12:03:20.175 (eEndoll Parking) Pushing 'DisconnectedEvent' on to queue
2019-04-14 12:03:20.183 PluginSystem: Restarting I/O service thread.
2019-04-14 12:03:20.183 (eEndoll Parking) Processing 'DisconnectedEvent' message
2019-04-14 12:03:20.184 (eEndoll Parking) Disconnect event received for '192.168.1.66:6668'.
2019-04-14 12:03:20.184 (eEndoll Parking) Pushing 'onDisconnectCallback' on to queue
2019-04-14 12:03:20.184 (eEndoll Parking) Processing 'onDisconnectCallback' message
2019-04-14 12:03:20.184 (eEndoll Parking) Calling message handler 'onDisconnect'.
2019-04-14 12:03:20.184 (eEndoll Parking) Disconnected from: 192.168.1.66:6668
2019-04-14 12:03:20.454 (eEndoll Parking) Pushing 'onHeartbeatCallback' on to queue
2019-04-14 12:03:20.484 (eEndoll Parking) Processing 'onHeartbeatCallback' message
2019-04-14 12:03:20.485 (eEndoll Parking) Calling message handler 'onHeartbeat'.
2019-04-14 12:03:20.175 Error: (eEndoll Parking): Async Read Exception: 104, Connection reset by peer
2019-04-14 12:03:30.456 (eEndoll Parking) Pushing 'onHeartbeatCallback' on to queue
2019-04-14 12:03:30.501 (eEndoll Parking) Processing 'onHeartbeatCallback' message
2019-04-14 12:03:30.501 (eEndoll Parking) Calling message handler 'onHeartbeat'.
2019-04-14 12:03:30.502 (eEndoll Parking) Pushing 'ConnectDirective' on to queue
2019-04-14 12:03:30.502 (eEndoll Parking) Processing 'ConnectDirective' message
2019-04-14 12:03:30.502 (eEndoll Parking) Transport set to: 'TCP/IP', 192.168.1.66:6668.
2019-04-14 12:03:30.502 PluginSystem: Starting I/O service thread.
2019-04-14 12:03:30.502 (eEndoll Parking) Connect directive received, action initiated successfully.
2019-04-14 12:03:30.524 (eEndoll Parking) Pushing 'onConnectCallback' on to queue
2019-04-14 12:03:30.552 (eEndoll Parking) Processing 'onConnectCallback' message
2019-04-14 12:03:30.552 (eEndoll Parking) Calling message handler 'onConnect'.
2019-04-14 12:03:30.552 (eEndoll Parking) Connected successfully to: 192.168.1.66:6668
2019-04-14 12:03:30.553 (eEndoll Parking) Pushing 'WriteDirective' on to queue
And some sending and receiving data

If I run the sudo python3 get_dps.py IP DID I get
Spoiler: show
Unexpected status() payload=b"3.3\x00\x00\x00\x00\x00\x00\x03\xbc\x00\x00\x00\x01/rS\xe0tH\xdb\x16r|\xb3\xc7\xea\x8bL\x1b\xc1KX+\xcd%$\x18\xd8\xe9\x04\xf2\x93\x06wr\xca\xc4\xa0'\\APd\x1bU\xe8A\x8b\xb3\xfeT\x06\xec\xb0\x19\xbf=n\xf9\x97i\x85\x8a\xbd\xce\xbc~\x9d,\xffPLQ\xbcD\xb9~\x1c\xabN;\x14O"

Plug State Information:
b"3.3\x00\x00\x00\x00\x00\x00\x03\xbc\x00\x00\x00\x01/rS\xe0tH\xdb\x16r|\xb3\xc7\xea\x8bL\x1b\xc1KX+\xcd%$\x18\xd8\xe9\x04\xf2\x93\x06wr\xca\xc4\xa0'\\APd\x1bU\xe8A\x8b\xb3\xfeT\x06\xec\xb0\x19\xbf=n\xf9\x97i\x85\x8a\xbd\xce\xbc~\x9d,\xffPLQ\xbcD\xb9~\x1c\xabN;\x14O"

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
And I don't know how what else to do. Any suggestion?

Thank you

Re: [REQUEST] Plugin for Tuya

Posted: Sunday 14 April 2019 20:22
by merlot
ZaGaPonG wrote: Tuesday 05 March 2019 17:38
sincze wrote: Tuesday 05 March 2019 16:26
ZaGaPonG wrote: Tuesday 05 March 2019 15:57 As I don't know what is "pyaes" I have made a "pip show pyaes" and it seems stored in: "usr/lib/python2.7/site-packages" and used by pytuya, that's could be the problem no?
I'm waiting your feedback before trying something because I have already made too much muddle :lol:

Thanks for your support guy
:D Nice work.
Looks like you found the missing part why the plugin is not working for you with Python 3.x
I assume that is why the plug_on / off is working as it is probably using the 2.7 version.
Haha, thanks.
But have you a tips for me... I'm lost :oops:
I have installed pyaes from pip3 and uninstall it with pip.
So pyaes is present into python3.5/site-packages and not in python2.7/site-packages --> Nice

But the problem seems being the same. Did you know how to specify using python3.5 "library"?

I have tried to add a "sys.path.insert" into "__init__.py" from pytuya but my Domoticz crash totally, too much muddle :lol:
If you're still having the problem with pyaes, I just linked the directory in the python directory into the plugin directory with ln -s

Just in case it works for you

Re: [REQUEST] Plugin for Tuya

Posted: Sunday 14 April 2019 20:27
by merlot
sincze wrote: Sunday 03 March 2019 16:36
dorenberg wrote: Sunday 03 March 2019 16:29 Just replaced my version with yours. Seems to work fine with the DPS selection
Excellent. Now you can buy more plugs :lol:
Where can I find your version? I have a single plug.

I'm using the "oficial" one, but without success so far :(

Thank you for your job

Re: [REQUEST] Plugin for Tuya

Posted: Sunday 14 April 2019 22:08
by merlot
Hi again,
I've found the tixi_sincze version just reading some more messages than I'd already read. :roll:
But no success either
Spoiler: show
No handlers could be found for logger "pytuya"

Plug State Information:
3.3'/rS▒tH▒r|▒▒▒LKX+▒%$▒▒▒wr▒E▒▒e%▒d~▒▒`!▒▒^▒qo4▒0|▒>▒d▒▒Š#▒ƾ▒▒Ϧ▒`▒▒▒▒

Plug DPS List:
Traceback (most recent call last):
File "./get_dps.py", line 58, in <module>
for key in data['dps'].keys():
TypeError: string indices must be integers, not str
And some time I've seen
Spoiler: show
Traceback (most recent call last):
File "./get_dps.py", line 47, in <module>
except (ConnectionResetError, socket.timeout, OSError) as e:
NameError: name 'ConnectionResetError' is not defined
It seems that I have to keep using its own app, Smart Life, without integration to other devices through scenes :cry:

Re: [REQUEST] Plugin for Tuya

Posted: Monday 15 April 2019 10:15
by sincze
merlot wrote: Sunday 14 April 2019 22:08 Hi again,
I've found the tixi_sincze version just reading some more messages than I'd already read. :roll:
But no success either
Spoiler: show
No handlers could be found for logger "pytuya"

Plug State Information:
3.3'/rS▒tH▒r|▒▒▒LKX+▒%$▒▒▒wr▒E▒▒e%▒d~▒▒`!▒▒^▒qo4▒0|▒>▒d▒▒Š#▒ƾ▒▒Ϧ▒`▒▒▒▒

Plug DPS List:
Traceback (most recent call last):
File "./get_dps.py", line 58, in <module>
for key in data['dps'].keys():
TypeError: string indices must be integers, not str
And some time I've seen
Spoiler: show
Traceback (most recent call last):
File "./get_dps.py", line 47, in <module>
except (ConnectionResetError, socket.timeout, OSError) as e:
NameError: name 'ConnectionResetError' is not defined
It seems that I have to keep using its own app, Smart Life, without integration to other devices through scenes :cry:
Interesting, We have several happy users of the created tixie_sincze plugin.https://github.com/sincze/Domoticz-Tuya ... lug-Plugin
What plug are you using? (link)?

Re: [REQUEST] Plugin for Tuya

Posted: Monday 15 April 2019 14:31
by merlot
I'm using the one in the URL you've just posted.
Do I have to use the beta version of Domoticz or just the last stable one?

Regarding the plug, is this one, in Spanish

https://images.app.goo.gl/U4ULMRcAbHA4NmRM6

Enviado desde mi Redmi Note 4 mediante Tapatalk



Re: [REQUEST] Plugin for Tuya

Posted: Monday 15 April 2019 15:49
by sincze
merlot wrote: Monday 15 April 2019 14:31 I'm using the one in the URL you've just posted.
Do I have to use the beta version of Domoticz or just the last stable one?

Regarding the plug, is this one, in Spanish

https://images.app.goo.gl/U4ULMRcAbHA4NmRM6

Enviado desde mi Redmi Note 4 mediante Tapatalk
The sincze variant plugin works on latest stable and beta of that time of release.
However the separate scripts should provide you with nice readable dps keys.
It seems it does not do such a thing for you for some reason.