Page 9 of 26
Re: Python Plugin: TUYA
Posted: Saturday 27 March 2021 12:00
by tontze
Xenomes wrote: ↑Saturday 27 March 2021 11:58
tontze wrote: ↑Saturday 27 March 2021 10:39
Hm, im trying to use your plugin, but cant seem to get it working .. Here is output.
It is missing the requests.
tontze@T610:~$ sudo pip3 install requests
[sudo] password for tontze:
Requirement already satisfied: requests in /usr/lib/python3/dist-packages (2.25.1)
I wonder why requests is a problem in so many plugins, had hard time with it in miio stuff too..
Code: Select all
Name: requests
Version: 2.25.1
Summary: Python HTTP for Humans.
Home-page: https://requests.readthedocs.io
Author: Kenneth Reitz
Author-email: [email protected]
License: Apache 2.0
Location: /usr/lib/python3/dist-packages
Requires:
Required-by: CacheControl
Re: Python Plugin: TUYA
Posted: Saturday 27 March 2021 12:25
by manjh
Xenomes wrote: ↑Sunday 21 March 2021 21:55
Xenomes wrote: ↑Friday 19 March 2021 7:51
manjh wrote: ↑Thursday 18 March 2021 22:36
Output is in the post a little higher in this forum.
Found it
i see the problem i need to think how to solve the issue.
The payload is exactly the same, I could do if the light is on white mode the only brightness and temperature and if it is colour then colour, brightness and temperature. Then with a instruction in the readme for RGBWW light before detection set the light on a colour.
Would it be possible to create a switch somewhere so I can set the device to white or rgb?
What puzzles me: if the payload is the same, then why is it that the Tuya app knows that the lamp is white-only? Apparently the app has a way to detect it!
Re: Python Plugin: TUYA
Posted: Saturday 27 March 2021 13:44
by Xenomes
manjh wrote: ↑Saturday 27 March 2021 12:25
What puzzles me: if the payload is the same, then why is it that the Tuya app knows that the lamp is white-only? Apparently the app has a way to detect it!
Not all info is shared by the api
This is you payload (White only):
Code: Select all
{ 'header': {'code': 'SUCCESS', 'payloadVersion': 1},
'payload': { 'devices': [ { 'data': { 'brightness': '130',
'color_mode': 'white',
'color_temp': 1000,
'online': True,
'state': 'true'},
'dev_type': 'light',
'ha_type': 'light',
'icon': 'https://images.tuyaeu.com/smart/icon/ay1541056239985fDGjj/15919273389f9d925c99f.png',
'id': '6276453110521cc9ecd9',
'name': 'LSC 2'},
This is my payload (RGBWW):
Code: Select all
{ 'header': {'code': 'SUCCESS', 'payloadVersion': 1},
'payload': { 'devices': [ { 'data': { 'brightness': '255',
'color_mode': 'colour',
'color_temp': 10000,
'online': True,
'state': 'true'},
'dev_type': 'light',
'ha_type': 'light',
'icon': 'https://images.tuyaeu.com/smart/icon/ay1541056239985fDGjj/15620318474c719f1c5cf.png',
'id': 'bfa550692e71343800we58',
'name': '3D Lamp'}],
When I set my lamp to white then 'color_mode': 'colour', change 'color_mode': 'white', . So there is no other data to use.
Re: Python Plugin: TUYA
Posted: Saturday 27 March 2021 13:52
by Xenomes
tontze wrote: ↑Saturday 27 March 2021 12:00
I wonder why requests is a problem in so many plugins, had hard time with it in miio stuff too..
I am also on version 2.25.1, did you edit the file and start the debug_discovery.py as
Re: Python Plugin: TUYA
Posted: Saturday 27 March 2021 14:39
by manjh
Xenomes wrote: ↑Saturday 27 March 2021 13:44
manjh wrote: ↑Saturday 27 March 2021 12:25
What puzzles me: if the payload is the same, then why is it that the Tuya app knows that the lamp is white-only? Apparently the app has a way to detect it!
Not all info is shared by the api
OK, understood. Perhaps the ID field is used by Tuya to find the type of lamp in a database somewhere...
So either we go for the additional flag on the device, making it a white or rgb lamp, or we simply leave it as it is.
I guess I can live with the superfluous color wheel...
If we leave it, perhaps it is a good idea to mention in the readme that the plugin cannot always determine the type of lamp?
Re: Python Plugin: TUYA
Posted: Sunday 28 March 2021 11:16
by tontze
Xenomes wrote: ↑Saturday 27 March 2021 13:52
tontze wrote: ↑Saturday 27 March 2021 12:00
I wonder why requests is a problem in so many plugins, had hard time with it in miio stuff too..
I am also on version 2.25.1, did you edit the file and start the debug_discovery.py as
Yes i did.
Re: Python Plugin: TUYA
Posted: Tuesday 30 March 2021 11:42
by Vomera
Code: Select all
2021-03-30 11:20:01.115 Error: (Tuya) 'onCommand' failed 'TypeError':'int() argument must be a string, a bytes-like object or a number, not 'NoneType''.
2021-03-30 11:20:01.115 Error: (Tuya) ----> Line 250 in '/home/pi/domoticz/plugins/tuyaha/plugin.py', function onCommand
2021-03-30 11:20:01.115 Error: (Tuya) ----> Line 143 in '/home/pi/domoticz/plugins/tuyaha/plugin.py', function onCommand
2021-03-30 11:20:01.115 Error: (Tuya) ----> Line 79 in '/home/pi/domoticz/plugins/tuyaha/tuyaha/devices/light.py', function set_color
I am still not able to change color from the RGB in domoticz, i can turn off and on the light and can dim. If someone has a solution please let me know
Re: Python Plugin: TUYA
Posted: Wednesday 31 March 2021 20:12
by Xenomes
Vomera wrote: ↑Tuesday 30 March 2021 11:42
Code: Select all
2021-03-30 11:20:01.115 Error: (Tuya) 'onCommand' failed 'TypeError':'int() argument must be a string, a bytes-like object or a number, not 'NoneType''.
2021-03-30 11:20:01.115 Error: (Tuya) ----> Line 250 in '/home/pi/domoticz/plugins/tuyaha/plugin.py', function onCommand
2021-03-30 11:20:01.115 Error: (Tuya) ----> Line 143 in '/home/pi/domoticz/plugins/tuyaha/plugin.py', function onCommand
2021-03-30 11:20:01.115 Error: (Tuya) ----> Line 79 in '/home/pi/domoticz/plugins/tuyaha/tuyaha/devices/light.py', function set_color
I am still not able to change color from the RGB in domoticz, i can turn off and on the light and can dim. If someone has a solution please let me know
Why do you have tuyaha in you Domoticz plug-in directory?
Re: Python Plugin: TUYA
Posted: Wednesday 31 March 2021 22:17
by Xenomes
manjh wrote: ↑Saturday 27 March 2021 14:39
OK, understood. Perhaps the ID field is used by Tuya to find the type of lamp in a database somewhere...
So either we go for the additional flag on the device, making it a white or rgb lamp, or we simply leave it as it is.
I guess I can live with the superfluous color wheel...
If we leave it, perhaps it is a good idea to mention in the readme that the plugin cannot always determine the type of lamp?
I added my idea to the plug-in for RGBWW and White it works, but i can not test it for RGB only devices. Can you test it on your White only device?
Warning development version!
Code: Select all
git clone https://github.com/Xenomes/Domoticz-TUYA-Plugin.git -b development
Re: Python Plugin: TUYA
Posted: Wednesday 31 March 2021 22:42
by manjh
Xenomes wrote: ↑Wednesday 31 March 2021 22:17
manjh wrote: ↑Saturday 27 March 2021 14:39
OK, understood. Perhaps the ID field is used by Tuya to find the type of lamp in a database somewhere...
So either we go for the additional flag on the device, making it a white or rgb lamp, or we simply leave it as it is.
I guess I can live with the superfluous color wheel...
If we leave it, perhaps it is a good idea to mention in the readme that the plugin cannot always determine the type of lamp?
I added my idea to the plug-in for RGBWW and White it works, but i can not test it for RGB only devices. Can you test it on your White only device?
Warning development version!
Code: Select all
git clone https://github.com/Xenomes/Domoticz-TUYA-Plugin.git -b development
I ran the git line in my R-Pi. No change. Should I do something to force renewal of the lamps?
Already disabled and enabled the Tuya HW line in Domoticz. No effect.
Re: Python Plugin: TUYA
Posted: Wednesday 31 March 2021 22:42
by Vomera
Xenomes wrote: ↑Wednesday 31 March 2021 20:12
Vomera wrote: ↑Tuesday 30 March 2021 11:42
Code: Select all
2021-03-30 11:20:01.115 Error: (Tuya) 'onCommand' failed 'TypeError':'int() argument must be a string, a bytes-like object or a number, not 'NoneType''.
2021-03-30 11:20:01.115 Error: (Tuya) ----> Line 250 in '/home/pi/domoticz/plugins/tuyaha/plugin.py', function onCommand
2021-03-30 11:20:01.115 Error: (Tuya) ----> Line 143 in '/home/pi/domoticz/plugins/tuyaha/plugin.py', function onCommand
2021-03-30 11:20:01.115 Error: (Tuya) ----> Line 79 in '/home/pi/domoticz/plugins/tuyaha/tuyaha/devices/light.py', function set_color
I am still not able to change color from the RGB in domoticz, i can turn off and on the light and can dim. If someone has a solution please let me know
Why do you have tuyaha in you Domoticz plug-in directory?
Where else should it be ?
Re: Python Plugin: TUYA
Posted: Wednesday 31 March 2021 23:06
by Xenomes
manjh wrote: ↑Wednesday 31 March 2021 22:42
I ran the git line in my R-Pi. No change. Should I do something to force renewal of the lamps?
Already disabled and enabled the Tuya HW line in Domoticz. No effect.
Sorry, yes you hsve to delete the device
Re: Python Plugin: TUYA
Posted: Wednesday 31 March 2021 23:10
by manjh
Xenomes wrote: ↑Wednesday 31 March 2021 23:06
manjh wrote: ↑Wednesday 31 March 2021 22:42
I ran the git line in my R-Pi. No change. Should I do something to force renewal of the lamps?
Already disabled and enabled the Tuya HW line in Domoticz. No effect.
Sorry, yes you hsve to delete the device
Delete the device in Domoticz only, so leave it alone in Tuya?
Re: Python Plugin: TUYA
Posted: Wednesday 31 March 2021 23:14
by Xenomes
Yes restart the plug-in by update in the hardware tab.
Re: Python Plugin: TUYA
Posted: Wednesday 31 March 2021 23:14
by manjh
OK, I deleted the device in Domoticz, then disabled the Tuya HW entry, and enabled it again.
In the log I saw the lamp come in again with the Tuya name, and enabled it into Domoticz.
It is stil RGB...
Re: Python Plugin: TUYA
Posted: Thursday 01 April 2021 20:54
by Xenomes
manjh wrote: ↑Wednesday 31 March 2021 23:14
OK, I deleted the device in Domoticz, then disabled the Tuya HW entry, and enabled it again.
In the log I saw the lamp come in again with the Tuya name, and enabled it into Domoticz.
It is stil RGB...
What version of the plug-in do it show?
Re: Python Plugin: TUYA
Posted: Thursday 01 April 2021 21:02
by Xenomes
Vomera wrote: ↑Wednesday 31 March 2021 22:42
Where else should it be ?
The second tuyaha is not needed with my version of the plug-in. I was mislead with the naming of the directory. You are using the version of guino in that version is has limited control of RGB. Can you try my version of the plug[in.
https://github.com/Xenomes/Domoticz-TUYA-Plugin.
Re: Python Plugin: TUYA
Posted: Thursday 01 April 2021 21:37
by manjh
Xenomes wrote: ↑Thursday 01 April 2021 20:54
manjh wrote: ↑Wednesday 31 March 2021 23:14
OK, I deleted the device in Domoticz, then disabled the Tuya HW entry, and enabled it again.
In the log I saw the lamp come in again with the Tuya name, and enabled it into Domoticz.
It is stil RGB...
What version of the plug-in do it show?
V.1.0.4
Re: Python Plugin: TUYA
Posted: Thursday 01 April 2021 22:06
by Xenomes
manjh wrote: ↑Thursday 01 April 2021 21:37
V.1.0.4
That is not the latest version ... Delete devices and update the plug-in, restart Domoticz and see the new detection.
Edit: Just push a new version
(⚠ RGBW(W) lights must be on a colour for correct detection ⚠)
Re: Python Plugin: TUYA
Posted: Friday 02 April 2021 10:10
by manjh
Xenomes wrote: ↑Thursday 01 April 2021 22:06
manjh wrote: ↑Thursday 01 April 2021 21:37
V.1.0.4
That is not the latest version ... Delete devices and update the plug-in, restart Domoticz and see the new detection.
Edit: Just push a new version
(⚠ RGBW(W) lights must be on a colour for correct detection ⚠)
OK, now getting version 6.
Deleted one lamp, disabled/enabled Tuya, now get this error in the log:
Code: Select all
Error: (Tuya devices) handleThread: Expecting value: line 1 column 1 (char 0) line 198
Also:
Code: Select all
Error: (Tuya devices) handleThread: login rate limited line 195