Page 6 of 19

Re: [REQUEST] Plugin for Tuya

Posted: Tuesday 08 January 2019 14:34
by maks87
I have Neo Coolcam Plug with with energy measurement. In Tuya Smart on smartphone it's works very well, but in Domoticz I use this plugin, but it have only on/off switch. This plugin don't have energy measurement. It's possibile to add energy measurement on Domoticz?

Re: [REQUEST] Plugin for Tuya

Posted: Friday 11 January 2019 18:11
by manutremo
Since I updated to last beta 4.10343, I started to see Domoticz crashing after some minutes after start. I traced down the problem to the Tuya plugin. As soon as I disabled it, domoticz didn't crash any more. See below the last lines in the domoticz.log file right before crashing, in case it helps figure out the problem.

Code: Select all

2019-01-11 16:22:30.438  Error: Domoticz(pid:9358, tid:9440('PluginMgr_IO')) received fatal signal 11 (Segmentation fault)
2019-01-11 16:22:30.438  Error: siginfo address=(nil), address=(nil)
2019-01-11 16:22:30.478  Error: Failed to start gdb, will use backtrace() for printing stack frame

2019-01-11 16:22:30.479  Error: #0  /usr/local/domoticz/bin/domoticz() [0x6874f0]
2019-01-11 16:22:30.479  Error: #1  /usr/local/domoticz/bin/domoticz : signal_handler(int, siginfo_t*, void*) + 0x295 [0x688255]
2019-01-11 16:22:30.479  Error: #2  /lib/libpthread.so.0 :  + 0x101c0 [0x7f45ee6aa1c0]

Re: [REQUEST] Plugin for Tuya

Posted: Saturday 12 January 2019 8:38
by tixi7
jordipalet wrote: Saturday 05 January 2019 11:28 Not sure what is the DPS and how to get it.

