Python Plugin: TUYA

Python and python framework

Moderator: leecollings

hiihoo
Posts: 6
Joined: Tuesday 01 August 2017 13:54
Target OS: Linux
Domoticz version: 4.11672
Location: Finland
Contact:

Re: Python Plugin: TUYA

Post by hiihoo »

Hi.

Found this thread when trying to get Nedis SmartLife light bulb to work with domoticz.

But.. Not working, and long story short:

Code: Select all

 python3 ./debug_discovery.py
Getting credentials
Got credentials
{   'errorMsg': 'Get accesstoken failed. Username or password error!',
    'responseStatus': 'error'}
Traceback (most recent call last):
  File "./debug_discovery.py", line 35, in <module>
    payload = {"accessToken": auth_response["access_token"]}
KeyError: 'access_token'
Pretty sure username / password are correct, as well region / countrycode and biz_type also.

What have I done wrong?-)

Tested plugin inside Domoticz also, but won't work, gives same error ?

Code: Select all

2022-11-29 18:10:23.698 nedis: TUYA plugin started
2022-11-29 18:10:23.698 nedis: Debug logging mask set to: PYTHON PLUGIN QUEUE IMAGE DEVICE CONNECTION MESSAGE
2022-11-29 18:10:23.698 nedis: 'HardwareID':'11'
2022-11-29 18:10:23.698 nedis: 'HomeFolder':'/opt/domoticz/plugins/Domoticz-TUYA-Plugin/'
2022-11-29 18:10:23.698 nedis: 'StartupFolder':'/opt/domoticz/'
2022-11-29 18:10:23.698 nedis: 'UserDataFolder':'/opt/domoticz/'
2022-11-29 18:10:23.698 nedis: 'Database':'/opt/domoticz/domoticz.db'
2022-11-29 18:10:23.698 nedis: 'Language':'en'
2022-11-29 18:10:23.698 nedis: 'Version':'1.0.14'
2022-11-29 18:10:23.698 nedis: 'Author':'Wagner Oliveira contributed Xenomes'
2022-11-29 18:10:23.698 nedis: 'Name':'nedis'
2022-11-29 18:10:23.698 nedis: 'Port':'0'
2022-11-29 18:10:23.698 nedis: 'Username':'[email protected]'
2022-11-29 18:10:23.698 nedis: 'Password':'XXXXXXXX'
2022-11-29 18:10:23.699 nedis: 'Key':'tuya'
2022-11-29 18:10:23.699 nedis: 'Mode1':'358'
2022-11-29 18:10:23.699 nedis: 'Mode2':'smart_life'
2022-11-29 18:10:23.699 nedis: 'Mode6':'-1'
2022-11-29 18:10:23.699 nedis: 'DomoticzVersion':'2022.2 (build 14784)'
2022-11-29 18:10:23.699 nedis: 'DomoticzHash':'e04d1d3e2'
2022-11-29 18:10:23.699 nedis: 'DomoticzBuildTime':'2022-11-29 08:53:03'
2022-11-29 18:10:23.699 nedis: Device count: 0
2022-11-29 18:10:23.699 nedis: in handlethread
2022-11-29 18:10:23.701 nedis: Acquiring GIL for 'onStartCallback'
2022-11-29 18:10:23.751 nedis: Pushing 'onHeartbeatCallback' on to queue
2022-11-29 18:10:23.801 nedis: Processing 'onHeartbeatCallback' message
2022-11-29 18:10:23.801 nedis: Acquiring GIL for 'onHeartbeatCallback'
2022-11-29 18:10:23.801 nedis: Calling message handler 'onHeartbeat' on 'module' type object.
2022-11-29 18:10:23.801 nedis: onHeartbeat called time=1669738223.8017232
2022-11-29 18:10:23.802 nedis: in handlethread
2022-11-29 18:10:23.802 nedis: Device count: 0
2022-11-29 18:10:23.802 nedis: Acquiring GIL for 'onHeartbeatCallback'
2022-11-29 18:10:24.628 Error: nedis: handleThread: Get accesstoken failed. Username or password error! line 209
User avatar
Xenomes
Posts: 396
Joined: Tuesday 27 November 2018 19:05
Target OS: Linux
Domoticz version: 2024.7
Location: Netherlands
Contact:

Re: Python Plugin: TUYA

Post by Xenomes »

hiihoo wrote: Tuesday 29 November 2022 17:17 Hi.

Found this thread when trying to get Nedis SmartLife light bulb to work with domoticz.

But.. Not working, and long story short:

Code: Select all

 python3 ./debug_discovery.py
Getting credentials
Got credentials
{   'errorMsg': 'Get accesstoken failed. Username or password error!',
    'responseStatus': 'error'}
Traceback (most recent call last):
  File "./debug_discovery.py", line 35, in <module>
    payload = {"accessToken": auth_response["access_token"]}
KeyError: 'access_token'
Pretty sure username / password are correct, as well region / countrycode and biz_type also.

What have I done wrong?-)

