Xenomes / Domoticz-TinyTUYA-Plugin

A bridge between Tinytuya and Domoticz
11 stars 6 forks source link

Failed to import plugin #44

Closed ricorico94 closed 1 year ago

ricorico94 commented 1 year ago

Hi,

I tried to migrate from former Domoticz-Tuya-Plugin (which was working) to Domoticz-TinyTuya-Plugin, but I face error messages that I don't understand. I use Buster and Domoticz 2023.1, Python 3.7.3. I face error: Error: SmartLife-Tuya: (tuya) failed to load 'plugin.py', Python Path used was ':/usr/lib/python37.zip:/usr/lib/python3.7:/usr/lib/python3.7/lib-dynload:/usr/local/lib/python3.7/dist-packages:/usr/lib/python3/dist-packages:/usr/lib/python3.7/dist-packages'.

For migrating , I did the following:

I tried to investigate using the Domoticz wiki : it seems my mibrary is ok: the command dpkg --get-selections | grep libpython shows libpython3.7 . I noticed that in the path shown in error message, I don't see the /domoticz/plugins folder nor /domoticz/plugins/Domoticz-Tinytuya-Plugin . Is it normal ? I tried: XX@raspberrypi:~/domoticz/plugins/Domoticz-TinyTUYA-Plugin $ sudo pip3 tinytuya ERROR: unknown command "tinytuya" I also made the plugin.py executable. Any idea ?

br, Ricorico94

Xenomes commented 1 year ago

This is a strange one. Is Domoticz running under a other user? sudo ps aux | grep domoticz/domoticz if user is other a root then install the pip3 install requests==2.23.0 charset-normalizer==3.0.1 tinytuya -U without the sudo.

ricorico94 commented 1 year ago

Thanks for your help. I have this: pi@raspberrypi:~ $ sudo ps aux | grep domoticz/domoticz root 768 4.2 7.4 449652 69976 ? Ssl 19:37 4:06 /home/pi/domoticz/domoticz -daemon -www 8080 -sslwww 443 pi 32050 0.0 0.0 7476 476 pts/0 S+ 21:14 0:00 grep --color=auto domoticz/domoticz

So 2 users ? Is it normal ?

Xenomes commented 1 year ago

Yes the output is normal. first line is Domoticz the second line is the search command. So Domoticz is running as root.

What gives: sudo pip3 -V

7lano commented 1 year ago

and that's the problem some things you did as root, some as user pi

you described your problem poorly, but it seems to me that root has taken over the permissions on the files you are trying to run as a non-root user

ricorico94 commented 1 year ago

@Xenomes: I get this:

pi@raspberrypi:~ $ sudo pip3 -V
pip 18.1 from /usr/lib/python3/dist-packages/pip (python 3.7)

@7lano : Xenomes was mentioning that it looks normal, I feel confused.. Which details should I give to describe my problem ? I tried to explain, but I easily admit that I 'm not an expert here and I'm probbaly missing some things to check.

Xenomes commented 1 year ago

That looks correct to. Can you install this without sudo, then it is installed under the user. pip3 install requests==2.23.0 charset-normalizer==3.0.1 tinytuya -U Then restart Domoticz. Hope that the plugin then can find the tinytuya module.

Xenomes commented 1 year ago

Closed due to no response.