[REQUEST] Plugin for Tuya
Moderator: leecollings
-
tete
- Posts: 8
- Joined: Tuesday 11 September 2018 13:08
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: [REQUEST] Plugin for Tuya
I'm trying to configure a teckin sp22 plug but I get this message:
pi@domoticz:~/domoticz/plugins/Domoticz-Tuya-SmartPlug-Plugin $ ./get_dps.py 192.168.0.171 60417563840d8e68fe98
Unexpected status() payload=b'3.3\x00\x00\x00\x00\x00\x00\x9d\xa4\x00\x00\x00\x01N\xcc\x8f\xb0>@,B=\xbe\xe9 \xcf\xd2\x8f\\M\xce\xd4)U\xbe\xdb#x\x8dIF_\xd989\xc6\xd7x\x90\x00\xa8\xfa\xaf\x7f\xfb\xb0\x9a(\xf3\xa0\xb5\xad\x82\xd6\x06-\xa6)M\xcb\xffL\xf1u\x0cm\xf5\n\xeb\x8d\x94F\xd0\x8a\x9a\x1b\\^\xd2\x02\xe1\r\xea\xb1r\x08\x12}\xa0\xe5y3\xe9P\x07\x8f\xa5\xc0\xc3'
Plug State Information:
b'3.3\x00\x00\x00\x00\x00\x00\x9d\xa4\x00\x00\x00\x01N\xcc\x8f\xb0>@,B=\xbe\xe9 \xcf\xd2\x8f\\M\xce\xd4)U\xbe\xdb#x\x8dIF_\xd989\xc6\xd7x\x90\x00\xa8\xfa\xaf\x7f\xfb\xb0\x9a(\xf3\xa0\xb5\xad\x82\xd6\x06-\xa6)M\xcb\xffL\xf1u\x0cm\xf5\n\xeb\x8d\x94F\xd0\x8a\x9a\x1b\\^\xd2\x02\xe1\r\xea\xb1r\x08\x12}\xa0\xe5y3\xe9P\x07\x8f\xa5\xc0\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
I've got some more configured(not this model) and not had had any problems
Any suggest ?
pi@domoticz:~/domoticz/plugins/Domoticz-Tuya-SmartPlug-Plugin $ ./get_dps.py 192.168.0.171 60417563840d8e68fe98
Unexpected status() payload=b'3.3\x00\x00\x00\x00\x00\x00\x9d\xa4\x00\x00\x00\x01N\xcc\x8f\xb0>@,B=\xbe\xe9 \xcf\xd2\x8f\\M\xce\xd4)U\xbe\xdb#x\x8dIF_\xd989\xc6\xd7x\x90\x00\xa8\xfa\xaf\x7f\xfb\xb0\x9a(\xf3\xa0\xb5\xad\x82\xd6\x06-\xa6)M\xcb\xffL\xf1u\x0cm\xf5\n\xeb\x8d\x94F\xd0\x8a\x9a\x1b\\^\xd2\x02\xe1\r\xea\xb1r\x08\x12}\xa0\xe5y3\xe9P\x07\x8f\xa5\xc0\xc3'
Plug State Information:
b'3.3\x00\x00\x00\x00\x00\x00\x9d\xa4\x00\x00\x00\x01N\xcc\x8f\xb0>@,B=\xbe\xe9 \xcf\xd2\x8f\\M\xce\xd4)U\xbe\xdb#x\x8dIF_\xd989\xc6\xd7x\x90\x00\xa8\xfa\xaf\x7f\xfb\xb0\x9a(\xf3\xa0\xb5\xad\x82\xd6\x06-\xa6)M\xcb\xffL\xf1u\x0cm\xf5\n\xeb\x8d\x94F\xd0\x8a\x9a\x1b\\^\xd2\x02\xe1\r\xea\xb1r\x08\x12}\xa0\xe5y3\xe9P\x07\x8f\xa5\xc0\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
I've got some more configured(not this model) and not had had any problems
Any suggest ?
Re: [REQUEST] Plugin for Tuya
My understanding is that the tuya devices ( sensors ) or zigbee compliant and have been tested on Zigate.
-
tete
- Posts: 8
- Joined: Tuesday 11 September 2018 13:08
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: [REQUEST] Plugin for Tuya
No, these are not zigbee.
It seems as the output was different from what it expected.
It seems as the output was different from what it expected.
Re: [REQUEST] Plugin for Tuya
Indeed , you are right plug and bulb are not zigbeetete wrote:No, these are not zigbee.
It seems as the output was different from what it expected.
Envoyé de mon iPhone en utilisant Tapatalk
-
merlot
- Posts: 33
- Joined: Saturday 13 April 2019 16:36
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: [REQUEST] Plugin for Tuya
And some more time later ...
I've solved the mistery.
I was working with pytuya 7.0.3, but now I've seen that there is a 7.0.4 that includes support for 3.3 protocol while the previous one was just for 3.1.
Now, using that pytuya and adding a device.set_version(3.3) in the get_dps.py just before the device.status call it seems to work fine
Now I'll try the plugin, but the right solution would be to include this option as a parameter in Domoticz.
I've solved the mistery.
I was working with pytuya 7.0.3, but now I've seen that there is a 7.0.4 that includes support for 3.3 protocol while the previous one was just for 3.1.
Now, using that pytuya and adding a device.set_version(3.3) in the get_dps.py just before the device.status call it seems to work fine
- Spoiler: show
Now I'll try the plugin, but the right solution would be to include this option as a parameter in Domoticz.
merlot wrote: Sunday 16 June 2019 10:51 Simw time later ...
I have returned the previous smart plug and I've bought a new one, a double one for 16A.
And I'm having the same problems![]()
So, let's start form the begining.
Is a packet like the one below correct to get the devId and localkey?
Is this a packet that belongs to a tuya device that can be used by this plugin?
Thank you very much indeed
Plugin for a SMA Sunny Boy 1.5 https://github.com/merlot-dev/Domoticz-SMA-SunnyBoy
- sincze
- Posts: 1302
- Joined: Monday 02 June 2014 22:46
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2024.4
- Location: Netherlands / Breda Area
- Contact:
Re: [REQUEST] Plugin for Tuya
We could look into that integration indeed with a dropdown box 3.1 / 3.3 for now ?merlot wrote: Sunday 04 August 2019 16:29 And some more time later ...
I've solved the mistery.
I was working with pytuya 7.0.3, but now I've seen that there is a 7.0.4 that includes support for 3.3 protocol while the previous one was just for 3.1.
Now, using that pytuya and adding a device.set_version(3.3) in the get_dps.py just before the device.status call it seems to work fine
Now I have modified my copy of tixi_sincze plugin to set the protocol of my devices to 3.3.
- Spoiler: show
Now I'll try the plugin, but the right solution would be to include this option as a parameter in Domoticz.
Pass2php
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
-
merlot
- Posts: 33
- Joined: Saturday 13 April 2019 16:36
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: [REQUEST] Plugin for Tuya
Will you do? Or are you asking me to do it? I can try, but I'm a newbie in git and I'm not sure how to contribute.sincze wrote: Sunday 04 August 2019 17:05
We could look into that integration indeed with a dropdown box 3.1 / 3.3 for now ?
Anyway, after solving this issue, now, with the tixi_sincze plugin, after adding a dual plug, I get this error
- Spoiler: show
And in devices, this is what I get

