Page 23 of 26
Re: Python Plugin: TUYA
Posted: Monday 19 December 2022 12:41
by kalinkamaen
daveinhull wrote: ↑Sunday 18 December 2022 8:27
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

)
Yeah that is strange. This is above my head. But If it was me I would start to dissable plugins one bye one and see if its a plugin problem.
I hope that someone else could help you with you problem.
Edit: Also suggested in another tread try do delete/clean cache in you browser.
Regards Kali
Re: Python Plugin: TUYA
Posted: Friday 13 January 2023 14:20
by Snarfdomoticz
Hello I have and Silvergear Smart plug with Energy monitor can see the smart plug and switch it in domoticz
but the energy measurement is not, is also a possibility for this
Re: Python Plugin: TUYA
Posted: Saturday 14 January 2023 20:55
by Xenomes
Snarfdomoticz wrote: ↑Friday 13 January 2023 14:20
Hello I have and Silvergear Smart plug with Energy monitor can see the smart plug and switch it in domoticz
but the energy measurement is not, is also a possibility for this
In the Domoticz-TUYA-Plugin there is no energy data returning from tuya API v1 but the Domoticz-TinyTUYA-Plugin you can get energy data readouts.
Re: Python Plugin: TUYA
Posted: Saturday 14 January 2023 21:37
by Xenomes
daveinhull wrote: ↑Sunday 18 December 2022 8:27
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

)
Did you enable debug in the plug in? There is not enough information in the log that i can help you.
Re: Python Plugin: TUYA
Posted: Tuesday 24 January 2023 13:38
by HansLe
TinyTuya plugin to get energy data readouts works great. See this post in the Dutch domoticz forum were I mentioned how to check it before you install it in Domoticz.
https://contactkring.nl/phpbb/viewtopic ... 0bcf#p4526
The text is in Dutch but wit Google Translate or Deepl.com it is easy translated

Re: Python Plugin: TUYA
Posted: Sunday 05 February 2023 9:25
by rolandtwilt
Xenomes wrote: ↑Saturday 12 November 2022 15:22
rolandtwilt wrote: ↑Saturday 12 November 2022 15:20
it works like a charm! thank you very much!
Perfect! Then i will push it to the main branch, thanks for reporting and testing!
Good morning, has something changed? I get a lot of error messages, via the Tuya app it works fine, but I don't Domoticz. After restarting Domoticz it works for a while and then error messages again, see log below;
2023-02-05 09:01:03.777 Error: tuya: Command for DeviceID=bf0a5da5baf87abfa7jtdd but device is not available.
2023-02-05 09:19:23.592 Error: tuya: handleThread: HTTPSConnectionPool(host='px1.tuyaeu.com', port=443): Max retries exceeded with url: /homeassistant/access.do?grant_type=refresh_token&refresh_token=EUheu163095134106254dqpcNUsR00ifv (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0xa4d9d890>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')) line 215
2023-02-05 09:19:33.571 Error: tuya: handleThread: HTTPSConnectionPool(host='px1.tuyaeu.com', port=443): Max retries exceeded with url: /homeassistant/access.do?grant_type=refresh_token&refresh_token=EUheu163095134106254dqpcNUsR00ifv (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0xa4d9d910>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')) line 215
2023-02-05 09:19:45.305 Error: tuya: handleThread: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer')) line 215
Please help

Re: Python Plugin: TUYA
Posted: Wednesday 01 March 2023 10:22
by heggink
Hey @Xenomes,
I noticed that there is a local API for HA. Have you considered adding that? It would allow controlling devices even if the internet connection is down...
Cheers,
Herman
Re: Python Plugin: TUYA
Posted: Wednesday 01 March 2023 19:29
by Xenomes
heggink wrote: ↑Wednesday 01 March 2023 10:22
Hey @Xenomes,
I noticed that there is a local API for HA. Have you considered adding that? It would allow controlling devices even if the internet connection is down...
Cheers,
Herman
Yes i know That is exist, also experimenting with it in the background with the
other plugin.
I don't have a idea how to inplant the
DP ID's to control devices switch 1 is easy on/off but the rest.
Re: Python Plugin: TUYA
Posted: Thursday 04 May 2023 10:03
by aldodemi
After upgrade to Ubuntu 23.04 error starting the plugin:
2023-05-04 09:59:21.873 Error: SmartLife: (tuya) failed to load 'plugin.py', Python Path used was '/home/domoticz/domoticz/plugins/tuyaha/:/usr/lib/python311.zip:/usr/lib/python3.11:/usr/lib/python3.11/lib-dynload:/usr/local/lib/python3.11/dist-packages:/usr/lib/python3/dist-packages:/usr/lib/python3.11/dist-packages'.
2023-05-04 09:59:21.881 Error: SmartLife: Traceback (most recent call last):
2023-05-04 09:59:21.881 Error: SmartLife: File "/home/domoticz/domoticz/plugins/tuyaha/plugin.py", line 65, in <module>
2023-05-04 09:59:21.881 Error: SmartLife: import tuyaha
2023-05-04 09:59:21.881 Error: SmartLife: ModuleNotFoundError: No module named 'tuyaha'
This is the only plugin that fails.
Path is: /home/domoticz/domoticz/plugins/tuyaha
Re: Python Plugin: TUYA
Posted: Thursday 04 May 2023 10:14
by waltervl
Support for Python 3.11 could be fixed in latest beta (but perhaps only for Windows). Are you running latest beta?
Edit. Else try to install the missing python module again, se the instructions on the plugin github repository.
Re: Python Plugin: TUYA
Posted: Thursday 04 May 2023 11:34
by aldodemi
Yes, sorry, I'm on the last beta:
Info on Domoticz
Version: 2023.1 (build 15224)
Build Hash: 789a00d3b-modified
Compile Date: 2023-05-04 07:49:56
dzVents Version: 3.1.8
Python Version: 3.11.2 (main, Mar 13 2023, 12:18:29) [GCC 12.2.0]
domoticz@ns2server:~/domoticz/plugins/tuyaha$ pip3 install requests --break-system-package
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: requests in /usr/lib/python3/dist-packages (2.28.1)
Re: Python Plugin: TUYA
Posted: Thursday 04 May 2023 12:44
by Xenomes
As mentioned by waltervl the module tuyaha is missing.
Code: Select all
2023-05-04 09:59:21.881 Error: SmartLife: ModuleNotFoundError: No module named 'tuyaha'
Domoticz runs under the root user in most cases the module need to be installed with sudo.
Re: Python Plugin: TUYA
Posted: Thursday 04 May 2023 19:14
by aldodemi
No way...
sudo pip3 install requests --break-system-package
Requirement already satisfied: requests in /usr/lib/python3/dist-packages (2.28.1)
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead:
https://pip.pypa.io/warnings/venv
please help....
Re: Python Plugin: TUYA
Posted: Thursday 04 May 2023 19:34
by Xenomes
You are missing the 'tuyaha' module.
Re: Python Plugin: TUYA
Posted: Friday 05 May 2023 10:21
by aldodemi
'tuyaha' module was, and is, already installed...
domoticz@ns2server:~/domoticz/plugins/tuyaha$ pip3 install tuyaha --break-system-package
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: tuyaha in /usr/local/lib/python3.11/dist-packages (0.0.11)
Requirement already satisfied: requests in /usr/lib/python3/dist-packages (from tuyaha) (2.28.1)
domoticz@ns2server:~/domoticz/plugins/tuyaha$ sudo pip3 install tuyaha --break-system-package
Requirement already satisfied: tuyaha in /usr/local/lib/python3.11/dist-packages (0.0.11)
Requirement already satisfied: requests in /usr/lib/python3/dist-packages (from tuyaha) (2.28.1)
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead:
https://pip.pypa.io/warnings/venv
Re: Python Plugin: TUYA
Posted: Friday 05 May 2023 12:02
by waltervl
tuyaha projct is not maintained anymore.
https://github.com/PaulAnnekov/tuyaha
Does the tools\debug_discovery.py script working?
Re: Python Plugin: TUYA
Posted: Friday 05 May 2023 13:43
by aldodemi
The debug_discovery.py script work without problem (but before Ubuntu upgrade all worked fine)
Re: Python Plugin: TUYA
Posted: Friday 05 May 2023 16:51
by Xenomes
Work the debug_discovery.py with sudo?
Verstuurd vanaf mijn SM-A536B met Tapatalk
Re: Python Plugin: TUYA
Posted: Saturday 06 May 2023 20:03
by Xenomes
aldodemi wrote: ↑Friday 05 May 2023 13:43
The debug_discovery.py script work without problem (but before Ubuntu upgrade all worked fine)
Just installed Ubuntu 23.04
Installed the latest beta of Domoticz
Fixed start Domoticz with
Code: Select all
wget http://nz2.archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2.18_amd64.deb
sudo dpkg -i libssl1.1_1.1.1f-1ubuntu2.18_amd64.deb
Cloned plugin and installed modules with
Code: Select all
sudo pip3 install tuyaha requests --break-system-packages
Code: Select all
2023-05-06 17:57:48.810 Status: Domoticz V2023.1 (build 15230) (c)2012-2023 GizMoCuz
2023-05-06 17:57:48.813 Status: Build Hash: a0b31dfc5, Date: 2023-05-06 10:43:52
2023-05-06 17:57:48.813 Status: Startup Path: /home/pi/domoticz/
2023-05-06 17:57:48.851 Status: PluginSystem: Started, Python version '3.11.2', 2 plugin definitions loaded.
2023-05-06 17:57:48.855 Status: WebServer(HTTP) started on address: :: with port 8080
2023-05-06 17:57:48.859 Status: WebServer(SSL) startup failed on address :: with port: 443: bind: Permission denied, trying ::
2023-05-06 17:57:48.862 Status: WebServer(SSL) startup failed on address :: with port: 443: bind: Permission denied, trying 0.0.0.0
2023-05-06 17:57:48.864 Status: TCPServer: shared server started...
2023-05-06 17:57:48.866 Status: RxQueue: queue worker started...
2023-05-06 17:57:48.824 Error: Default admin password has NOT been changed! Change it asap!
2023-05-06 17:57:48.863 Error: WebServer(SSL) startup failed on address 0.0.0.0 with port: 443: bind: Permission denied
2023-05-06 17:57:48.863 Error: WebServer(SSL) check privileges for opening ports below 1024
2023-05-06 17:57:50.873 Tuya: Worker thread started.
2023-05-06 17:57:50.873 Status: Tuya: Started.
2023-05-06 17:57:50.873 Status: Tuya: Entering work loop.
2023-05-06 17:57:50.873 Status: NotificationSystem: thread started...
2023-05-06 17:57:50.874 Status: EventSystem: reset all events...
2023-05-06 17:57:50.875 Status: EventSystem: reset all device statuses...
2023-05-06 17:57:50.897 Status: Python EventSystem: Initializing event module.
2023-05-06 17:57:50.900 Status: EventSystem: Started
2023-05-06 17:57:50.900 Status: EventSystem: Queue thread started...
2023-05-06 17:57:51.129 Tuya: Waiting 60 seconds to connect TuyaApi login error timeout
2023-05-06 17:57:51.129 Tuya: Waiting 50 seconds to connect TuyaApi (Tuya Plug-in)
2023-05-06 17:57:51.128 Status: Tuya: Initialized version 1.0.16, author 'Wagner Oliveira contributed Xenomes'
2023-05-06 17:57:51.343 Status: PluginSystem: 1 plugins started.
2023-05-06 17:58:01.136 Tuya: Waiting 40 seconds to connect TuyaApi (Tuya Plug-in)
2023-05-06 17:58:11.138 Tuya: Waiting 30 seconds to connect TuyaApi (Tuya Plug-in)
2023-05-06 17:58:21.168 Tuya: Waiting 20 seconds to connect TuyaApi (Tuya Plug-in)
2023-05-06 17:58:31.207 Tuya: Waiting 10 seconds to connect TuyaApi (Tuya Plug-in)
2023-05-06 17:58:41.214 Tuya: Waiting 0 seconds to connect TuyaApi (Tuya Plug-in)
2023-05-06 17:58:51.216 Tuya: TUYA plugin started
2023-05-06 17:58:51.216 Tuya: Debug logging mask set to: PYTHON CONNECTION
2023-05-06 17:58:51.216 Tuya: 'HardwareID':'2'
2023-05-06 17:58:51.216 Tuya: 'HomeFolder':'/home/pi/domoticz/plugins/Domoticz-TUYA-Plugin/'
2023-05-06 17:58:51.216 Tuya: 'StartupFolder':'/home/pi/domoticz/'
2023-05-06 17:58:51.216 Tuya: 'UserDataFolder':'/home/pi/domoticz/'
2023-05-06 17:58:51.216 Tuya: 'Database':'/home/pi/domoticz/domoticz.db'
2023-05-06 17:58:51.216 Tuya: 'Language':'en'
2023-05-06 17:58:51.216 Tuya: 'Version':'1.0.16'
2023-05-06 17:58:51.216 Tuya: 'Author':'Wagner Oliveira contributed Xenomes'
2023-05-06 17:58:51.216 Tuya: 'Name':'Tuya'
2023-05-06 17:58:51.216 Tuya: 'Port':'0'
2023-05-06 17:58:51.216 Tuya: 'Username':''
2023-05-06 17:58:51.216 Tuya: 'Password':''
2023-05-06 17:58:51.216 Tuya: 'Key':'tuya'
2023-05-06 17:58:51.216 Tuya: 'Mode1':'31'
2023-05-06 17:58:51.216 Tuya: 'Mode2':'smart_life'
2023-05-06 17:58:51.216 Tuya: 'Mode6':'18'
2023-05-06 17:58:51.216 Tuya: 'DomoticzVersion':'2023.1 (build 15230)'
2023-05-06 17:58:51.216 Tuya: 'DomoticzHash':'a0b31dfc5'
2023-05-06 17:58:51.216 Tuya: 'DomoticzBuildTime':'2023-05-06 10:43:52'
2023-05-06 17:58:51.216 Tuya: Device count: 2
2023-05-06 17:58:51.217 Tuya: Device: 1 - ID: 1, Name: 'Tuya - 3D Lamp', nValue: 0, sValue: 'Off'
2023-05-06 17:58:51.217 Tuya: Device ID: '1'
2023-05-06 17:58:51.217 Tuya: Device Name: 'Tuya - 3D Lamp'
2023-05-06 17:58:51.217 Tuya: Device nValue: 0
2023-05-06 17:58:51.217 Tuya: Device sValue: 'Off'
2023-05-06 17:58:51.217 Tuya: Device LastLevel: 0
2023-05-06 17:58:51.218 Tuya: in handlethread
2023-05-06 17:58:51.323 Tuya: onHeartbeat called time=1683395931.3230166
2023-05-06 17:58:51.323 Tuya: in handlethread
2023-05-06 17:58:51.323 Tuya: Device count: 1
Conclusion is the the plugin works under python 3.11
The problem you have is a misconfiguration of your system.
Check if you pip3 is using the correct python version.
Re: Python Plugin: TUYA
Posted: Monday 08 May 2023 16:23
by ricorico94
Hi,
I've been using the great pugin for long time now, with several switches devices : great job and thanks a lot !
I've just added through my android App Smart Life a new device, an "irrigation device" "ie this :
https://fr.aliexpress.com/item/10050050 ... pt=glo2fra
It seems working well when using the android app.
However, when I stop/start the plugin in domoticz, it doesn't see that device. If I use the debug_discovery.py script, I can also see my other switching devices, but not that one.
Any idea of what I can try to get it listed and working ? (in practice the oly thing I'd like to do through Domoticz is to switch it on/off, like standard electric switches..)
br,
Ricorico94