[REQUEST] Plugin for Tuya

Python and python framework

Moderator: leecollings

Post Reply
maks87
Posts: 5
Joined: Thursday 03 January 2019 12:47
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: [REQUEST] Plugin for Tuya

Post 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?
manutremo
Posts: 67
Joined: Saturday 19 November 2016 17:02
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: [REQUEST] Plugin for Tuya

Post 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]
tixi7
Posts: 52
Joined: Monday 10 September 2018 23:49
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: [REQUEST] Plugin for Tuya

Post 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?
tixi7
Posts: 52
Joined: Monday 10 September 2018 23:49
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: [REQUEST] Plugin for Tuya

Post 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?
tixi7
Posts: 52
Joined: Monday 10 September 2018 23:49
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: [REQUEST] Plugin for Tuya

Post 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.
jordipalet
Posts: 12
Joined: Sunday 09 December 2018 10:33
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: [REQUEST] Plugin for Tuya

Post 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 ...
jslegers
Posts: 34
Joined: Tuesday 23 February 2016 9:14
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.9700
Location: NL
Contact:

Re: [REQUEST] Plugin for Tuya

Post 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
jslegers
Posts: 34
Joined: Tuesday 23 February 2016 9:14
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.9700
Location: NL
Contact:

Re: [REQUEST] Plugin for Tuya

Post 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.
dorenberg
Posts: 110
Joined: Monday 22 June 2015 20:18
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.10982
Location: Veghel, The Netherlands
Contact:

Re: [REQUEST] Plugin for Tuya

Post 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.
jslegers
Posts: 34
Joined: Tuesday 23 February 2016 9:14
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.9700
Location: NL
Contact:

Re: [REQUEST] Plugin for Tuya

Post 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.
tixi7
Posts: 52
Joined: Monday 10 September 2018 23:49
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: [REQUEST] Plugin for Tuya

Post 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!
DAVIZINHO
Posts: 234
Joined: Sunday 27 August 2017 18:00
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Spain
Contact:

Re: [REQUEST] Plugin for Tuya

Post 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?
jslegers
Posts: 34
Joined: Tuesday 23 February 2016 9:14
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.9700
Location: NL
Contact:

Re: [REQUEST] Plugin for Tuya

Post 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.
DAVIZINHO
Posts: 234
Joined: Sunday 27 August 2017 18:00
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Spain
Contact:

Re: [REQUEST] Plugin for Tuya

Post 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 :-(
tixi7
Posts: 52
Joined: Monday 10 September 2018 23:49
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: [REQUEST] Plugin for Tuya

Post 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.
DAVIZINHO
Posts: 234
Joined: Sunday 27 August 2017 18:00
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Spain
Contact:

Re: [REQUEST] Plugin for Tuya

Post by DAVIZINHO »

ouch :-(

I will search info to flash the smart plug with espurna

thanks!
manutremo
Posts: 67
Joined: Saturday 19 November 2016 17:02
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: [REQUEST] Plugin for Tuya

Post by manutremo »

Should be doable using the information here:

https://github.com/xoseperez/espurna/wi ... ZLD-44EU-W
DAVIZINHO
Posts: 234
Joined: Sunday 27 August 2017 18:00
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Spain
Contact:

Re: [REQUEST] Plugin for Tuya

Post 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!
Piwek
Posts: 2
Joined: Friday 24 August 2018 23:27
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: [REQUEST] Plugin for Tuya

Post 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
tixi7
Posts: 52
Joined: Monday 10 September 2018 23:49
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: [REQUEST] Plugin for Tuya

Post 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
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 0 guests