2 Usage in W, the Voltage =0 (although get_dps_py returns 2325 for the ID=20) and not the second switch
have I configured something wrong in the parameters?
Thank you
Plugin for a SMA Sunny Boy 1.5 https://github.com/merlot-dev/Domoticz-SMA-SunnyBoy
-
merlot
- Posts: 33
- Joined: Saturday 13 April 2019 16:36
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: [REQUEST] Plugin for Tuya
payload=b'3.3 indicates your device is using protocol 3.3. So, which version of pytuya are you using? You need 7.0.4tete wrote: Sunday 28 July 2019 19:30 I'm trying to configure a teckin sp22 plug but I get this message:
pi@domoticz:~/domoticz/plugins/Domoticz-Tuya-SmartPlug-Plugin $ ./get_dps.py 192.168.0.171 60417563840d8e68fe98
Unexpected status() payload=b'3.3\x00\x00\x00\x00\x00\x00\x9d\xa4\x00\x00\x00\x01N\xcc\x8f\xb0>@,B=\xbe\xe9 \xcf\xd2\x8f\\M\xce\xd4)U\xbe\xdb#x\x8dIF_\xd989\xc6\xd7x\x90\x00\xa8\xfa\xaf\x7f\xfb\xb0\x9a(\xf3\xa0\xb5\xad\x82\xd6\x06-\xa6)M\xcb\xffL\xf1u\x0cm\xf5\n\xeb\x8d\x94F\xd0\x8a\x9a\x1b\\^\xd2\x02\xe1\r\xea\xb1r\x08\x12}\xa0\xe5y3\xe9P\x07\x8f\xa5\xc0\xc3'
Plug State Information:
b'3.3\x00\x00\x00\x00\x00\x00\x9d\xa4\x00\x00\x00\x01N\xcc\x8f\xb0>@,B=\xbe\xe9 \xcf\xd2\x8f\\M\xce\xd4)U\xbe\xdb#x\x8dIF_\xd989\xc6\xd7x\x90\x00\xa8\xfa\xaf\x7f\xfb\xb0\x9a(\xf3\xa0\xb5\xad\x82\xd6\x06-\xa6)M\xcb\xffL\xf1u\x0cm\xf5\n\xeb\x8d\x94F\xd0\x8a\x9a\x1b\\^\xd2\x02\xe1\r\xea\xb1r\x08\x12}\xa0\xe5y3\xe9P\x07\x8f\xa5\xc0\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
I've got some more configured(not this model) and not had had any problems
Any suggest ?
Plugin for a SMA Sunny Boy 1.5 https://github.com/merlot-dev/Domoticz-SMA-SunnyBoy
-
merlot
- Posts: 33
- Joined: Saturday 13 April 2019 16:36
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: [REQUEST] Plugin for Tuya
I answer myself. The problem for a dual socket plug is in this codemerlot wrote: Sunday 04 August 2019 23:15Will you do? Or are you asking me to do it? I can try, but I'm a newbie in git and I'm not sure how to contribute.sincze wrote: Sunday 04 August 2019 17:05
We could look into that integration indeed with a dropdown box 3.1 / 3.3 for now ?
Anyway, after solving this issue, now, with the tixi_sincze plugin, after adding a dual plug, I get this error
I have set DPS=1;2 and ID Amp;Watt;Volt =18;19;20 (I've got the ID's from Packet capture)
- Spoiler: show
And in devices, this is what I get
2 Usage in W, the Voltage =0 (although get_dps_py returns 2325 for the ID=20) and not the second switch
have I configured something wrong in the parameters?
Thank you
- Spoiler: show
It should be something like this
- Spoiler: show
Thank you
Plugin for a SMA Sunny Boy 1.5 https://github.com/merlot-dev/Domoticz-SMA-SunnyBoy
-
tete
- Posts: 8
- Joined: Tuesday 11 September 2018 13:08
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: [REQUEST] Plugin for Tuya
merlot wrote: Sunday 04 August 2019 23:17payload=b'3.3 indicates your device is using protocol 3.3. So, which version of pytuya are you using? You need 7.0.4tete wrote: Sunday 28 July 2019 19:30 I'm trying to configure a teckin sp22 plug but I get this message:
pi@domoticz:~/domoticz/plugins/Domoticz-Tuya-SmartPlug-Plugin $ ./get_dps.py 192.168.0.171 60417563840d8e68fe98
Unexpected status() payload=b'3.3\x00\x00\x00\x00\x00\x00\x9d\xa4\x00\x00\x00\x01N\xcc\x8f\xb0>@,B=\xbe\xe9 \xcf\xd2\x8f\\M\xce\xd4)U\xbe\xdb#x\x8dIF_\xd989\xc6\xd7x\x90\x00\xa8\xfa\xaf\x7f\xfb\xb0\x9a(\xf3\xa0\xb5\xad\x82\xd6\x06-\xa6)M\xcb\xffL\xf1u\x0cm\xf5\n\xeb\x8d\x94F\xd0\x8a\x9a\x1b\\^\xd2\x02\xe1\r\xea\xb1r\x08\x12}\xa0\xe5y3\xe9P\x07\x8f\xa5\xc0\xc3'
Plug State Information:
b'3.3\x00\x00\x00\x00\x00\x00\x9d\xa4\x00\x00\x00\x01N\xcc\x8f\xb0>@,B=\xbe\xe9 \xcf\xd2\x8f\\M\xce\xd4)U\xbe\xdb#x\x8dIF_\xd989\xc6\xd7x\x90\x00\xa8\xfa\xaf\x7f\xfb\xb0\x9a(\xf3\xa0\xb5\xad\x82\xd6\x06-\xa6)M\xcb\xffL\xf1u\x0cm\xf5\n\xeb\x8d\x94F\xd0\x8a\x9a\x1b\\^\xd2\x02\xe1\r\xea\xb1r\x08\x12}\xa0\xe5y3\xe9P\x07\x8f\xa5\xc0\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
I've got some more configured(not this model) and not had had any problems
Any suggest ?
Hi merlot,
I don't know what version I am using. How can I find out the version? How can I update it?
-
merlot
- Posts: 33
- Joined: Saturday 13 April 2019 16:36
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: [REQUEST] Plugin for Tuya
sudo pip3 show pytuyatete wrote: Monday 05 August 2019 9:53
Hi merlot,
I don't know what version I am using. How can I find out the version? How can I update it?
Unfortunately, I couldnn't upgrade using the --upgrade option in pip3 and I had to copy/paste the __init from the project git site.
Plugin for a SMA Sunny Boy 1.5 https://github.com/merlot-dev/Domoticz-SMA-SunnyBoy
-
tete
- Posts: 8
- Joined: Tuesday 11 September 2018 13:08
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: [REQUEST] Plugin for Tuya
Hi,merlot wrote: Monday 05 August 2019 11:06sudo pip3 show pytuyatete wrote: Monday 05 August 2019 9:53
Hi merlot,
I don't know what version I am using. How can I find out the version? How can I update it?
Unfortunately, I couldnn't upgrade using the --upgrade option in pip3 and I had to copy/paste the __init from the project git site.
I ran this command but nothing appears, but I have installed it during the plugin installation (git clone https://github.com/clach04/python-tuya.git)
If I run the test.py file of the pytuya installation, I get this output
pi@domoticz:~/domoticz/plugins/Domoticz-Tuya-SmartPlug-Plugin/python-tuya $ ./tests.py
INFO:pytuya:pytuya version 7.0.4
INFO:pytuya:Python 3.5.3 (default, Sep 27 2018, 17:25:39)
[GCC 6.3.0 20170516] on linux
INFO:pytuya:Using PyCrypto (2, 6, 1, 'final', 0)
INFO:pytuya:Using PyCrypto from '/home/pi/.local/lib/python3.5/site-packages/Crypto/__init__.py'
-
merlot
- Posts: 33
- Joined: Saturday 13 April 2019 16:36
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: [REQUEST] Plugin for Tuya
Then you can add device.set_version(3.3) in the get_dps.py after creating the device and the get_dps.py should worktete wrote: Monday 05 August 2019 11:51
Hi,
I ran this command but nothing appears, but I have installed it during the plugin installation (git clone https://github.com/clach04/python-tuya.git)
If I run the test.py file of the pytuya installation, I get this output
pi@domoticz:~/domoticz/plugins/Domoticz-Tuya-SmartPlug-Plugin/python-tuya $ ./tests.py
INFO:pytuya:pytuya version 7.0.4
INFO:pytuya:Python 3.5.3 (default, Sep 27 2018, 17:25:39)
[GCC 6.3.0 20170516] on linux
INFO:pytuya:Using PyCrypto (2, 6, 1, 'final', 0)
INFO:pytuya:Using PyCrypto from '/home/pi/.local/lib/python3.5/site-packages/Crypto/__init__.py'
Plugin for a SMA Sunny Boy 1.5 https://github.com/merlot-dev/Domoticz-SMA-SunnyBoy
-
tete
- Posts: 8
- Joined: Tuesday 11 September 2018 13:08
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: [REQUEST] Plugin for Tuya
Sorry, could you tell me how to do it?merlot wrote: Monday 05 August 2019 12:31Then you can add device.set_version(3.3) in the get_dps.py after creating the device and the get_dps.py should worktete wrote: Monday 05 August 2019 11:51
Hi,
I ran this command but nothing appears, but I have installed it during the plugin installation (git clone https://github.com/clach04/python-tuya.git)
If I run the test.py file of the pytuya installation, I get this output
pi@domoticz:~/domoticz/plugins/Domoticz-Tuya-SmartPlug-Plugin/python-tuya $ ./tests.py
INFO:pytuya:pytuya version 7.0.4
INFO:pytuya:Python 3.5.3 (default, Sep 27 2018, 17:25:39)
[GCC 6.3.0 20170516] on linux
INFO:pytuya:Using PyCrypto (2, 6, 1, 'final', 0)
INFO:pytuya:Using PyCrypto from '/home/pi/.local/lib/python3.5/site-packages/Crypto/__init__.py'
Thanks in advance.
-
merlot
- Posts: 33
- Joined: Saturday 13 April 2019 16:36
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: [REQUEST] Plugin for Tuya
@sincze I have modified the code and requested a pull in github.merlot wrote: Monday 05 August 2019 0:02
I answer myself. The problem for a dual socket plug is in this code
If in the dps_ide_list I have 1 and 2, as it's my case, in the first loop it tries to create Unit 1 to 5, and in the second one 2 to 6.
- Spoiler: show
It should be something like thisI think that the else statment for the group should also be corrected, but I'm setting to None, so I don't mind
- Spoiler: show
Thank you
This afternoon I'll try to create a new params (Port or SerialPort) to select 3.1 or 3.3 protocol.
Anyway, I think the plugin is not working for 3.3 (I get no data in the devices) and I think that it's because the plugin is not using the pytuya methods to get the status
Plugin for a SMA Sunny Boy 1.5 https://github.com/merlot-dev/Domoticz-SMA-SunnyBoy
-
tete
- Posts: 8
- Joined: Tuesday 11 September 2018 13:08
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: [REQUEST] Plugin for Tuya
I've added the line in the get_dps.py and it doesn't works.merlot wrote: Monday 05 August 2019 12:31Then you can add device.set_version(3.3) in the get_dps.py after creating the device and the get_dps.py should worktete wrote: Monday 05 August 2019 11:51
Hi,
I ran this command but nothing appears, but I have installed it during the plugin installation (git clone https://github.com/clach04/python-tuya.git)
If I run the test.py file of the pytuya installation, I get this output
pi@domoticz:~/domoticz/plugins/Domoticz-Tuya-SmartPlug-Plugin/python-tuya $ ./tests.py
INFO:pytuya:pytuya version 7.0.4
INFO:pytuya:Python 3.5.3 (default, Sep 27 2018, 17:25:39)
[GCC 6.3.0 20170516] on linux
INFO:pytuya:Using PyCrypto (2, 6, 1, 'final', 0)
INFO:pytuya:Using PyCrypto from '/home/pi/.local/lib/python3.5/site-packages/Crypto/__init__.py'
pi@domoticz:~/domoticz/plugins/Domoticz-Tuya-SmartPlug-Plugin $ sudo ./get_dps.py 192.168.0.171 60417563840d8e68fe98
Traceback (most recent call last):
File "./get_dps.py", line 49, in <module>
data = device.status()
File "/home/pi/domoticz/plugins/Domoticz-Tuya-SmartPlugMaster-Plugin/pytuya/__init__.py", line 279, in status
payload = self.generate_payload('status')
File "/home/pi/domoticz/plugins/Domoticz-Tuya-SmartPlugMaster-Plugin/pytuya/__init__.py", line 219, in generate_payload
json_payload = self.cipher.encrypt(json_payload, False)
File "/home/pi/domoticz/plugins/Domoticz-Tuya-SmartPlugMaster-Plugin/pytuya/__init__.py", line 64, in encrypt
cipher = AES.new(self.key, mode=AES.MODE_ECB)
File "/usr/lib/python3/dist-packages/Crypto/Cipher/AES.py", line 94, in new
return AESCipher(key, *args, **kwargs)
File "/usr/lib/python3/dist-packages/Crypto/Cipher/AES.py", line 59, in __init__
blockalgo.BlockAlgo.__init__(self, _AES, key, *args, **kwargs)
File "/usr/lib/python3/dist-packages/Crypto/Cipher/blockalgo.py", line 141, in __init__
self._cipher = factory.new(key, *args, **kwargs)
ValueError: Key cannot be the null string
-
merlot
- Posts: 33
- Joined: Saturday 13 April 2019 16:36
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: [REQUEST] Plugin for Tuya
Yesterday, before introducing the version param, I tried to get it working by replicating the pytuya code for 3.3 protocol to extract_status, but without success.merlot wrote: Monday 05 August 2019 13:37
@sincze I have modified the code and requested a pull in github.
This afternoon I'll try to create a new params (Port or SerialPort) to select 3.1 or 3.3 protocol.
Anyway, I think the plugin is not working for 3.3 (I get no data in the devices) and I think that it's because the plugin is not using the pytuya methods to get the status
I don't know the reason why the plugin was developed using connection and onMessage strategy, but I'll try a different approach: just using the self.__device.send_receive method when sending a command, in the onCommand cal, and self.__device.status() to get the status on each hearbeat. In the get_dps.py it works this status() method, so I hope it also does in the plugin, and it seems to me a cleaner solution, or at least simpler.
I'll keep you informed
Thank you
Plugin for a SMA Sunny Boy 1.5 https://github.com/merlot-dev/Domoticz-SMA-SunnyBoy
-
merlot
- Posts: 33
- Joined: Saturday 13 April 2019 16:36
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: [REQUEST] Plugin for Tuya
Got it

The only problem is that I get this error after switching on or off the plug. But it is turned on or off
The code in my pytuya-device branch
https://github.com/merlot-dev/Domoticz- ... uya-device

The only problem is that I get this error after switching on or off the plug. But it is turned on or off
- Spoiler: show
The code in my pytuya-device branch
https://github.com/merlot-dev/Domoticz- ... uya-device
Plugin for a SMA Sunny Boy 1.5 https://github.com/merlot-dev/Domoticz-SMA-SunnyBoy
-
merlot
- Posts: 33
- Joined: Saturday 13 April 2019 16:36
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: [REQUEST] Plugin for Tuya
My modified plugin works fine, with the mentioned errors, for multisocket plug

Some weird problems
You can see that V*A != W. But I have observed that I get the same values in Smart Life app. It's like the W is calculated for 110V not the real one. So, perhaps I'll modify to set the W as a calculation, not from the corresponding DPS.
If I plug something it takes much time (5 or more minutes) to get the right information. I haven't tried with the Smart Life app, but the get_dps.py gets the same zero values for A and W DPS
Comments are welcome

Some weird problems
You can see that V*A != W. But I have observed that I get the same values in Smart Life app. It's like the W is calculated for 110V not the real one. So, perhaps I'll modify to set the W as a calculation, not from the corresponding DPS.
If I plug something it takes much time (5 or more minutes) to get the right information. I haven't tried with the Smart Life app, but the get_dps.py gets the same zero values for A and W DPS
Comments are welcome
Plugin for a SMA Sunny Boy 1.5 https://github.com/merlot-dev/Domoticz-SMA-SunnyBoy
-
tete
- Posts: 8
- Joined: Tuesday 11 September 2018 13:08
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: [REQUEST] Plugin for Tuya
Bon dia Merlot,merlot wrote: Wednesday 07 August 2019 19:24 Got it
The only problem is that I get this error after switching on or off the plug. But it is turned on or off
I'll keep investigating, but any suggestion is welcome
- Spoiler: show
The code in my pytuya-device branch
https://github.com/merlot-dev/Domoticz- ... uya-device
I have tested your code and I receive the same error as before.
I am doing something wrong ?
pi@domoticz:~/domoticz/plugins/Domoticz-Tuya-SmartPlug-Plugin-pytuya-device $ ./get_dps.py 192.168.0.171 60417563840d8e68fe98
Traceback (most recent call last):
File "./get_dps.py", line 51, in <module>
data = device.status()
File "/home/pi/domoticz/plugins/Domoticz-Tuya-SmartPlug-Plugin-pytuya-device/pytuya/__init__.py", line 279, in status
payload = self.generate_payload('status')
File "/home/pi/domoticz/plugins/Domoticz-Tuya-SmartPlug-Plugin-pytuya-device/pytuya/__init__.py", line 219, in generate_payload
json_payload = self.cipher.encrypt(json_payload, False)
File "/home/pi/domoticz/plugins/Domoticz-Tuya-SmartPlug-Plugin-pytuya-device/pytuya/__init__.py", line 64, in encrypt
cipher = AES.new(self.key, mode=AES.MODE_ECB)
File "/home/pi/domoticz/plugins/Domoticz-Tuya-SmartPlug-Plugin-pytuya-device/Crypto/Cipher/AES.py", line 95, in new
return AESCipher(key, *args, **kwargs)
File "/home/pi/domoticz/plugins/Domoticz-Tuya-SmartPlug-Plugin-pytuya-device/Crypto/Cipher/AES.py", line 59, in __init__
blockalgo.BlockAlgo.__init__(self, _AES, key, *args, **kwargs)
File "/home/pi/domoticz/plugins/Domoticz-Tuya-SmartPlug-Plugin-pytuya-device/Crypto/Cipher/blockalgo.py", line 141, in __init__
self._cipher = factory.new(key, *args, **kwargs)
ValueError: Key cannot be the null string
Who is online
Users browsing this forum: Ahrefs [Bot] and 1 guest