Tested plugin inside Domoticz also, but won't work, gives same error ?
There is a problem if the password contains a special character it is not all character.
HP T630 (256GB SSD/8GB Mem) - Ubuntu 24.04.2 LTS (64Bit) - Domoticz 2024.7 (Docker) Machinon theme - RFLink - KaKu - Sonoff - Tasmota - Shelly - MQTT2Zigbee - OpenTherm Gateway - Tinytuya - IR Blaster - P1 Smart Meter - NPN Watermeter - Google Assistant
hiihoo
Posts: 6
Joined: Tuesday 01 August 2017 13:54
Target OS: Linux
Domoticz version: 4.11672
Location: Finland
Contact:

Re: Python Plugin: TUYA

Post by hiihoo »

Thank you, works.

I thought about special characters, removed them, but apparently mixed case also won't work.

Now seems to works, eh, meaning debug_discorey.py gives credentials but no devices.

Have to dig previous posts, I recall somebody had same problem..

But for now, thanks you very much for plugin, now just need to get it working. :-)

edit: Not able to get devices to show, jumping to next possible solution at: viewtopic.php?f=65&t=39441 and will be joining conversation there. :-)
Last edited by hiihoo on Wednesday 30 November 2022 13:35, edited 1 time in total.
kalinkamaen
Posts: 52
Joined: Sunday 04 January 2015 15:57
Target OS: Windows
Domoticz version: 2022.2
Location: Norway
Contact:

Re: Python Plugin: TUYA

Post by kalinkamaen »

