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

Error: (IKEA-Tradfri) failed to load 'plugin.py' #116

Open
HellStorm666 opened this issue Sep 29, 2020 · 6 comments
Open

Error: (IKEA-Tradfri) failed to load 'plugin.py' #116

HellStorm666 opened this issue Sep 29, 2020 · 6 comments

Comments

@HellStorm666
Copy link

HellStorm666 commented Sep 29, 2020

I run Domoticz on Docker on Ubuntu.

Have the /config folder mapped to /home/domoticz/config so the data is stored.
did the git pull from ubuntu to the correct mapped folder.

I have the IKEA-Tradfri device now under hardware.
However, I have this error in the logs:
2020-09-29 14:03:15.032 Error: (IKEA-Tradfri) failed to load 'plugin.py', Python Path used was '/config/plugins/IKEA-Tradfri/:/usr/lib/python37.zip:/usr/lib/python3.7:/usr/lib/python3.7/lib-dynload:/usr/lib/python3.7/site-packages'.
2020-09-29 14:03:15.032 Error: (Ikea Tradfri) Module Import failed, exception: 'ApiNotFoundError'
2020-09-29 14:03:15.032 Error: (Ikea Tradfri) Error Line details not available.

And I think this is correct, because the plugin.py is not in /config/plugins/IKEA-Tradfri, but in ~/domoticz/config/plugins/IKEA-Tradfri.

How do I change this Python Path?

Side note:
running python3 plugin.py list in the /domoticz/config/plugins/IKEA-Tradfri folder does give me info about the devices (ID, name state and level).
In my case the LED driver and the remote.

@moroen
Copy link
Owner

moroen commented Sep 29, 2020

The most common cause of this, is that the python environment that domoticz uses, can't find py3coap or coapcmd. In a docker file, you might have more success using coapcmd than py3coap.

@HellStorm666
Copy link
Author

I tried doing that, but that gave me the following error.
(still getting the device info with the python3 plugin.py list command)

2020-09-29 22:20:59.266 Error: (IKEA-Tradfri) 'onStart' failed 'FileNotFoundError'.
2020-09-29 22:20:59.266 Error: (IKEA-Tradfri) ----> Line 770 in '/config/plugins/IKEA-Tradfri/plugin.py', function onStart
2020-09-29 22:20:59.266 Error: (IKEA-Tradfri) ----> Line 593 in '/config/plugins/IKEA-Tradfri/plugin.py', function onStart
2020-09-29 22:20:59.266 Error: (IKEA-Tradfri) ----> Line 399 in '/config/plugins/IKEA-Tradfri/plugin.py', function registerDevices
2020-09-29 22:20:59.266 Error: (IKEA-Tradfri) ----> Line 273 in '/config/plugins/IKEA-Tradfri/plugin.py', function indexRegisteredDevices
2020-09-29 22:20:59.266 Error: (IKEA-Tradfri) ----> Line 354 in '/config/plugins/IKEA-Tradfri/tradfricoap/device.py', function get_devices
2020-09-29 22:20:59.266 Error: (IKEA-Tradfri) ----> Line 36 in '/config/plugins/IKEA-Tradfri/tradfricoap/request.py', function request
2020-09-29 22:20:59.266 Error: (IKEA-Tradfri) ----> Line 60 in '/config/plugins/IKEA-Tradfri/tradfricoap/coapcmd_api.py', function request
2020-09-29 22:20:59.266 Error: (IKEA-Tradfri) ----> Line 488 in '/usr/lib/python3.7/subprocess.py', function run
2020-09-29 22:20:59.266 Error: (IKEA-Tradfri) ----> Line 828 in '/usr/lib/python3.7/subprocess.py', function init
2020-09-29 22:20:59.266 Error: (IKEA-Tradfri) ----> Line 1551 in '/usr/lib/python3.7/subprocess.py', function _execute_child

@moroen
Copy link
Owner

moroen commented Sep 30, 2020

The plugin can't find coapcmd. The plugin looks for coapcmd in a bin subdirectory in the IKEA-Tradfri plugin folder.

@HellStorm666
Copy link
Author

The plugin can't find coapcmd. The plugin looks for coapcmd in a bin subdirectory in the IKEA-Tradfri plugin folder.

I have a coapcmd in ~/domoticz/config/plugins/IKEA-Tradfri/bin
-rwxrw-r-- for if that matters.

Isn't the whole problem that the scripts look at /config/plugins and it is at /domoticz/config/plugins ??

@moroen
Copy link
Owner

moroen commented Sep 30, 2020

Quite probably a path issue. The plugin looks for coapcmd relative to it's own location, but using absolute paths.

You could try to add the following code at line 73, just before set_coapcmd(...

print("{}/bin/coapcmd".format(os.path.dirname(os.path.realpath(__file__)))

This will print out the absolute path for coapcmd that the plugin uses!

@mekhall
Copy link

mekhall commented Oct 16, 2020

I have the exact same issue: py3coap package installed within the docker image according to pip3, but the plugin won't find it.

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

3 participants