nidayand / node-red-contrib-tradfri

Work in progress - Node-RED node for IKEA TRÅDFRI devices
Other
24 stars 9 forks source link

not working when nodered is in docker #34

Closed andrasg closed 4 years ago

andrasg commented 4 years ago

I used to be able to control my lights with this plugin. I decided to move nodered to a docker container (official docker container). I am not able to get it work when nodered runs in docker.

Due to the volume mappings, the libcoap client location is different, but even after updating, I am not able to get this to work.

I have the correct IP address and preshared key entered, but cannot generate an app identity:

Registration did not work. Verify your settings and possibly try another identity. Note that an identity can only be used once and the response preshared key must be stored for usage with the identity

Also cannot refresh the list of devices:

Please verify your hub configuration settings or try again!

I see nothing wrong in the node-red log, and the control node sends a true when trying to control things.

What am I missing?

barisdemirdelen commented 4 years ago

I think this is because the docker image is based on alpine linux and has musl instead of glibc. So the precompiled coap-client binaries doesn't work. I tried to compile it myself per instructions, but doesn't seem to compile with musl

andrasg commented 4 years ago

Yes, indeed, this was the solution. I have solved my issue by building a custom nodered docker image that contains libcoap for alpine linux:

FROM nodered/node-red

USER root

RUN apk add libcoap

USER node-red

ENTRYPOINT ["npm", "start", "--", "--userDir", "/data"]

This way the coap-client will alredy be installed in the image at /usr/bin/coap-client.