Domoticz2022.2 (build 14784)
Windows 10 Pro version 22H2 (OS build 19045.2311)
Spoiler: show
2022-11-30 12:06:36.558 Status: Domoticz V2022.2 (build 14784) (c)2012-2022 GizMoCuz
2022-11-30 12:06:36.566 Status: Build Hash: e04d1d3e2, Date: 2022-11-29 07:53:03
2022-11-30 12:06:36.566 Status: Startup Path: C:\Program Files (x86)\Domoticz\
2022-11-30 12:06:36.902 Status: PluginSystem: Started, Python version '3.7.0', 2 plugin definitions loaded.
2022-11-30 12:06:37.001 Active notification Subsystems: email, pushbullet (2/13)
2022-11-30 12:06:37.124 Starting shared server on: :::6244
2022-11-30 12:06:37.043 Status: WebServer(HTTP) started on address: :: with port 6363
2022-11-30 12:06:37.053 Status: [web:4] Adding IPv6363 network (192.168.10.128) to list of local networks.
2022-11-30 12:06:37.063 Status: [web:4] Adding IPv6363 network (192.168.10.131) to list of local networks.
2022-11-30 12:06:37.071 Status: [web:4] Adding IPv6363 network (192.168.10.155) to list of local networks.
2022-11-30 12:06:37.073 Status: [web:4] Adding IPv6363 network (127.0.0.1) to list of local networks.
2022-11-30 12:06:37.073 Status: [web:4] Adding IPv6363 network (192.168.10.111) to list of local networks.
2022-11-30 12:06:37.073 Status: [web:4] Adding IPv6363 network (192.168.10.39) to list of local networks.
2022-11-30 12:06:37.073 Status: [web:4] Adding IPv6363 network (192.168.10.196) to list of local networks.
2022-11-30 12:06:37.073 Status: [web:4] Adding IPv6363 network (192.168.10.38) to list of local networks.
2022-11-30 12:06:37.073 Status: [web:4] Adding IPv6363 network (192.168.10.33) to list of local networks.
2022-11-30 12:06:37.073 Status: [web:4] Adding IPv6363 network (192.168.10.35) to list of local networks.
2022-11-30 12:06:37.073 Status: [web:4] Adding IPv6363 network (192.168.10.27) to list of local networks.
2022-11-30 12:06:37.073 Status: [web:4] Adding IPv6363 network (192.168.10.1) to list of local networks.
2022-11-30 12:06:37.073 Status: [web:4] Adding IPv6363 network (77.16.216.48) to list of local networks.
2022-11-30 12:06:37.073 Status: [web:4] Adding IPv6363 network (109.247.146.13) to list of local networks.
2022-11-30 12:06:37.073 Status: [web:4] Adding IPv6363 network (192.168.10.48) to list of local networks.
2022-11-30 12:06:37.104 Status: WebServer(SSL) started on address: :: with port 443
2022-11-30 12:06:37.104 Status: [web:4] Adding IPv443 network (192.168.10.128) to list of local networks.
2022-11-30 12:06:37.104 Status: [web:4] Adding IPv443 network (192.168.10.131) to list of local networks.
2022-11-30 12:06:37.104 Status: [web:4] Adding IPv443 network (192.168.10.155) to list of local networks.
2022-11-30 12:06:37.112 Status: [web:4] Adding IPv443 network (127.0.0.1) to list of local networks.
2022-11-30 12:06:37.112 Status: [web:4] Adding IPv443 network (192.168.10.111) to list of local networks.
2022-11-30 12:06:37.114 Status: [web:4] Adding IPv443 network (192.168.10.39) to list of local networks.
2022-11-30 12:06:37.114 Status: [web:4] Adding IPv443 network (192.168.10.196) to list of local networks.
2022-11-30 12:06:37.114 Status: [web:4] Adding IPv443 network (192.168.10.38) to list of local networks.
2022-11-30 12:06:37.114 Status: [web:4] Adding IPv443 network (192.168.10.33) to list of local networks.
2022-11-30 12:06:37.114 Status: [web:4] Adding IPv443 network (192.168.10.35) to list of local networks.
2022-11-30 12:06:37.114 Status: [web:4] Adding IPv443 network (192.168.10.27) to list of local networks.
2022-11-30 12:06:37.114 Status: [web:4] Adding IPv443 network (192.168.10.1) to list of local networks.
2022-11-30 12:06:37.114 Status: [web:4] Adding IPv443 network (77.16.216.48) to list of local networks.
2022-11-30 12:06:37.114 Status: [web:4] Adding IPv443 network (109.247.146.13) to list of local networks.
2022-11-30 12:06:37.114 Status: [web:4] Adding IPv443 network (192.168.10.48) to list of local networks.
2022-11-30 12:06:37.122 Status: Camera: settings (re)loaded
2022-11-30 12:06:37.124 Status: TCPServer: shared server started...
2022-11-30 12:06:37.124 Status: RxQueue: queue worker started...
2022-11-30 12:06:39.214 Smartlife: Worker thread started.
2022-11-30 12:06:39.214 Status: Stue pc RFXcom: Worker started...
2022-11-30 12:06:39.225 Status: Smartlife: Started.
2022-11-30 12:06:39.225 Status: Smartlife: Entering work loop.
2022-11-30 12:06:39.225 Status: Garasje : connected to: 192.168.10.183:6144
2022-11-30 12:06:39.225 Status: EventSystem: reset all events...
2022-11-30 12:06:39.233 Status: NotificationSystem: thread started...
2022-11-30 12:06:39.243 Status: EventSystem: reset all device statuses...
2022-11-30 12:06:39.295 Status: PluginSystem: 1 plugins started.
2022-11-30 12:06:39.346 Status: Python EventSystem: Initializing event module.
2022-11-30 12:06:39.346 Status: EventSystem: Started
2022-11-30 12:06:39.346 Status: EventSystem: Queue thread started...
2022-11-30 12:06:39.558 Error: Smartlife: (tuya) failed to load 'plugin.py', Python Path used was 'C:\Program Files (x86)\Domoticz\plugins\tuyaha-master\;C:\Program Files (x86)\Python37-32\python37.zip;C:\Program Files (x86)\Python37-32\Lib\;C:\Program Files (x86)\Python37-32\DLLs\;C:\Program Files (x86)\Domoticz;C:\Program Files (x86)\Python37-32;C:\Program Files (x86)\Python37-32\lib\site-packages'.
2022-11-30 12:06:39.558 Error: Smartlife: Traceback (most recent call last):
2022-11-30 12:06:39.568 Error: Smartlife: File "C:\Program Files (x86)\Domoticz\plugins\tuyaha-master\plugin.py", line 57, in <module>
2022-11-30 12:06:39.568 Error: Smartlife: import tuyaha
2022-11-30 12:06:39.578 Error: Smartlife: File "C:\Program Files (x86)\Domoticz\plugins\tuyaha-master\tuyaha\__init__.py", line 2, in <module>
2022-11-30 12:06:39.578 Error: Smartlife: from .tuyaapi import TuyaApi
2022-11-30 12:06:39.578 Error: Smartlife: File "C:\Program Files (x86)\Domoticz\plugins\tuyaha-master\tuyaha\tuyaapi.py", line 5, in <module>
2022-11-30 12:06:39.578 Error: Smartlife: import requests
2022-11-30 12:06:39.586 Error: Smartlife: ModuleNotFoundError: No module named 'requests'
2022-11-30 12:06:40.979 subtype = Interface Command
2022-11-30 12:06:40.979 Sequence nbr = 0
2022-11-30 12:06:40.979 reset the receiver/transceiver
I have tried everything, can someone point me in the right direction.

Regards Kali
Windows 10, Domoticz 14784
User avatar
waltervl
Posts: 5720
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Python Plugin: TUYA

Post by waltervl »

This is the root cause:
2022-11-30 12:06:39.578 Error: Smartlife: File "C:\Program Files (x86)\Domoticz\plugins\tuyaha-master\tuyaha\tuyaapi.py", line 5, in <module>
2022-11-30 12:06:39.578 Error: Smartlife: import requests
2022-11-30 12:06:39.586 Error: Smartlife: ModuleNotFoundError: No module named 'requests'

So you need to install python module 'requests'
Probably with command

Code: Select all

python -m pip install requests
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
kalinkamaen
Posts: 52
Joined: Sunday 04 January 2015 15:57
Target OS: Windows
Domoticz version: 2022.2
Location: Norway
Contact:

