Request Timeout on initial Contact
maksp-glitch opened this issue · comments
Where are you using pytradfri (eg stand-alone, Home Assistant etc)
stand-alone
Version of pytradfri
synchronous latest (freshly installed on raspberry pi)
Expected behaviour
initial contact after entering security code
Actual behaviour
no connection to gateway due to request timeout
Error output:
pi@raspberrypi:~ $ python3 -i -m pytradfri IP
DEBUG:pytradfri.util:JSON file not found: tradfri_standalone_psk.conf
Please provide the 'Security Code' on the back of your Tradfri gateway: SECURITY_CODE
DEBUG:pytradfri.util:JSON file not found: tradfri_standalone_psk.conf
DEBUG:pytradfri.api.libcoap_api:Executing IP post ['15011', '9063']: {'9090': 'XXXXXXXXXXXXXXXXXXXXXXXXX'}
Traceback (most recent call last):
File "/usr/lib/python3.7/runpy.py", line 193, in _run_module_as_main
"main", mod_spec)
File "/usr/lib/python3.7/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/home/pi/.local/lib/python3.7/site-packages/pytradfri/main.py", line 48, in
psk = api_factory.generate_psk(args.key)
File "/home/pi/.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 "/home/pi/.local/lib/python3.7/site-packages/pytradfri/api/libcoap_api.py", line 96, in request
return self._execute(api_commands, timeout=timeout)
File "/home/pi/.local/lib/python3.7/site-packages/pytradfri/api/libcoap_api.py", line 85, in _execute
raise RequestTimeout() from None
pytradfri.error.RequestTimeout
The security code and IP address are correct. Tried this several times. Also i reinstalled libcoap through the given script.
I also reset the gateway and reconnected it.
Thanks in advance for the help!
wrong code... really sorry
I had the same problem. I
and l
are easily confused - I found this out by scanning the QR code on the back after reading your issue, which contains the string $SERIAL_NR,$SECURITY_CODE
. Thanks for creating this issue, it really helped! Maybe pytradfri
could be modified to contain a note about this when handling timeouts? It wasn't immediately clear to me that a timeout can be caused by wrong credentials.