How to send data from zwavejs2mqtt inside a docker container to a Mosquitto server? #1244
-
I'm now running zwavejs2mqtt on a Raspberry Pi, in a docker container, and it's working just fine!
But how can I get this data in and out of the container, to a Mosquitto server for example? I have the Mosquitto server running on my Raspberry Pi on port 1883, and if I try to open up the port 1883 in the docker container using -p 1883:1883, I receive an error that the port is already in use? What am I'm doing wrong?
Error:
PS. I'm using a Raspberry Pi 3 Model B Rev 1.2 and my goal is (to put it simple) to show a webpage when my Z-Wave button is pressed once, and then show another webpage when my Z-Wave button is pressed once more! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hummm that's not the way to do it. With This example uses a docker compose file to map containers network to local net: https://tewarid.github.io/2019/05/24/docker-compose-to-run-node-red-and-mosquitto.html#:~:text=Mosquitto%20can%20be%20accessed%20at%20port%201883%20on%20the%20host%20network. |
Beta Was this translation helpful? Give feedback.
Hummm that's not the way to do it. With
-p 1883:1883
you are mapping z2m container port to your local port 1883 but that is actually used by mosquitto. You have two alternatives, the first one is to map the container network to your local network the second one is to use a container also for mosquitto so you can setup the communication between z2m and mosquitto containers (using a docker compose file).This example uses a docker compose file to map containers network to local net: https://tewarid.github.io/2019/05/24/docker-compose-to-run-node-red-and-mosquitto.html#:~:text=Mosquitto%20can%20be%20accessed%20at%20port%201883%20on%20the%20host%20network.