Re: Python Plugin: TUYA

Post by kalinkamaen »

waltervl wrote: Wednesday 30 November 2022 13:15 This is the root cause:
2022-11-30 12:06:39.578 Error: Smartlife: File "C:\Program Files (x86)\Domoticz\plugins\tuyaha-master\tuyaha\tuyaapi.py", line 5, in <module>
2022-11-30 12:06:39.578 Error: Smartlife: import requests
2022-11-30 12:06:39.586 Error: Smartlife: ModuleNotFoundError: No module named 'requests'

So you need to install python module 'requests'
Probably with command

Code: Select all

python -m pip install requests
Problem fixed.
I love you. Thnak you very much.
Kali
Windows 10, Domoticz 14784
Rfpower666
Posts: 28
Joined: Thursday 26 October 2017 17:07
Target OS: Windows
Domoticz version:
Contact:

Re: Python Plugin: TUYA

Post by Rfpower666 »

I have installed the plugin in domoticz, and it seems to be working fine. I am usin Smart Life - Added credentials and plugin loads fine, and gives no errors. I have 2 devices in smartlife app - Both lights - But they do not show up in domoticz..

Any ideas?

Log from domotics:
2022-12-04 10:00:58.936 Tuya: TUYA plugin started
2022-12-04 10:00:58.936 Tuya: Debug logging mask set to: PYTHON CONNECTION
2022-12-04 10:00:58.936 Tuya: 'HardwareID':'7'
2022-12-04 10:00:58.936 Tuya: 'HomeFolder':'/home/pi/domoticz/plugins/Domoticz-TUYA-Plugin/'
2022-12-04 10:00:58.936 Tuya: 'StartupFolder':'/home/pi/domoticz/'
2022-12-04 10:00:58.936 Tuya: 'UserDataFolder':'/home/pi/domoticz/'
2022-12-04 10:00:58.936 Tuya: 'Database':'/home/pi/domoticz/domoticz.db'
2022-12-04 10:00:58.936 Tuya: 'Language':'en'
2022-12-04 10:00:58.936 Tuya: 'Version':'1.0.14'
2022-12-04 10:00:58.936 Tuya: 'Author':'Wagner Oliveira contributed Xenomes'
2022-12-04 10:00:58.936 Tuya: 'Name':'Tuya'
2022-12-04 10:00:58.936 Tuya: 'Port':'0'
2022-12-04 10:00:58.936 Tuya: 'Username':'******************'
2022-12-04 10:00:58.936 Tuya: 'Password':'****************'
2022-12-04 10:00:58.936 Tuya: 'Key':'tuya'
2022-12-04 10:00:58.936 Tuya: 'Mode1':'47'
2022-12-04 10:00:58.936 Tuya: 'Mode2':'smart_life'
2022-12-04 10:00:58.936 Tuya: 'Mode6':'18'
2022-12-04 10:00:58.936 Tuya: 'DomoticzVersion':'2022.2'
2022-12-04 10:00:58.936 Tuya: 'DomoticzHash':'eea9db734'
2022-12-04 10:00:58.936 Tuya: 'DomoticzBuildTime':'2022-11-05 13:05:35'
2022-12-04 10:00:58.936 Tuya: Device count: 0
2022-12-04 10:00:58.936 Tuya: in handlethread
2022-12-04 10:00:59.037 Tuya: onHeartbeat called time=1670144459.0379364
2022-12-04 10:00:59.038 Tuya: in handlethread
2022-12-04 10:00:59.038 Tuya: Device count: 0
User avatar
Xenomes
Posts: 396
Joined: Tuesday 27 November 2018 19:05
Target OS: Linux
Domoticz version: 2024.7
Location: Netherlands
Contact:

Re: Python Plugin: TUYA

Post by Xenomes »

Rfpower666 wrote: Sunday 04 December 2022 10:02 I have installed the plugin in domoticz, and it seems to be working fine. I am usin Smart Life - Added credentials and plugin loads fine, and gives no errors. I have 2 devices in smartlife app - Both lights - But they do not show up in domoticz..

Any ideas?
Can be a few things, you can edit/run the debug_discovery.py for the tools directory. The output can tell the issue.
HP T630 (256GB SSD/8GB Mem) - Ubuntu 24.04.2 LTS (64Bit) - Domoticz 2024.7 (Docker) Machinon theme - RFLink - KaKu - Sonoff - Tasmota - Shelly - MQTT2Zigbee - OpenTherm Gateway - Tinytuya - IR Blaster - P1 Smart Meter - NPN Watermeter - Google Assistant
Rfpower666
Posts: 28
Joined: Thursday 26 October 2017 17:07
Target OS: Windows
Domoticz version:
Contact:

Re: Python Plugin: TUYA

Post by Rfpower666 »

Is this what you are looking for? (Please bear with me - I am a proper novice in the Linux world...)

