moroen / IKEA-Tradfri-plugin

A Python plugin for Domoticz to controll IKEA Gateway
68 stars 23 forks source link

plugin Failed to load. #125

Closed neotwix closed 3 years ago

neotwix commented 3 years ago

I have a functional and unmodified Raspbian and Domoticz 2020.2 for a while. I had a previous (I forgot version) and functional Ikea plugin I made an update with the plugin manager to the last version 0.10.1 and now domoticz could'nt arrive to load the plugin anymore.

2020-11-25 15:57:29.281 Status: PluginSystem: Started, Python version '3.7.3'. ... 2020-11-25 15:50:30.446 Error: (IKEA Tradfri) Failed to initialize tradfri module. 2020-11-25 15:50:30.446 Error: (IKEA Tradfri) Unable to find tradfricoap 2020-11-25 15:50:40.161 Error: (IKEA Tradfri) 'onHeartbeat' failed 'NameError':'name 'close_connection' is not defined'. 2020-11-25 15:50:40.161 Error: (IKEA Tradfri) ----> Line 779 in '/home/domo/domoticz/plugins/IKEA-Tradfri/plugin.py', function onHeartbeat

I clean up every thing make the install of the plugin from scratch again update py. And same Error Domoticz failed to load the plugins.

BUT if from an ssh session i make:

domoticz/plugins/IKEA-Tradfri# python3 plugin.py list the list and functional and return my list of IKEA devices.

My pip3 pycoap and tradfricoap could be found in /usr/local/lib/python3.7/dist-packages/.

I display the sys path:

2020-11-25 16:14:55.460 Error: (IKEA Tradfri) /home/domo/domoticz/plugins/IKEA-Tradfri - /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 - /usr/local/lib/python3.7/dist-packages/py3coap-0.9.1-py3.7-linux-armv7l.egg - /root/.local/lib/python3.7/site-packages - /usr/local/lib/python3.7/dist-packages/

The path seams ok but I didn't have any idea why the plugin couldn't be loaded.

Regards

moroen commented 3 years ago

Blame it on bad quality control...

Try updating to the latest version of the plugin, just pushed to the repo:

IKEA Tradfri Plugin: 0.10.2 Tradfricoap: 0.0.13 Py3coap: 0.9.1

mixermek commented 3 years ago

I've still got that error. This on an freshly installed WM Ubuntu 20 with latest domoticz

IKEA Tradfri Plugin: 0.10.2 Tradfricoap: 0.0.13 Py3coap: 0.9.1

2020-11-26 08:34:51.905 (Trådfri) Debug logging mask set to: NONE 2020-11-26 08:34:51.883 Status: (Trådfri) Stop directive received. 2020-11-26 08:34:51.883 Status: (Trådfri) Exiting work loop. 2020-11-26 08:34:51.983 Status: (Trådfri) Stopping threads. 2020-11-26 08:34:51.983 Status: (Trådfri) Stopped. 2020-11-26 08:34:51.983 Status: (Trådfri) Started. 2020-11-26 08:34:52.136 Status: (Trådfri) Entering work loop. 2020-11-26 08:34:52.136 Status: (Trådfri) Initialized version 0.10.2, author 'moroen' 2020-11-26 08:34:52.137 Error: (Trådfri) Failed to initialize tradfri module. 2020-11-26 08:34:52.137 Error: (Trådfri) Unable to find tradfricoap 2020-11-26 08:35:02.176 Error: (Trådfri) 'onHeartbeat' failed 'NameError':'name 'close_connection' is not defined'. 2020-11-26 08:35:02.176 Error: (Trådfri) ----> Line 779 in '/home/pi/domoticz/plugins/IKEA-Tradfri/plugin.py' 2020-11-26 08:35:02.176 Error: (Trådfri) ----> Line 736 in '/home/pi/domoticz/plugins/IKEA-Tradfri/plugin.py'

the command: python3 plugin.py config api py3coap doesn't complain

and the command python3 plugin.py list produces a tidy list with expected result.

Any more information You need?

moroen commented 3 years ago

It might have something to do with the import path? Are you sure that domoticz is using the same python interpreter as command line?

You might try to use tradfricoap as a local install in the plugin directory

$ pip3 uninstall tradfricoap
$ cd plugins/IKEA-Tradfri
$ git clone https://github.com/moroen/tradfricoap.git
mixermek commented 3 years ago

That did the trick! Thanks!

neotwix commented 3 years ago

git pull and it's work now. thanks