Open HellStorm666 opened 4 years ago
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.
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
The plugin can't find coapcmd. The plugin looks for coapcmd in a bin subdirectory in the IKEA-Tradfri plugin folder.
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 ??
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!
I have the exact same issue: py3coap package installed within the docker image according to pip3, but the plugin won't find it.
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.