Plugin won't load

Posted on
Tue Mar 14, 2023 4:31 pm
7rdr7 offline
Posts: 163
Joined: Aug 16, 2017
Location: Washington DC Metro

Plugin won't load

Thanks for creating this plugin! Looking forward to getting my devices into Indigo. After installing the plugin, I get the following error in the logs:

Tuya Error Error in plugin execution InitializeMain:

File "plugin.py", line 15, in <module>
File "/Library/Application Support/Perceptive Automation/Indigo 2022.2/Plugins/Tuya.IndigoPlugin/Contents/Server Plugin/tuya_iot/__init__.py", line 2, in <module>
File "/Library/Application Support/Perceptive Automation/Indigo 2022.2/Plugins/Tuya.IndigoPlugin/Contents/Server Plugin/tuya_iot/device.py", line 11, in <module>
File "/Library/Application Support/Perceptive Automation/Indigo 2022.2/Plugins/Tuya.IndigoPlugin/Contents/Server Plugin/tuya_iot/openmq.py", line 13, in <module>
type: No module named 'Crypto'

Stopping plugin "Tuya 2022.2.0" (pid 68005)

The plugin shows a "red" status. I tried downgrading to prior releases, but no change. Do I need to install something else first? I have the bulbs already running in the Tuya app on my iPhone and in Homebridge. Appreciate any guidance. Thanks again!

Posted on
Wed Mar 15, 2023 5:36 am
siclark offline
Posts: 1963
Joined: Jun 13, 2017
Location: UK

Re: Plugin won't load

You need to install the cryptography module.

Pip3 install cryptography

Posted on
Wed Mar 15, 2023 8:16 am
7rdr7 offline
Posts: 163
Joined: Aug 16, 2017
Location: Washington DC Metro

Re: Plugin won't load

Thanks siclark. I checked, and it appears that cryptography is already installed.

mediaserver@Pine-Island ~ % Pip3 install cryptography
Requirement already satisfied: cryptography in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (37.0.2)
Requirement already satisfied: cffi>=1.12 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from cryptography) (1.15.0)
Requirement already satisfied: pycparser in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from cffi>=1.12->cryptography) (2.21)

mediaserver@Pine-Island ~ % pip3 show cryptography
Name: cryptography
Version: 37.0.2
Summary: cryptography is a package which provides cryptographic recipes and primitives to Python developers.
Home-page: https://github.com/pyca/cryptography
Author: The Python Cryptographic Authority and individual contributors
Author-email: cryptography-dev@python.org
License: BSD-3-Clause OR Apache-2.0
Location: /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages
Requires: cffi
Required-by:

Posted on
Wed Mar 15, 2023 9:25 am
CliveS offline
Posts: 771
Joined: Jan 10, 2016
Location: Medomsley, County Durham, UK

Re: Plugin won't load

Looks like you are running an older version (37.0.2), the latest is 39.0.2 so try

Code: Select all
pip3 install --upgrade cryptography

CliveS

Indigo 2023.2.0 : macOS Ventura 13.6.3 : Mac Mini M2 : 8‑core CPU and 10‑core GPU : 8 GB : 256GB SSD
----------------------------------------------------------------------------------
The best way to get the right answer on the Internet is not to ask a question, it's to post the wrong answer

Posted on
Wed Mar 15, 2023 9:36 am
7rdr7 offline
Posts: 163
Joined: Aug 16, 2017
Location: Washington DC Metro

Re: Plugin won't load

Thanks for the suggestion. Upgraded cryptography, restarted, still the same issue:

mediaserver@Pine-Island ~ % pip3 install --upgrade cryptography
Requirement already satisfied: cryptography in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (37.0.2)
Collecting cryptography
Downloading cryptography-39.0.2-cp36-abi3-macosx_10_12_x86_64.whl (2.9 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.9/2.9 MB 12.9 MB/s eta 0:00:00
Requirement already satisfied: cffi>=1.12 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from cryptography) (1.15.0)
Requirement already satisfied: pycparser in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from cffi>=1.12->cryptography) (2.21)
Installing collected packages: cryptography
Attempting uninstall: cryptography
Found existing installation: cryptography 37.0.2
Uninstalling cryptography-37.0.2:
Successfully uninstalled cryptography-37.0.2
Successfully installed cryptography-39.0.2

****************************************************

Reloading plugin "Tuya 2022.2.0" using API v3.0
Starting plugin "Tuya 2022.2.0" (pid 2945)
Tuya Error Error in plugin execution InitializeMain:

File "plugin.py", line 15, in <module>
File "/Library/Application Support/Perceptive Automation/Indigo 2022.2/Plugins/Tuya.IndigoPlugin/Contents/Server Plugin/tuya_iot/__init__.py", line 2, in <module>
File "/Library/Application Support/Perceptive Automation/Indigo 2022.2/Plugins/Tuya.IndigoPlugin/Contents/Server Plugin/tuya_iot/device.py", line 11, in <module>
File "/Library/Application Support/Perceptive Automation/Indigo 2022.2/Plugins/Tuya.IndigoPlugin/Contents/Server Plugin/tuya_iot/openmq.py", line 13, in <module>
type: No module named 'Crypto'

