Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ModuleNotFoundError #12

Open
vespino opened this issue Dec 4, 2024 · 4 comments
Open

ModuleNotFoundError #12

vespino opened this issue Dec 4, 2024 · 4 comments

Comments

@vespino
Copy link

vespino commented Dec 4, 2024

Trying this plugin hoping to move from "Domoticz-TinyTUYA-Plugin" and I'm getting the following the following errors:

2024-12-04 07:51:49.515 Error: LocalTUYA: (tinytuyalocal) failed to load 'plugin.py', Python Path used was '/opt/domoticz/userdata/plugins/Domoticz-TinyTUYA-Local-Plugin/:/usr/lib/python39.zip:/usr/lib/python3.9:/usr/lib/python3.9/lib-dynload:/usr/local/lib/python3.9/dist-packages:/usr/lib/python3/dist-packages:/usr/lib/python3.9/dist-packages'.
2024-12-04 07:51:49.522 Error: LocalTUYA: Traceback (most recent call last):
2024-12-04 07:51:49.522 Error: LocalTUYA: File "/opt/domoticz/userdata/plugins/Domoticz-TinyTUYA-Local-Plugin/plugin.py", line 39, in <module>
2024-12-04 07:51:49.522 Error: LocalTUYA: import tinytuya
2024-12-04 07:51:49.522 Error: LocalTUYA: File "/usr/local/lib/python3.9/dist-packages/tinytuya/__init__.py", line 92, in <module>
2024-12-04 07:51:49.522 Error: LocalTUYA: from .core import *
2024-12-04 07:51:49.522 Error: LocalTUYA: File "/usr/local/lib/python3.9/dist-packages/tinytuya/core.py", line 121, in <module>
2024-12-04 07:51:49.522 Error: LocalTUYA: raise ModuleNotFoundError('No crypto library found, please "pip install" cryptography, pycryptodome, or pyaes')
2024-12-04 07:51:49.522 Error: LocalTUYA: ModuleNotFoundError: No crypto library found, please "pip install" cryptography, pycryptodome, or pyaes

I'm running both plugins in the same container, will that work? I have installed cryptography.

When running the wizard inside the container all seems to work fine until polling the devices where I'm greeted with the following errors:

Scanning local network for Tuya devices...
    0 local devices discovered

Polling local devices...
    [Hanglamp                 ] Error: No IP found
    [Kachel woonkamer         ] Error: No IP found
    [Kantoor                  ] Error: No IP found
    etc

My devices are on a separate IoT network, could this be causing this issue? The plugin probably only scanning the current subnet?

@vespino
Copy link
Author

vespino commented Dec 4, 2024

I have always had the log level "info" of "Domoticz-TinyTUYA-Plugin" turned off, when turning it on I'm getting similar errors as shown above, so I'm guessing this not to be the issue:

2024-12-04 09:15:07.683 Error: TinyTUYA: (tinytuya) failed to load 'plugin.py', Python Path used was '/opt/domoticz/userdata/plugins/Domoticz-TinyTUYA-Plugin/:/usr/lib/python39.zip:/usr/lib/python3.9:/usr/lib/python3.9/lib-dynload:/usr/local/lib/python3.9/dist-packages:/usr/lib/python3/dist-packages:/usr/lib/python3.9/dist-packages'.
2024-12-04 09:15:07.686 Error: TinyTUYA: Traceback (most recent call last):
2024-12-04 09:15:07.686 Error: TinyTUYA: File "/opt/domoticz/userdata/plugins/Domoticz-TinyTUYA-Plugin/plugin.py", line 67, in <module>
2024-12-04 09:15:07.686 Error: TinyTUYA: import tinytuya
2024-12-04 09:15:07.686 Error: TinyTUYA: File "/usr/local/lib/python3.9/dist-packages/tinytuya/__init__.py", line 92, in <module>
2024-12-04 09:15:07.686 Error: TinyTUYA: from .core import *
2024-12-04 09:15:07.686 Error: TinyTUYA: File "/usr/local/lib/python3.9/dist-packages/tinytuya/core.py", line 121, in <module>
2024-12-04 09:15:07.686 Error: TinyTUYA: raise ModuleNotFoundError('No crypto library found, please "pip install" cryptography, pycryptodome, or pyaes')
2024-12-04 09:15:07.686 Error: TinyTUYA: ModuleNotFoundError: No crypto library found, please "pip install" cryptography, pycryptodome, or pyaes

Think it's my subnet.

@vespino
Copy link
Author

vespino commented Dec 4, 2024

Think I have it working now, although I'm not sure if part of this comes from the fact the devices already were imported from the cloud plugin.

Still have one question though: I'm getting 6 new devices tomorrow, will those be added to Domoticz automagically?

@vespino
Copy link
Author

vespino commented Dec 4, 2024

Spun up a separate Domoticz instance, added the plugin, ran the wizard and I'm greeted with the following error and no devices were added:

2024-12-04 09:54:15.905 Error: LocalTuya: handleThread: 'ip' line 183

So I'm still thinking it's my subnet.

@vespino
Copy link
Author

vespino commented Dec 4, 2024

Eureka! I removed a device from my Tuya account just to add it again but now on my main LAN instead of my IoT LAN and now the IP address was found. A restart of Domoticz and the device was added there too.

So: it would be great if the plugin would also scan over multiple subnets or (probably better) the possibility to add a subnet other than the one Domoticz is on.

Still testing what happens when I add the IP addresses to devices.json by hand.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant