Rpi MQTT Gateway on Docker
magpern last edited by magpern
Has anyone successfully installed a raspberry pi Mysensors MQTT Gateway in a docker container?
There is a docker file with a mysensors mqtt online, but it does not work.
And if it where, it is lacking personalization files and config files.
magpern last edited by magpern
If anyone is interested.. I got MySensors Ethernet Gateway working in a docker container on a RPi, with a radio connected physically to the Pi.
jrbenito last edited by
I am starting with MySensors to switch my mighthat gateway in near future. Could you share a bit more? I have some experience with docker.
magpern last edited by
@jrbenito I did jump the gun a little early. Sure, the gateway works, if you have externally connected devices, like an external MySensors gateway, but it does not work if you have the radio wired directly onto the RPi. It cannot fint the SPI.
Basically I did this:
A DockerFile (the .configure section needs to be modified to personal preferences)
FROM balenalib/raspberrypi3-debian RUN apt-get update && apt-get install -y --no-install-recommends git bash make g++ \ && cd /root \ && git clone https://github.com/mysensors/MySensors.git --branch development \ && cd /root/MySensors \ && mkdir -p /data \ && LDFLAGS="-static" ./configure --my-transport=rfm69 --my-rfm69-frequency=868 --my-is-rfm69hw --my-gateway=ethernet --my-port=5003 --my-leds-err-pin=29 --my-leds-rx-pin=31 --my-leds-tx-pin=33 --my-rfm69-encryption-enabled --my-signing-request-signatures --my-signing=software --my-config-file="/data/mysensors.conf" \ && make \ && cd /root \ && apt-get remove -y git make g++ && apt-get autoremove -y EXPOSE 5003 ENTRYPOINT ["/root/MySensors/bin/mysgw"]
And a Docker-compose.yml file (ports needs to be configured. I think 5003 is not needed, since 5003 would be used if the gateway was handling the radio wired to the pins of the pi. Run with serial instead)
version: '3' services: portainer: container_name: portainer image: portainer/portainer:arm restart: always volumes: - '/var/run/docker.sock:/var/run/docker.sock' expose: - 9000 ports: - 9000:9000 mysensors: build: context: . dockerfile: Dockerfile container_name: mysensor_eth restart: unless-stopped privileged: true devices: - /dev/ttyACM0:/dev/ttyACM0 ports: - 5003:5003 volumes: - /mnt/usb1/mysensorsd/data:/data:rw - /sys:/sys:rw - /tmp:/tmp
The config file needs to be on a exposed volume and have the eeprom file pointed to the same volume
File mysensors.conf and it needs to be modified for signing keys and path to log aqnd eeprom
i had everything on /mnt/usb1/mysensors and folders data created within that path. I set access to full RW for everyone
# Logging # Verbosity: debug,info,notice,warn,err verbose=debug # Enable logging to a file. log_file=1 # Log file path. log_filepath=/mnt/usb1/mysensors/data/mysgw.log # Enable logging to a named pipe. # Use this option to view your gateway's log messages # from the log_pipe_file defined bellow. # To do so, run the following command on another terminal: # cat "log_pipe_file" log_pipe=1 log_pipe_file=/tmp/mysgw.pipe # Enable logging to syslog. syslog=0 # EEPROM settings eeprom_file=/mnt/usb1/mysensors/data/mysensors.eeprom eeprom_size=1024 # Software signing settings # Note: The gateway must have been built with signing # support to use the options below. # # To generate a HMAC key run mysgw with: --gen-soft-hmac-key # copy the new key in the line below and uncomment it. soft_hmac_key=**************** # To generate a serial key run mysgw with: --gen-soft-serial-key # copy the new key in the line below and uncomment it. soft_serial_key=******************* # Encryption settings # Note: The gateway must have been built with encryption # support to use the options below. # # To generate a AES key run mysgw with: --gen-aes-key # copy the new key in the line below and uncomment it. aes_key=**************
I do not use the MySensors on a docker. I had som many problems with it, SPI beeing one, and the LEDs an other.
It literally takes 3 minutes to set it up and run nativelly on a Pi, and this gives you full access to everything.
I run everything else in a docker.