Page 7 of 26

Re: Python Plugin: TUYA

Posted: Thursday 18 March 2021 20:13
by Xenomes
manjh wrote: Wednesday 17 March 2021 22:18 But there is no way to change the color temperature. In the devices tab of Domoticz, the lamps show up as RGB, which is wrong.
Hi Manjh, what is the version of the plug-in you are using?

Re: Python Plugin: TUYA

Posted: Thursday 18 March 2021 21:28
by manjh
How can I find the version number?

Re: Python Plugin: TUYA

Posted: Thursday 18 March 2021 21:30
by manjh
Xenomes wrote: Thursday 18 March 2021 20:13
manjh wrote: Wednesday 17 March 2021 22:18 But there is no way to change the color temperature. In the devices tab of Domoticz, the lamps show up as RGB, which is wrong.
Hi Manjh, what is the version of the plug-in you are using?
Ah, found it in the setup. Tuyaha, version 0.0.6. Downloaded yesterday.

Re: Python Plugin: TUYA

Posted: Thursday 18 March 2021 21:33
by Xenomes
OK, then you are using the other plug-in. Can you try https://github.com/Xenomes/Domoticz-TUYA-Plugin there are more lights selections.

Re: Python Plugin: TUYA

Posted: Thursday 18 March 2021 21:34
by manjh
Xenomes wrote: Thursday 18 March 2021 21:33 OK, then you are using the other plug-in. Can you try https://github.com/Xenomes/Domoticz-TUYA-Plugin there are more lights selections.
AH, so I am using the wrong plugin... Should I remove Tuyaha first?

Re: Python Plugin: TUYA

Posted: Thursday 18 March 2021 21:36
by Xenomes
manjh wrote: Thursday 18 March 2021 21:34 AH, so I am using the wrong plugin... Should I remove Tuyaha first?
the other plug-in has Tuyaha as a git pull, my one has a pip3 install

Re: Python Plugin: TUYA

Posted: Thursday 18 March 2021 21:43
by manjh
Xenomes wrote: Thursday 18 March 2021 21:36
manjh wrote: Thursday 18 March 2021 21:34 AH, so I am using the wrong plugin... Should I remove Tuyaha first?
the other plug-in has Tuyaha as a git pull, my one has a pip3 install
OK, that was easy.
With your plugin, I can now see a color-circle, but a second one with only warm/cold white. So I can now change the color and dimmer level.
One thing: the device still comes up as RGB. Is that how it was meant to be?

Re: Python Plugin: TUYA

Posted: Thursday 18 March 2021 21:47
by Xenomes
manjh wrote: Thursday 18 March 2021 21:43 OK, that was easy.
With your plugin, I can now see a color-circle, but a second one with only warm/cold white. So I can now change the color and dimmer level.
One thing: the device still comes up as RGB. Is that how it was meant to be?
Can you run the debug_discovery.py from the tools directory?

Re: Python Plugin: TUYA

Posted: Thursday 18 March 2021 21:59
by manjh
Xenomes wrote: Thursday 18 March 2021 21:47
manjh wrote: Thursday 18 March 2021 21:43 OK, that was easy.
With your plugin, I can now see a color-circle, but a second one with only warm/cold white. So I can now change the color and dimmer level.
One thing: the device still comes up as RGB. Is that how it was meant to be?
Can you run the debug_discovery.py from the tools directory?
I get:

Code: Select all

Traceback (most recent call last):
File "debug_discovery.py", ;ine 2, in <module>
import requests
ImportError: No module named requests

Re: Python Plugin: TUYA

Posted: Thursday 18 March 2021 22:00
by Xenomes
manjh wrote: Thursday 18 March 2021 21:59 I get:

Code: Select all

Traceback (most recent call last):
File "debug_discovery.py", ;ine 2, in <module>
import requests
ImportError: No module named requests
Did you install requests?

Re: Python Plugin: TUYA

Posted: Thursday 18 March 2021 22:01
by manjh
Xenomes wrote: Thursday 18 March 2021 22:00
manjh wrote: Thursday 18 March 2021 21:59 I get:

Code: Select all

Traceback (most recent call last):
File "debug_discovery.py", ;ine 2, in <module>
import requests
ImportError: No module named requests
Did you install requests?
Yes, I followed the instructions to the letter! :D

Re: Python Plugin: TUYA

Posted: Thursday 18 March 2021 22:03
by manjh
I re-ran the pip3 command, and get two lines saying "already satisfied".

I should note: the devices work just fine. But it seems funny to get a full color selector for a device that is white-only... :cry:

Re: Python Plugin: TUYA

Posted: Thursday 18 March 2021 22:06
by Xenomes
Then you run python ./debug_discovery.py try python3 ./debug_discovery.py

Re: Python Plugin: TUYA

Posted: Thursday 18 March 2021 22:09
by manjh
Xenomes wrote: Thursday 18 March 2021 22:06 Then you run python ./debug_discovery.py try python3 ./debug_discovery.py
Ah, that's different.

Code: Select all

Getting credentials
Got credentials
{   'errorMsg': 'Get accesstoken failed. Invalid parms.',
    'responseStatus': 'error'}
Traceback (most recent call last):
  File "./debug_discovery.py", line 35, in <module>
    payload = {"accessToken": auth_response["access_token"]}
KeyError: 'access_token'

Re: Python Plugin: TUYA

Posted: Thursday 18 March 2021 22:12
by Xenomes
manjh wrote: Thursday 18 March 2021 22:09 Ah, that's different.

Code: Select all

Getting credentials
Got credentials
{   'errorMsg': 'Get accesstoken failed. Invalid parms.',
    'responseStatus': 'error'}
Traceback (most recent call last):
  File "./debug_discovery.py", line 35, in <module>
    payload = {"accessToken": auth_response["access_token"]}
KeyError: 'access_token'
That is better, edit the file and fill in the information between CHANGE THIS

Re: Python Plugin: TUYA

Posted: Thursday 18 March 2021 22:13
by manjh
FYI: in the Domoticz log I can see this:

Code: Select all

2021-03-18 22:11:49.254 (Tuya devices) DEV name=LSC 2 state=True id=6276453110521cc9ecd9 online=True
2021-03-18 22:11:49.254 (Tuya devices) DEV name=LSC 1 state=True id=53425342f4cfa209631c online=True
LSC 1 and 2 are the two lamps that I have.

Re: Python Plugin: TUYA

Posted: Thursday 18 March 2021 22:15
by manjh
Xenomes wrote: Thursday 18 March 2021 22:12
manjh wrote: Thursday 18 March 2021 22:09 Ah, that's different.

Code: Select all

Getting credentials
Got credentials
{   'errorMsg': 'Get accesstoken failed. Invalid parms.',
    'responseStatus': 'error'}
Traceback (most recent call last):
  File "./debug_discovery.py", line 35, in <module>
    payload = {"accessToken": auth_response["access_token"]}
KeyError: 'access_token'
That is better, edit the file and fill in the information between CHANGE THIS
Sorry, I must have missed this in the plugin instructions.
Which file should I edit?

Re: Python Plugin: TUYA

Posted: Thursday 18 March 2021 22:19
by Xenomes
manjh wrote: Thursday 18 March 2021 22:15 Sorry, I must have missed this in the plugin instructions.
Which file should I edit?
debug_discovery.py
the tool gives a json string so i can see the what device outputs, then i can update the plugin so a device without rgb has no colour wheel.

Re: Python Plugin: TUYA

Posted: Thursday 18 March 2021 22:22
by manjh
Xenomes wrote: Thursday 18 March 2021 22:19
manjh wrote: Thursday 18 March 2021 22:15 Sorry, I must have missed this in the plugin instructions.
Which file should I edit?
debug_discovery.py
the tool gives a json string so i can see the what device outputs, then i can update the plugin so a device without rgb has no colour wheel.
OK, got it.

Code: Select all

Getting credentials
Got credentials
{   'access_token': 'EUheu1616000992439YNMrdQKReKU4r4S',
    'expires_in': 864000,
    'refresh_token': 'EUheu1616000992439YNMrdAFLvKdAtuy',
    'token_type': 'bearer'}
Getting devices
Got devices
{   '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'},
                                  {   'data': {   'brightness': '10',
                                                  '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': '53425342f4cfa209631c',
                                      'name': 'LSC 1'}],
                   'scenes': []}}


Re: Python Plugin: TUYA

Posted: Thursday 18 March 2021 22:25
by Xenomes
manjh wrote: Thursday 18 March 2021 22:22 OK, got it. SHould I post the output here, or do you want it some other way?
If you give the device output that is enough, you can mask any info you want.