~/domoticz/plugins/Domoticz-TUYA-Plugin/tools$ python3 debug_discovery.py
Getting credentials
Got credentials
{ 'errorMsg': 'Get accesstoken failed. Invalid parms.',
'responseStatus': 'error'}
Traceback (most recent call last):
File "/home/pi/domoticz/plugins/Domoticz-TUYA-Plugin/tools/debug_discovery.py", line 35, in <module>
payload = {"accessToken": auth_response["access_token"]}
KeyError: 'access_token'
User avatar
Xenomes
Posts: 396
Joined: Tuesday 27 November 2018 19:05
Target OS: Linux
Domoticz version: 2024.7
Location: Netherlands
Contact:

Re: Python Plugin: TUYA

Post by Xenomes »

Did you edit the file? You need to fill this is.

Code: Select all

# CHANGE THIS - BEGGINING
USERNAME = ""
PASSWORD = ""
REGION = "eu" # cn, eu, us
COUNTRY_CODE = "1" # Your account country code, e.g., 1 for USA or 86 for China
BIZ_TYPE = "smart_life" # tuya, smart_life, jinvoo_smart
FROM = "tuya" # you likely don't need to touch this
# CHANGE THIS - END
HP T630 (256GB SSD/8GB Mem) - Ubuntu 24.04.2 LTS (64Bit) - Domoticz 2024.7 (Docker) Machinon theme - RFLink - KaKu - Sonoff - Tasmota - Shelly - MQTT2Zigbee - OpenTherm Gateway - Tinytuya - IR Blaster - P1 Smart Meter - NPN Watermeter - Google Assistant
Rfpower666
Posts: 28
Joined: Thursday 26 October 2017 17:07
Target OS: Windows
Domoticz version:
Contact:

Re: Python Plugin: TUYA

Post by Rfpower666 »

Thanks - Changed the info in file, and it got credentials and looks good - But still showing no devices.. ? (Python log at bottom)

Domoticz Log:

2022-12-04 10:54:06.151 Tuya: 'Database':'/home/pi/domoticz/domoticz.db'
2022-12-04 10:54:06.151 Tuya: 'Language':'en'
2022-12-04 10:54:06.151 Tuya: 'Version':'1.0.14'
2022-12-04 10:54:06.151 Tuya: 'Author':'Wagner Oliveira contributed Xenomes'
2022-12-04 10:54:06.151 Tuya: 'Name':'Tuya'
2022-12-04 10:54:06.151 Tuya: 'Port':'0'
2022-12-04 10:54:06.151 Tuya: 'Username':'******************'
2022-12-04 10:54:06.151 Tuya: 'Password':'**************'
2022-12-04 10:54:06.151 Tuya: 'Key':'tuya'
2022-12-04 10:54:06.151 Tuya: 'Mode1':'47'
2022-12-04 10:54:06.151 Tuya: 'Mode2':'smart_life'
2022-12-04 10:54:06.151 Tuya: 'Mode6':'18'
2022-12-04 10:54:06.151 Tuya: 'DomoticzVersion':'2022.2'
2022-12-04 10:54:06.151 Tuya: 'DomoticzHash':'eea9db734'
2022-12-04 10:54:06.151 Tuya: 'DomoticzBuildTime':'2022-11-05 13:05:35'
2022-12-04 10:54:06.151 Tuya: Device count: 0
2022-12-04 10:54:06.152 Tuya: in handlethread
2022-12-04 10:54:06.252 Tuya: onHeartbeat called time=1670147646.2528498
2022-12-04 10:54:06.253 Tuya: in handlethread
2022-12-04 10:54:06.253 Tuya: Device count: 0
2022-12-04 10:54:09.937 ZIGI: UpdateDevice - (ZIGI - 4512737_Ampere-1fff00010000082c-01) 0:48.2
2022-12-04 10:54:11.948 ZIGI: UpdateDevice - (ZIGI - 4512737_Ampere-1fff00010000082c-01) 0:48.15
2022-12-04 10:54:11.953 ZIGI: UpdateDevice - (ZIGI - 4512737_Power-1fff00010000082c-01) 1121.0:1121
2022-12-04 10:54:11.954 ZIGI: UpdateDevice - (ZIGI - 4512737_Meter-1fff00010000082c-01) 0:1121.0;30500
2022-12-04 10:54:11.957 ZIGI: UpdateDevice - (ZIGI - 4512737_Power-1fff00010000082c-01) 1121.0:1121
2022-12-04 10:54:11.959 ZIGI: UpdateDevice - (ZIGI - 4512737_Meter-1fff00010000082c-01) 0:1121.0;30500
2022-12-04 10:54:13.959 ZIGI: UpdateDevice - (ZIGI - 4512737_Ampere-1fff00010000082c-01) 0:48.33
2022-12-04 10:54:15.919 ZIGI: UpdateDevice - (ZIGI - 4512737_Ampere-1fff00010000082c-01) 0:48.35
2022-12-04 10:54:16.923 ZIGI: UpdateDevice - (ZIGI - 4512737_Power-1fff00010000082c-01) 1131.0:1131
2022-12-04 10:54:16.925 ZIGI: UpdateDevice - (ZIGI - 4512737_Meter-1fff00010000082c-01) 0:1131.0;30500
2022-12-04 10:54:16.927 ZIGI: UpdateDevice - (ZIGI - 4512737_Power-1fff00010000082c-01) 1131.0:1131