Stopping plugin "Tuya 2022.2.0" (pid 2945)
Stopped plugin "Tuya 2022.2.0"

Posted on
Wed Mar 15, 2023 9:48 am
siclark offline
Posts: 1963
Joined: Jun 13, 2017
Location: UK

Re: Plugin won't load

I’m sure the plug-in is python 3 but maybe try above with pip and not pip3?

Posted on
Wed Mar 15, 2023 9:53 am
7rdr7 offline
Posts: 163
Joined: Aug 16, 2017
Location: Washington DC Metro

Re: Plugin won't load

Tried that, no change:

mediaserver@Pine-Island ~ % pip install --upgrade cryptography
Requirement already satisfied: cryptography in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (39.0.2)
Requirement already satisfied: cffi>=1.12 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from cryptography) (1.15.0)
Requirement already satisfied: pycparser in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from cffi>=1.12->cryptography) (2.21)

Posted on
Wed Mar 15, 2023 11:31 am
racarter offline
User avatar
Posts: 479
Joined: Jun 18, 2016
Location: North Yorkshire, UK

Re: Plugin won't load

Try this:

pip3 install Crypto

Then navigate to:

Macintosh HD/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages

and rename folder 'crypto' to 'Crypto'

** Note that if the Python version has changed you'll need to replace the 3.11s in the above path with the new version number. **

If you get error messages saying Crypto is missing when you start the plugin (sometimes happens with M1 Macs) just copy the version I've included in the Resources folder of the Tapo plugin to the above folder.

This sounds more complicated than it is, but unfortunately it's necessary because the Crypto library has to be installed manually. Several other plugin developers have encountered the same issue, and there seems to be no other way around it.

I missed the fact that this might be required for Tuya. I'd already had to do this for Tapo, so didn't notice.

Posted on
Wed Mar 15, 2023 11:51 am
7rdr7 offline
Posts: 163
Joined: Aug 16, 2017
Location: Washington DC Metro

Re: Plugin won't load

Thanks! I followed your instructions and now get:

Disabling plugin "Tuya 2022.2.0"
Enabling plugin "Tuya 2022.2.0" using API v3.0
Starting plugin "Tuya 2022.2.0" (pid 3017)
Tuya Error Error in plugin execution InitializeMain:

File "plugin.py", line 15, in <module>
File "/Library/Application Support/Perceptive Automation/Indigo 2022.2/Plugins/Tuya.IndigoPlugin/Contents/Server Plugin/tuya_iot/__init__.py", line 2, in <module>
File "/Library/Application Support/Perceptive Automation/Indigo 2022.2/Plugins/Tuya.IndigoPlugin/Contents/Server Plugin/tuya_iot/device.py", line 11, in <module>
File "/Library/Application Support/Perceptive Automation/Indigo 2022.2/Plugins/Tuya.IndigoPlugin/Contents/Server Plugin/tuya_iot/openmq.py", line 13, in <module>
type: No module named 'Crypto.Cipher'

Is this where I need to install your Tapo plugin, then copy the Resources folder?

Posted on
Wed Mar 15, 2023 12:06 pm
racarter offline
User avatar
Posts: 479
Joined: Jun 18, 2016
Location: North Yorkshire, UK

Re: Plugin won't load

Actually, if you look in the Resources folder of the Tuya plugin you'll find the folder you need to copy over. :)

Posted on
Wed Mar 15, 2023 12:14 pm
7rdr7 offline
Posts: 163
Joined: Aug 16, 2017
Location: Washington DC Metro

Re: Plugin won't load

So I copy the Cypher folder from within the Tuya plugin Resource folder into the Crypto folder within site-packages? Sorry for being a bit of a neophyte.....

Posted on
Wed Mar 15, 2023 12:16 pm
racarter offline
User avatar
Posts: 479
Joined: Jun 18, 2016
Location: North Yorkshire, UK

Re: Plugin won't load

Not quite. REPLACE the Crypto folder in site packages with the one in my plugin.

Posted on
Wed Mar 15, 2023 12:20 pm
7rdr7 offline
Posts: 163
Joined: Aug 16, 2017
Location: Washington DC Metro

Re: Plugin won't load

That's it! Thanks!!

Posted on
Wed Mar 15, 2023 12:23 pm
racarter offline
User avatar
Posts: 479
Joined: Jun 18, 2016
Location: North Yorkshire, UK

Re: Plugin won't load

Great! I've posted a sticky for others to follow.. :)

Posted on
Tue Apr 09, 2024 4:23 pm
mgolden50 offline
User avatar
Posts: 261
Joined: Jan 29, 2007
Location: Chandler, AZ

Re: Plugin won't load

Hi,

I've been struggling to get the Taco plugin to load.

I have used pip3 to install Crypto to no avail.

I''m using a M1 Mac and after the install I look here ‭Macintosh HD/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages to find the Crypto folder but none exists.

I need to install the folder said to be available in the plug-in but can't locate it. Can someone provide me with more detail on where to find the Crypto folder in the plug-in?

Thanks

Who is online

Users browsing this forum: No registered users and 4 guests