I want the dimmer to be able to dim as well ... that's why I can't use the smartplug one (it works, but doesn't allow dimming).

This is the change I did in the bulb code for the dimmer to work (without colors, as it is not RGB, just dimmer):

it was:

Domoticz.Device(Name="Tuya SmartBulb", Unit=1, Type=241, Subtype=2, Switchtype=7).Create()


Now is:

Domoticz.Device(Name="Tuya SmartBulb", Unit=1, Type=244, Subtype=62, Switchtype=7).Create()

Thanks!
Can you try the plug plugin just for testing?

Re: [REQUEST] Plugin for Tuya

Posted: Saturday 12 January 2019 8:42
by tixi7
maks87 wrote: Tuesday 08 January 2019 14:34 I have Neo Coolcam Plug with with energy measurement. In Tuya Smart on smartphone it's works very well, but in Domoticz I use this plugin, but it have only on/off switch. This plugin don't have energy measurement. It's possibile to add energy measurement on Domoticz?
I don't know. Can you post the get_dps.py output?

Re: [REQUEST] Plugin for Tuya

Posted: Saturday 12 January 2019 9:09
by tixi7
manutremo wrote: Friday 11 January 2019 18:11 Since I updated to last beta 4.10343, I started to see Domoticz crashing after some minutes after start. I traced down the problem to the Tuya plugin. As soon as I disabled it, domoticz didn't crash any more. See below the last lines in the domoticz.log file right before crashing, in case it helps figure out the problem.

Code: Select all

2019-01-11 16:22:30.438  Error: Domoticz(pid:9358, tid:9440('PluginMgr_IO')) received fatal signal 11 (Segmentation fault)
2019-01-11 16:22:30.438  Error: siginfo address=(nil), address=(nil)
2019-01-11 16:22:30.478  Error: Failed to start gdb, will use backtrace() for printing stack frame

2019-01-11 16:22:30.479  Error: #0  /usr/local/domoticz/bin/domoticz() [0x6874f0]
2019-01-11 16:22:30.479  Error: #1  /usr/local/domoticz/bin/domoticz : signal_handler(int, siginfo_t*, void*) + 0x295 [0x688255]
2019-01-11 16:22:30.479  Error: #2  /lib/libpthread.so.0 :  + 0x101c0 [0x7f45ee6aa1c0]
Thanks, Unfortunately i have no time to manage all beta. In your case and according to the log, I am not sure it is plugin related because Segmentation fault should not be cause by python.

Re: [REQUEST] Plugin for Tuya

Posted: Saturday 12 January 2019 9:40
by jordipalet
tixi7 wrote: Saturday 12 January 2019 8:38
jordipalet wrote: Saturday 05 January 2019 11:28 Not sure what is the DPS and how to get it.

I want the dimmer to be able to dim as well ... that's why I can't use the smartplug one (it works, but doesn't allow dimming).

This is the change I did in the bulb code for the dimmer to work (without colors, as it is not RGB, just dimmer):

it was:

Domoticz.Device(Name="Tuya SmartBulb", Unit=1, Type=241, Subtype=2, Switchtype=7).Create()


Now is:

Domoticz.Device(Name="Tuya SmartBulb", Unit=1, Type=244, Subtype=62, Switchtype=7).Create()

Thanks!
Can you try the plug plugin just for testing?
It works with the plug plugin, but then doesn't dim. I'm not sure how to modify that one to make it dim ...

Re: [REQUEST] Plugin for Tuya

Posted: Sunday 13 January 2019 15:49
by jslegers
tixi7 wrote: Friday 23 November 2018 21:11 jslegers, for sure the plugin is not define for it and i don't know if the library can get it or not. Can you send me the result of the script get_dps.py.
Ok So I managed to get the ID and get the script to work finally. I have learned some lessons today :D :D .

This is the result of the A1-Mall Powerplug

pi@raspberrypi:~/domoticz/plugins/Domoticz-Tuya-SmartPlug-Plugin $ sudo python3 get_dps.py 192.168.1.126 00621010cc50e3c3d408

Plug State Information:
{'dps': {'2': 0, '4': 243, '6': 2392, '5': 42, '1': True}, 'devId': '00621010cc50e3c3d408'}

Plug DPS List:
1

So I think 6 is the Voltage and 4 is the current in mA and 5 is the wattage but that must be divide by 10

So it would great to get this in Domoticz like this :

Image

This one is a Neo CoolCam Z-Wave Plug

Re: [REQUEST] Plugin for Tuya

Posted: Sunday 13 January 2019 16:51
by jslegers
maks87 wrote: Tuesday 08 January 2019 14:34 I have Neo Coolcam Plug with with energy measurement. In Tuya Smart on smartphone it's works very well, but in Domoticz I use this plugin, but it have only on/off switch. This plugin don't have energy measurement. It's possibile to add energy measurement on Domoticz?
If it doesn't support energy measurement it will not be possible I guess.

Re: [REQUEST] Plugin for Tuya

Posted: Sunday 13 January 2019 19:11
by dorenberg
I am interested in this plugin. Does energy measurement work in Domoticz? For me this is not clear in this forum right now.

Re: [REQUEST] Plugin for Tuya

Posted: Monday 14 January 2019 7:48
by jslegers
dorenberg wrote: Sunday 13 January 2019 19:11 I am interested in this plugin. Does energy measurement work in Domoticz? For me this is not clear in this forum right now.
Energy measurement works in Domoticz. I use the NeoCoolcam ZWave plugs to get power readings. But the the Tuya plugs are cheaper so if we could get the power measurement from the plug to Domoticz that would be great.

Re: [REQUEST] Plugin for Tuya

Posted: Thursday 17 January 2019 21:30
by tixi7
For plugs that provide wattage information and if the information is just the entry 5 of the dps.
It should be possible to adapt the plugin to have it.

Not sure if and when i will have time to provide a beta version for that...
In case some developers want to contribute, i will be more than happy to have some help!

Re: [REQUEST] Plugin for Tuya

Posted: Sunday 20 January 2019 12:23
by DAVIZINHO
hello.
The plugin works fine for me with my 2 multiplugs powerstrip.
but sometimes and i dont know why the comand return to me this:

A problem occur please retry...

why occurs this? is posible any solution?

Re: [REQUEST] Plugin for Tuya

Posted: Sunday 20 January 2019 13:52
by jslegers
DAVIZINHO wrote: Sunday 20 January 2019 12:23 hello.
The plugin works fine for me with my 2 multiplugs powerstrip.
but sometimes and i dont know why the comand return to me this:

A problem occur please retry...

why occurs this? is posible any solution?
Do you have the device already in Domoticz (In the hardware list)?

I have found out to use the get_dsp.py script it must not be attached to Domoticz otherwise you will get this error.
I have found it this morning also. So when I go to hardware and change the IP address of the Plug the script works. If I set it to the correct IP address in Domoticz and I start the script I get this error. Looks like same behavior as when you use the Tuya app on your phone.

Re: [REQUEST] Plugin for Tuya

Posted: Sunday 20 January 2019 14:34
by DAVIZINHO
jslegers wrote: Sunday 20 January 2019 13:52
DAVIZINHO wrote: Sunday 20 January 2019 12:23 hello.
The plugin works fine for me with my 2 multiplugs powerstrip.
but sometimes and i dont know why the comand return to me this:

A problem occur please retry...

why occurs this? is posible any solution?
Do you have the device already in Domoticz (In the hardware list)?

I have found out to use the get_dsp.py script it must not be attached to Domoticz otherwise you will get this error.
I have found it this morning also. So when I go to hardware and change the IP address of the Plug the script works. If I set it to the correct IP address in Domoticz and I start the script I get this error. Looks like same behavior as when you use the Tuya app on your phone.
yes i have the strip in domoticz. but in this cases i want to use the turnON.py and turnOFF.py from start and stop in linux console :-(

Re: [REQUEST] Plugin for Tuya

Posted: Monday 21 January 2019 10:06
by tixi7
This is a "normal" behavior at least it is expected.

Only one connection is supported by tuya devices. Meaning that you cannot use the tuya app/domoticz plugin/helper script... at the same time.

Re: [REQUEST] Plugin for Tuya

Posted: Monday 21 January 2019 10:16
by DAVIZINHO
ouch :-(

I will search info to flash the smart plug with espurna

thanks!

Re: [REQUEST] Plugin for Tuya

Posted: Monday 21 January 2019 10:26
by manutremo
Should be doable using the information here:

https://github.com/xoseperez/espurna/wi ... ZLD-44EU-W

Re: [REQUEST] Plugin for Tuya

Posted: Monday 21 January 2019 10:34
by DAVIZINHO
manutremo wrote: Monday 21 January 2019 10:26 Should be doable using the information here:

https://github.com/xoseperez/espurna/wi ... ZLD-44EU-W
jeje.
this is the info i found yesterday. jeje
thanks anyway!

Re: [REQUEST] Plugin for Tuya

Posted: Thursday 24 January 2019 21:55
by Piwek
Hi,
I have this 3 gang watll switch,
https://goo.gl/SgVbVQ

How to add it to domoticz?

Plug State Information:
{'dps': {'5': 0, '2': False, '1': False, '3': False}, 'devId': 'xxxxxxxxxxxxxxxx'}

Plug DPS List:
2;1;3

Re: [REQUEST] Plugin for Tuya

Posted: Wednesday 30 January 2019 22:45
by tixi7
Some good news to avoid the limitations of tuya firmware.
OTA update is possible for alternative firmware:
https://www.heise.de/ct/artikel/Tuya-Co ... 84830.html