Debug_Discovery.Py output:

Getting credentials
Got credentials
{ 'access_token': 'xxxxxxxxxxxxxxxxxxxyDXdRW',
'expires_in': 864000,
'refresh_token': xxxxxxxxxxxxxxxxxxuPfOI',
'token_type': 'bearer'}
Getting devices
Got devices
{ 'header': {'code': 'SUCCESS', 'payloadVersion': 1},
'payload': {'devices': [], 'scenes': []}}
!!! NOW REMOVE THIS FILE, SO YOUR CREDENTIALS (username, password) WON'T LEAK !!!
User avatar
Xenomes
Posts: 396
Joined: Tuesday 27 November 2018 19:05
Target OS: Linux
Domoticz version: 2024.7
Location: Netherlands
Contact:

Re: Python Plugin: TUYA

Post by Xenomes »

Rfpower666 wrote: Sunday 04 December 2022 10:57 'payload': {'devices': [], 'scenes': []}}
The Plugin can't find any devices. You can try the new plugin at viewtopic.php?p=295106#p295106 this uses a other communication module for Tuya a.
HP T630 (256GB SSD/8GB Mem) - Ubuntu 24.04.2 LTS (64Bit) - Domoticz 2024.7 (Docker) Machinon theme - RFLink - KaKu - Sonoff - Tasmota - Shelly - MQTT2Zigbee - OpenTherm Gateway - Tinytuya - IR Blaster - P1 Smart Meter - NPN Watermeter - Google Assistant
kalinkamaen
Posts: 52
Joined: Sunday 04 January 2015 15:57
Target OS: Windows
Domoticz version: 2022.2
Location: Norway
Contact:

Re: Python Plugin: TUYA

Post by kalinkamaen »

I have set up this plugin and it works with no errors.
But when i press a switch outside domoticz. Domoticz does not update switch in software.
Is this hust how it works, or is there something wrong with my setup?
Windows 10, Domoticz 14784
User avatar
Xenomes
Posts: 396
Joined: Tuesday 27 November 2018 19:05
Target OS: Linux
Domoticz version: 2024.7
Location: Netherlands
Contact:

Re: Python Plugin: TUYA

Post by Xenomes »

kalinkamaen wrote: Friday 09 December 2022 8:57 I have set up this plugin and it works with no errors.
But when i press a switch outside domoticz. Domoticz does not update switch in software.
Is this hust how it works, or is there something wrong with my setup?
The plugin reads the state of the switch once a minute. All states of Tuya are pull commands of the plugin.
HP T630 (256GB SSD/8GB Mem) - Ubuntu 24.04.2 LTS (64Bit) - Domoticz 2024.7 (Docker) Machinon theme - RFLink - KaKu - Sonoff - Tasmota - Shelly - MQTT2Zigbee - OpenTherm Gateway - Tinytuya - IR Blaster - P1 Smart Meter - NPN Watermeter - Google Assistant
kalinkamaen
Posts: 52
Joined: Sunday 04 January 2015 15:57
Target OS: Windows
Domoticz version: 2022.2
Location: Norway
Contact:

Re: Python Plugin: TUYA

Post by kalinkamaen »

[/quote]
The plugin reads the state of the switch once a minute. All states of Tuya are pull commands of the plugin.
[/quote]

Thanks, I will check this out. Then its better than I thought ;)
Windows 10, Domoticz 14784
daveinhull
Posts: 22
Joined: Thursday 20 August 2015 11:30
Target OS: Windows
Domoticz version: V2.2657
Location: UK
Contact:

Re: Python Plugin: TUYA

Post by daveinhull »

Hi,

Hope someone can help.
I have installed the plug-in and it has detected my devices and they seem to show the device state, but I cannot change any state. If I try to switch of a light it says 'switching off' but nothing happens either in Domotics or in real life.

Any thoughts as to what might e the issue?

Thanks in advance
Dave
Domoticz running on Windows 10 x64 Shuttle PC
RFComm, 9wall dimmers, 4dual sockets, 3x3way relays, 1x1way relay, 4PIRs, 2magnetic switches, 1radiator valve, WiFi link, coiler switch and controller, compatible security system, & lots of patience
kalinkamaen
Posts: 52
Joined: Sunday 04 January 2015 15:57
Target OS: Windows
Domoticz version: 2022.2
Location: Norway
Contact:

Re: Python Plugin: TUYA

Post by kalinkamaen »

daveinhull wrote: Wednesday 14 December 2022 8:40 Hi,

Hope someone can help.
I have installed the plug-in and it has detected my devices and they seem to show the device state, but I cannot change any state. If I try to switch of a light it says 'switching off' but nothing happens either in Domotics or in real life.

