moroen / IKEA-Tradfri-plugin

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

Configure.py not working #61

Closed hs82h closed 5 years ago

hs82h commented 5 years ago

Hi, I'm on the following system: Ubuntu 16.04.5 Domoticz 4.9701 Tradfri 1.4.0015

I follow all these steps successfully until I'm at:

./configure.py 192.168.2.71 ###################

I allways get the same message: Error: Failed to generate ID/PSK-pair. Check that the IP and Master Key is correct.

But when I use the following command with the same IP and key, it is working:

coap-client -m post -u "Client_identity" -k "################" -e '{"9090":"DOMOTICZ"}' "coaps://192.168.2.71:5684/15011/9063"

Then I get: {"9091":"##################","9029":"1.4.0015"}

Any idea what I'm doing wrong?

DaSpie commented 5 years ago

Same here, looking forward to the solution. When running python3 tradfri.tac from console it shows

Fatal: No config.json found! Looking for: /home/pi/domoticz/plugins/IKEA-Tradfri/config.json

Logging shows: 2018-12-23 16:39:47.860 (Tradfri) Failed to connect to IKEA tradfri COAP-adapter! Status: 111 Description: Connection refused 2018-12-23 16:39:47.861 (Tradfri) Device has disconnected

moroen commented 5 years ago

What version of python is installed? You need 3.5 or higher: $ python --version

If python 3.5 or higher, please run configure.py with --debug and post the result here: $ ./configure.py --debug 192.x.x.x SUPER_SECRET_KEY

Regards, M

DaSpie commented 5 years ago

Thanks for your quick reply. I am quite a noob in linux, so i followed a manual of downloading, compiling, installing the latest version of python. Go no errors. But apparently it didn't work: Python 2.7.13.

Wil go to try it once again. Will update you when failed or succeeded

moroen commented 5 years ago

On most system, the 3.x.x versions are invoked with python3, so to check version, you need to use: $ python3 --version

Regards, M

DaSpie commented 5 years ago

Ah ok, it seems to be installed correct then:

pi@raspberrypi:~/domoticz/plugins/IKEA-Tradfri $ ./configure.py --debug 192.168.5.61 <MYBIGSECRET> Traceback (most recent call last): File "./configure.py", line 43, in <module> psk = api_factory.generate_psk(args.key) File "/usr/local/lib/python3.7/site-packages/pytradfri/api/libcoap_api.py", line 164, in generate_psk self._psk = self.request(Gateway().generate_psk(existing_psk_id)) File "/usr/local/lib/python3.7/site-packages/pytradfri/api/libcoap_api.py", line 96, in request return self._execute(api_commands, timeout=timeout) File "/usr/local/lib/python3.7/site-packages/pytradfri/api/libcoap_api.py", line 90, in _execute api_command.result = _process_output(return_value, parse_json) File "/usr/local/lib/python3.7/site-packages/pytradfri/api/libcoap_api.py", line 182, in _process_output 'Please compile coap-client without debug output. See ' pytradfri.error.RequestError: Please compile coap-client without debug output. See instructions at https://github.com/ggravlingen/pytradfri#installation

DaSpie commented 5 years ago

Just monkeying around, did this ~/domoticz/plugins/IKEA-Tradfri $ bash install-coap-client.sh and then ./configure.py 192.168.5.61 <MYBIGSECRET> and got "Config created". Going to restart now to see if it worked

EDIT: Now the lights are all showing up in devices. Thanks!

moroen commented 5 years ago

As you've found out, coap-client needs to be compiled using the correct config-parameters, glad it worked out! :)

hs82h commented 5 years ago

I got both python 2 and 3 installed:

$ python --version Python 2.7.12

$ python3 --version Python 3.5.2

DaSpie commented 5 years ago

Hansies, did you try the same as I did? So going in to the folder of Tradfri in plugins en then manually running the coap client installer and then the configure.py?

hs82h commented 5 years ago

I will try, brb!

hs82h commented 5 years ago

It's working now, thnx! I'll post my steps in a few hours for feedback.

hs82h commented 5 years ago

The following steps worked for me:

sudo apt install python3-pip pip3 install pytradfri pip3 install twisted sudo git clone https://github.com/moroen/IKEA-Tradfri-plugin.git domoticz/plugins/IKEA-Tradfri sudo apt install autoconf sudo apt install libtool sudo bash domoticz/plugins/IKEA-Tradfri/install-coap-client.sh sudo domoticz/plugins/IKEA-Tradfri/configure.py 192.168.2.71 ################

DaSpie commented 5 years ago

Good to hear it worked. Have fun!