I am trying to set up the deconz integration, but I am consistently getting the error:
Couldn’t retrieve API key
This is the case even though I am allowing in phoscon to authenticate apps.
I tried to get to the bottom of it and here are the steps I took:
Run a post command via Postman (REST-API Client add on) in chrome
Request to: http://192.xxx.xxx.xx:xxxx/api/
Parameters: {“device type”:“Testkey”,}
Result: "success: { “username”: "xxxxxx}
So this way I can retrieve an api key
Run cUrl command:
curl http://IP:PORT/api/ -X POST -d ‘{“devicetype”: “TestKey”}’
Here I am getting the following error:
[{“error”:{“address”:"/",“description”:“body contains invalid JSON”,“type”:2}}]
Link deconz integration in homeassistant
Manually configured host and port to ensure the correct settings are used.
Unlock Gatewasy with “authenticate app” button
Result: couldn’t get API key
Another note: Homeassitant is proposing even the correct IP address of the gateway.
I am really wondering why I am able to retrieve an Api key with a rest-api client add on, but Homeassistant is unable to retrieve one.
Another workaround I tried was to add
deconz:
host: IP
port: PORT
to my configuration.yaml
I would appreciate any hint or support I can get from the community.
Deconz is running in a separate container on a qnap NAS and my Homeassistant installation on a virtual machine.
The firewall isn’t blocking the connection.
I am not sure what happened, but all of a sudden I am able to get the integration back up and running.
It’s pretty weird as I didn’t really change anything on my setup.
First the deconz integration complained that tge gateway is not reachable and finally decided that the API key cannot be retrieved.
That’s when I deinstall Ed the integration and I was hoping a new set up integration will work fine again, but without any success.
Then I started looking closer into contacting the api with rest api add on which was working fine, but homeassitant still wasn’t able to retrieve the API key.
I am glad it’s back up running, but a bit disappointed I cannot really tell what the actual issue was.
In the end I completely removed the integration and relinked it to my deconz application. Luckily the phoscom app saved all my info/devices so it was seemless to just set it up again
I had the same issue with my deconz docker container in Truenas Scale.
I also solved it by adding the Deconz Integration in Home Assistant manually, this time using the server IP (192.168.0.x) rather than the Node IP which Home Assistant had automatically detected (perhaps because in the container settings I had checked the box “use Node IP”).