Any thoughts as to what might e the issue?

Thanks in advance
Dave
Have you checked in you log what is described when trying to switch on or off?
Windows 10, Domoticz 14784
daveinhull
Posts: 22
Joined: Thursday 20 August 2015 11:30
Target OS: Windows
Domoticz version: V2.2657
Location: UK
Contact:

Re: Python Plugin: TUYA

Post by daveinhull »

Hi kalinkamaen,

The log only says:
2022-12-16 08:28:10.732 Status: User: Admin (IP: 192.168.1.6) initiated a switch command (10/Smart Life - Lounge Floor/On)

Nothinig else

[P.S. However, I've now noticed that the system appears to be continually resetting or re-initialising - so this might be a cause and anyway, even if not, it cannot be good]

Toughts?
Dave
Domoticz running on Windows 10 x64 Shuttle PC
RFComm, 9wall dimmers, 4dual sockets, 3x3way relays, 1x1way relay, 4PIRs, 2magnetic switches, 1radiator valve, WiFi link, coiler switch and controller, compatible security system, & lots of patience
kalinkamaen
Posts: 52
Joined: Sunday 04 January 2015 15:57
Target OS: Windows
Domoticz version: 2022.2
Location: Norway
Contact:

Re: Python Plugin: TUYA

Post by kalinkamaen »

I am not an expert on this, but if domoticz system is resetting this is probably the problem.

But when the system is ressetting it self there should be errors in the log whats causing this?
You should copy your whole log, so poeple here understands whats happening.
Windows 10, Domoticz 14784
daveinhull
Posts: 22
Joined: Thursday 20 August 2015 11:30
Target OS: Windows
Domoticz version: V2.2657
Location: UK
Contact:

Re: Python Plugin: TUYA

Post by daveinhull »

Hi kalinkamaen,

Yes sorry I should have provided more detials, but wanted to see if I could find the problem myself. Here is the log, I've marked where it repeats, but I can't see anything unusal (except for the repeating of course :shock: :( )

2022-12-18 07:02:38.473 Sunrise: 08:15:00 SunSet: 15:42:00
2022-12-18 07:02:38.473 Day length: 07:27:00 Sun at south: 11:59:00
2022-12-18 07:02:38.473 Civil twilight start: 07:32:00 Civil twilight end: 16:25:00
2022-12-18 07:02:38.473 Nautical twilight start: 06:46:00 Nautical twilight end: 17:11:00
2022-12-18 07:02:38.473 Astronomical twilight start: 06:03:00 Astronomical twilight end: 17:54:00
2022-12-18 07:02:38.496 Active notification Subsystems: (0/13)
2022-12-18 07:02:38.508 Starting shared server on: :::6144
2022-12-18 07:02:38.463 Status: Domoticz V2022.2 (c)2012-2022 GizMoCuz
2022-12-18 07:02:38.464 Status: Build Hash: eea9db734, Date: 2022-11-05 12:05:35
2022-12-18 07:02:38.464 Status: Startup Path: C:\Program Files (x86)\Domoticz\
2022-12-18 07:02:38.494 Status: PluginSystem: Started, Python version '3.8.0', 1 plugin definitions loaded.
2022-12-18 07:02:38.498 Status: WebServer(HTTP) started on address: :: with port 8080
2022-12-18 07:02:38.508 Status: WebServer(SSL) started on address: :: with port 443
2022-12-18 07:02:38.510 Status: TCPServer: shared server started...
2022-12-18 07:02:38.510 Status: RxQueue: queue worker started...
2022-12-18 07:02:40.547 Smart Life: Worker thread started.
2022-12-18 07:02:40.547 Status: (EvoHome) Worker started...
2022-12-18 07:02:40.547 Status: RFXCom: Worker started...
2022-12-18 07:02:40.547 Status: Smart Life: Entering work loop.
2022-12-18 07:02:40.547 Status: Smart Life: Started.
2022-12-18 07:02:40.547 Status: EventSystem: reset all events...
2022-12-18 07:02:40.547 Status: NotificationSystem: thread started...
2022-12-18 07:02:40.547 Status: EventSystem: reset all device statuses...
2022-12-18 07:02:40.583 Status: Python EventSystem: Initializing event module.
2022-12-18 07:02:40.585 Status: EventSystem: Started
2022-12-18 07:02:40.585 Status: EventSystem: Queue thread started...
REPEAT HERE with no errors above
2022-12-18 07:02:45.224 Sunrise: 08:15:00 SunSet: 15:42:00
2022-12-18 07:02:45.226 Day length: 07:27:00 Sun at south: 11:59:00
2022-12-18 07:02:45.226 Civil twilight start: 07:32:00 Civil twilight end: 16:25:00
2022-12-18 07:02:45.226 Nautical twilight start: 06:46:00 Nautical twilight end: 17:11:00
2022-12-18 07:02:45.226 Astronomical twilight start: 06:03:00 Astronomical twilight end: 17:54:00
2022-12-18 07:02:45.246 Active notification Subsystems: (0/13)
2022-12-18 07:02:45.258 Starting shared server on: :::6144
2022-12-18 07:02:45.213 Status: Domoticz V2022.2 (c)2012-2022 GizMoCuz
2022-12-18 07:02:45.213 Status: Build Hash: eea9db734, Date: 2022-11-05 12:05:35
2022-12-18 07:02:45.213 Status: Startup Path: C:\Program Files (x86)\Domoticz\
2022-12-18 07:02:45.244 Status: PluginSystem: Started, Python version '3.8.0', 1 plugin definitions loaded.
2022-12-18 07:02:45.249 Status: WebServer(HTTP) started on address: :: with port 8080
2022-12-18 07:02:45.256 Status: WebServer(SSL) started on address: :: with port 443
2022-12-18 07:02:45.258 Status: TCPServer: shared server started...
2022-12-18 07:02:45.258 Status: RxQueue: queue worker started...
REPEAT HERE with no errors above
2022-12-18 07:02:48.643 Sunrise: 08:15:00 SunSet: 15:42:00
2022-12-18 07:02:48.643 Day length: 07:27:00 Sun at south: 11:59:00
2022-12-18 07:02:48.643 Civil twilight start: 07:32:00 Civil twilight end: 16:25:00
2022-12-18 07:02:48.643 Nautical twilight start: 06:46:00 Nautical twilight end: 17:11:00
2022-12-18 07:02:48.643 Astronomical twilight start: 06:03:00 Astronomical twilight end: 17:54:00
2022-12-18 07:02:48.665 Active notification Subsystems: (0/13)
2022-12-18 07:02:48.676 Starting shared server on: :::6144
2022-12-18 07:02:48.633 Status: Domoticz V2022.2 (c)2012-2022 GizMoCuz
2022-12-18 07:02:48.633 Status: Build Hash: eea9db734, Date: 2022-11-05 12:05:35
2022-12-18 07:02:48.633 Status: Startup Path: C:\Program Files (x86)\Domoticz\
2022-12-18 07:02:48.663 Status: PluginSystem: Started, Python version '3.8.0', 1 plugin definitions loaded.
2022-12-18 07:02:48.667 Status: WebServer(HTTP) started on address: :: with port 8080
2022-12-18 07:02:48.674 Status: WebServer(SSL) started on address: :: with port 443
2022-12-18 07:02:48.676 Status: TCPServer: shared server started...
2022-12-18 07:02:48.676 Status: RxQueue: queue worker started...
2022-12-18 07:02:50.695 Smart Life: Worker thread started.
2022-12-18 07:02:50.695 Status: (EvoHome) Worker started...
2022-12-18 07:02:50.695 Status: RFXCom: Worker started...
2022-12-18 07:02:50.695 Status: Smart Life: Entering work loop.
2022-12-18 07:02:50.695 Status: Smart Life: Started.
2022-12-18 07:02:50.695 Status: NotificationSystem: thread started...
2022-12-18 07:02:50.695 Status: EventSystem: reset all events...
2022-12-18 07:02:50.695 Status: EventSystem: reset all device statuses...
REPEAT HERE with no errors above
2022-12-18 07:02:55.695 Sunrise: 08:15:00 SunSet: 15:42:00
2022-12-18 07:02:55.695 Day length: 07:27:00 Sun at south: 11:59:00
2022-12-18 07:02:55.695 Civil twilight start: 07:32:00 Civil twilight end: 16:25:00
2022-12-18 07:02:55.695 Nautical twilight start: 06:46:00 Nautical twilight end: 17:11:00
2022-12-18 07:02:55.695 Astronomical twilight start: 06:03:00 Astronomical twilight end: 17:54:00
2022-12-18 07:02:55.718 Active notification Subsystems: (0/13)
2022-12-18 07:02:55.729 Starting shared server on: :::6144
2022-12-18 07:02:55.681 Status: Domoticz V2022.2 (c)2012-2022 GizMoCuz
2022-12-18 07:02:55.681 Status: Build Hash: eea9db734, Date: 2022-11-05 12:05:35
2022-12-18 07:02:55.681 Status: Startup Path: C:\Program Files (x86)\Domoticz\
2022-12-18 07:02:55.717 Status: PluginSystem: Started, Python version '3.8.0', 1 plugin definitions loaded.
2022-12-18 07:02:55.720 Status: WebServer(HTTP) started on address: :: with port 8080
2022-12-18 07:02:55.728 Status: WebServer(SSL) started on address: :: with port 443
2022-12-18 07:02:55.729 Status: TCPServer: shared server started...
2022-12-18 07:02:55.729 Status: RxQueue: queue worker started...
Domoticz running on Windows 10 x64 Shuttle PC
RFComm, 9wall dimmers, 4dual sockets, 3x3way relays, 1x1way relay, 4PIRs, 2magnetic switches, 1radiator valve, WiFi link, coiler switch and controller, compatible security system, & lots of patience
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest