Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Announcements
  3. 💬 Building a Raspberry Pi Gateway

💬 Building a Raspberry Pi Gateway

Scheduled Pinned Locked Moved Announcements
1.1k Posts 173 Posters 1.0m Views 131 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • AndurilA Anduril

    I use pimatic which does not have a native compatibility to ethernet or mqtt. Thats why my question came up on how to configure it to do this...

    Building a Raspberry Pi Gateway:

    If you are running a controller on the Raspberry Pi that doesn't support communication with the gateway through ethernet, you can use a virtual serial port:
    ./configure --my-gateway=serial --my-serial-is-pty --my-serial-pty=/dev/ttyMySensorsGateway

    mfalkviddM Offline
    mfalkviddM Offline
    mfalkvidd
    Mod
    wrote on last edited by
    #315

    @Anduril you might be able to use nodered or socat to convert the tcp connection to a serial port.
    https://linux.die.net/man/1/socat
    https://nodered.org/

    1 Reply Last reply
    0
    • AndurilA Offline
      AndurilA Offline
      Anduril
      wrote on last edited by
      #316

      that's what I tried in the past and am using now (socat), but it does not reconnect and has some other drawbacks. Reading of an officially supported way sounded interesting

      1 Reply Last reply
      0
      • lakshmcL lakshmc

        I using RPi2 and NRF24 for this. I followed the instructions, to clone the repo, and then added config
        ./configure --my-gateway=mqtt --my-controller-ip-address=127.0.0.1 --my-mqtt-publish-topic-prefix=mysensors-out --my-mqtt-subscribe-topic-prefix=mysensors-in --my-mqtt-client-id=mygateway1 --my-transport=nrf24

        make

        when i run with sudo ./bin/mysgw -d, it is failing to connect to MQTT. Can you please help?

        mysgw: Starting gateway...
        mysgw: Protocol version - 2.1.0
        mysgw: MCO:BGN:INIT GW,CP=RNNG---,VER=2.1.0
        mysgw: TSF:LRT:OK
        mysgw: TSM:INIT
        mysgw: TSF:WUR:MS=0
        mysgw: TSM:INIT:TSP OK
        mysgw: TSM:INIT:GW MODE
        mysgw: TSM:READY:ID=0,PAR=0,DIS=0
        mysgw: MCO:REG:NOT NEEDED
        mysgw: MCO:BGN:STP
        mysgw: MCO:BGN:INIT OK,TSP=1
        mysgw: Attempting MQTT connection...
        mysgw: connect: Connection refused
        mysgw: failed to connect
        mysgw: Attempting MQTT connection...
        mysgw: connect: Connection refused
        mysgw: failed to connect
        mysgw: Attempting MQTT connection...
        mysgw: connect: Connection refused
        mysgw: failed to connect
        mysgw: Attempting MQTT connection...
        mysgw: connect: Connection refused
        mysgw: failed to connect

        P Offline
        P Offline
        pete1450
        wrote on last edited by pete1450
        #317

        @lakshmc Make sure you don't have the daemon running already

        If not, I'm getting the same problem on the 2.1.1 that was just released. 2.1.0 was working "fine"(besides my suspecting a bug that doesn't let any inclusion happen, hence I tried the new version). Time to go back to the serial gateway right into the vera.

        M 1 Reply Last reply
        0
        • P pete1450

          @lakshmc Make sure you don't have the daemon running already

          If not, I'm getting the same problem on the 2.1.1 that was just released. 2.1.0 was working "fine"(besides my suspecting a bug that doesn't let any inclusion happen, hence I tried the new version). Time to go back to the serial gateway right into the vera.

          M Offline
          M Offline
          marceloaqno
          Code Contributor
          wrote on last edited by
          #318

          @pete1450 @lakshmc
          Make sure you are not using an old version of mosquitto (or any other broker you're using):

          $ mosquitto -h
          mosquitto version 1.4.10 (build date 2016-09-20 11:02:07-0600)
          

          It's working fine with the 2.1.1 release:

          [alarm@pi3 mysgw]$ sudo ./bin/mysgw -d
          mysgw: Starting gateway...
          mysgw: Protocol version - 2.1.1
          mysgw: MCO:BGN:INIT GW,CP=RNNG---,VER=2.1.1
          mysgw: TSF:LRT:OK
          mysgw: TSM:INIT
          mysgw: TSF:WUR:MS=0
          mysgw: TSM:INIT:TSP OK
          mysgw: TSM:INIT:GW MODE
          mysgw: TSM:READY:ID=0,PAR=0,DIS=0
          mysgw: MCO:REG:NOT NEEDED
          mysgw: MCO:BGN:STP
          mysgw: MCO:BGN:INIT OK,TSP=1
          mysgw: Attempting MQTT connection...
          mysgw: connected to 127.0.0.1
          mysgw: MQTT connected
          mysgw: Sending message on topic: mysensors-out/0/255/0/0/18
          mysgw: TSF:MSG:READ,2-2-0,s=1,c=1,t=17,pt=7,l=5,sg=0:108.12
          mysgw: TSF:MSG:ACK REQ
          mysgw: TSF:MSG:SEND,0-0-2-2,s=1,c=1,t=17,pt=7,l=5,sg=0,ft=0,st=OK:108.12
          mysgw: Sending message on topic: mysensors-out/2/1/1/0/17
          mysgw: TSF:MSG:READ,2-2-0,s=2,c=1,t=17,pt=7,l=5,sg=0:48.31
          mysgw: TSF:MSG:ACK REQ
          mysgw: TSF:MSG:SEND,0-0-2-2,s=2,c=1,t=17,pt=7,l=5,sg=0,ft=0,st=OK:48.31
          mysgw: Sending message on topic: mysensors-out/2/2/1/0/17
          mysgw: TSF:MSG:READ,2-2-0,s=3,c=1,t=17,pt=7,l=5,sg=0:362.86
          mysgw: TSF:MSG:ACK REQ
          mysgw: TSF:MSG:SEND,0-0-2-2,s=3,c=1,t=17,pt=7,l=5,sg=0,ft=0,st=OK:362.86
          mysgw: Sending message on topic: mysensors-out/2/3/1/0/17
          
          P 1 Reply Last reply
          0
          • M marceloaqno

            @pete1450 @lakshmc
            Make sure you are not using an old version of mosquitto (or any other broker you're using):

            $ mosquitto -h
            mosquitto version 1.4.10 (build date 2016-09-20 11:02:07-0600)
            

            It's working fine with the 2.1.1 release:

            [alarm@pi3 mysgw]$ sudo ./bin/mysgw -d
            mysgw: Starting gateway...
            mysgw: Protocol version - 2.1.1
            mysgw: MCO:BGN:INIT GW,CP=RNNG---,VER=2.1.1
            mysgw: TSF:LRT:OK
            mysgw: TSM:INIT
            mysgw: TSF:WUR:MS=0
            mysgw: TSM:INIT:TSP OK
            mysgw: TSM:INIT:GW MODE
            mysgw: TSM:READY:ID=0,PAR=0,DIS=0
            mysgw: MCO:REG:NOT NEEDED
            mysgw: MCO:BGN:STP
            mysgw: MCO:BGN:INIT OK,TSP=1
            mysgw: Attempting MQTT connection...
            mysgw: connected to 127.0.0.1
            mysgw: MQTT connected
            mysgw: Sending message on topic: mysensors-out/0/255/0/0/18
            mysgw: TSF:MSG:READ,2-2-0,s=1,c=1,t=17,pt=7,l=5,sg=0:108.12
            mysgw: TSF:MSG:ACK REQ
            mysgw: TSF:MSG:SEND,0-0-2-2,s=1,c=1,t=17,pt=7,l=5,sg=0,ft=0,st=OK:108.12
            mysgw: Sending message on topic: mysensors-out/2/1/1/0/17
            mysgw: TSF:MSG:READ,2-2-0,s=2,c=1,t=17,pt=7,l=5,sg=0:48.31
            mysgw: TSF:MSG:ACK REQ
            mysgw: TSF:MSG:SEND,0-0-2-2,s=2,c=1,t=17,pt=7,l=5,sg=0,ft=0,st=OK:48.31
            mysgw: Sending message on topic: mysensors-out/2/2/1/0/17
            mysgw: TSF:MSG:READ,2-2-0,s=3,c=1,t=17,pt=7,l=5,sg=0:362.86
            mysgw: TSF:MSG:ACK REQ
            mysgw: TSF:MSG:SEND,0-0-2-2,s=3,c=1,t=17,pt=7,l=5,sg=0,ft=0,st=OK:362.86
            mysgw: Sending message on topic: mysensors-out/2/3/1/0/17
            
            P Offline
            P Offline
            pete1450
            wrote on last edited by
            #319

            @marceloaqno I should have specified, I'm getting the connection errors with the ethernet gateway.

            M 1 Reply Last reply
            0
            • P pete1450

              @marceloaqno I should have specified, I'm getting the connection errors with the ethernet gateway.

              M Offline
              M Offline
              marceloaqno
              Code Contributor
              wrote on last edited by
              #320

              @pete1450 Could you send the debug log with the connection errors?

              P 1 Reply Last reply
              0
              • lakshmcL Offline
                lakshmcL Offline
                lakshmc
                wrote on last edited by
                #321

                @marceloaqno After installing broker and gateway fresh, seems to be working. Thanks for your help.

                1 Reply Last reply
                0
                • M marceloaqno

                  @pete1450 Could you send the debug log with the connection errors?

                  P Offline
                  P Offline
                  pete1450
                  wrote on last edited by
                  #322

                  @marceloaqno
                  Ran as root and made sure I didn't have mysgw already running:

                  rm -r MySensors/
                  git clone https://github.com/mysensors/MySensors.git --branch master
                  cd MySensors/
                  ./configure --my-controller-ip-address=192.168.1.136 --my-port=5003 --my-rf24-irq-pin=15
                  make
                  
                  
                  root@raspberrypi:~/downloads/MySensors# ./bin/mysgw -d
                  mysgw: Starting gateway...
                  mysgw: Protocol version - 2.1.1
                  mysgw: MCO:BGN:INIT GW,CP=RNNG--Q,VER=2.1.1
                  mysgw: TSF:LRT:OK
                  mysgw: TSM:INIT
                  mysgw: TSF:WUR:MS=0
                  mysgw: TSM:INIT:TSP OK
                  mysgw: TSM:INIT:GW MODE
                  mysgw: TSM:READY:ID=0,PAR=0,DIS=0
                  mysgw: MCO:REG:NOT NEEDED
                  mysgw: connect: Connection refused
                  mysgw: failed to connect
                  mysgw: Eth: connect
                  
                  M 1 Reply Last reply
                  0
                  • B Offline
                    B Offline
                    b0rmann
                    wrote on last edited by
                    #323

                    every few days mysgw randomly dies :(

                    Jan 19 06:40:01 pi mysgw[17960]: TSF:MSG:READ,5-5-0,s=255,c=3,t=21,pt=1,l=1,sg=0:0
                    Jan 19 06:40:01 pi mysgw[17960]: Sending message on topic: mysensors/out/1/5/255/3/0/21
                    Jan 19 06:40:01 pi mysgw[17960]: TSF:MSG:READ,0-5-255,s=255,c=3,t=20,pt=0,l=0,sg=0:
                    Jan 19 06:40:01 pi mysgw[17960]: TSF:MSG:BC
                    Jan 19 06:40:01 pi systemd[1]: mysgw.service: main process exited, code=killed, status=11/SEGV
                    Jan 19 06:40:01 pi systemd[1]: Unit mysgw.service entered failed state.
                    
                    
                    M 1 Reply Last reply
                    0
                    • P pete1450

                      @marceloaqno
                      Ran as root and made sure I didn't have mysgw already running:

                      rm -r MySensors/
                      git clone https://github.com/mysensors/MySensors.git --branch master
                      cd MySensors/
                      ./configure --my-controller-ip-address=192.168.1.136 --my-port=5003 --my-rf24-irq-pin=15
                      make
                      
                      
                      root@raspberrypi:~/downloads/MySensors# ./bin/mysgw -d
                      mysgw: Starting gateway...
                      mysgw: Protocol version - 2.1.1
                      mysgw: MCO:BGN:INIT GW,CP=RNNG--Q,VER=2.1.1
                      mysgw: TSF:LRT:OK
                      mysgw: TSM:INIT
                      mysgw: TSF:WUR:MS=0
                      mysgw: TSM:INIT:TSP OK
                      mysgw: TSM:INIT:GW MODE
                      mysgw: TSM:READY:ID=0,PAR=0,DIS=0
                      mysgw: MCO:REG:NOT NEEDED
                      mysgw: connect: Connection refused
                      mysgw: failed to connect
                      mysgw: Eth: connect
                      
                      M Offline
                      M Offline
                      marceloaqno
                      Code Contributor
                      wrote on last edited by
                      #324

                      @pete1450 If you use the --my-controller-ip-address= option, the gateway will act as a client and attempt to conect to the supplied ip and port. If you want the gateway to open port 5003, omit this option.

                      P 1 Reply Last reply
                      0
                      • AndurilA Offline
                        AndurilA Offline
                        Anduril
                        wrote on last edited by
                        #325

                        @marceloaqno what is the correct configure option to make this gatway connect to an ethernet gateway and let a serial-only-controller connect to it. I suppose to use the pty option, but didn't got this working. As said above, socat and nodered are no option.

                        M 1 Reply Last reply
                        0
                        • M marceloaqno

                          @pete1450 If you use the --my-controller-ip-address= option, the gateway will act as a client and attempt to conect to the supplied ip and port. If you want the gateway to open port 5003, omit this option.

                          P Offline
                          P Offline
                          pete1450
                          wrote on last edited by pete1450
                          #326

                          @marceloaqno Well that fixed the connection issue. Now I'm just back to square one where pressing start doesn't do anything. Why do I not need to specify my controllers ip? That is the ip for my veralite. Whats the use case for that option.

                          M 1 Reply Last reply
                          0
                          • B b0rmann

                            every few days mysgw randomly dies :(

                            Jan 19 06:40:01 pi mysgw[17960]: TSF:MSG:READ,5-5-0,s=255,c=3,t=21,pt=1,l=1,sg=0:0
                            Jan 19 06:40:01 pi mysgw[17960]: Sending message on topic: mysensors/out/1/5/255/3/0/21
                            Jan 19 06:40:01 pi mysgw[17960]: TSF:MSG:READ,0-5-255,s=255,c=3,t=20,pt=0,l=0,sg=0:
                            Jan 19 06:40:01 pi mysgw[17960]: TSF:MSG:BC
                            Jan 19 06:40:01 pi systemd[1]: mysgw.service: main process exited, code=killed, status=11/SEGV
                            Jan 19 06:40:01 pi systemd[1]: Unit mysgw.service entered failed state.
                            
                            
                            M Offline
                            M Offline
                            marceloaqno
                            Code Contributor
                            wrote on last edited by
                            #327

                            @b0rmann Could you provide the following information?

                            • Your RPi model and which linux distribution you are using.
                            • gcc version
                            • The version and options you used to build the gateway (./configure --option)
                            • The number of nodes on your network that sends messages to the gateway.
                            • The broker you are using for MQTT and its version
                            1 Reply Last reply
                            1
                            • AndurilA Anduril

                              @marceloaqno what is the correct configure option to make this gatway connect to an ethernet gateway and let a serial-only-controller connect to it. I suppose to use the pty option, but didn't got this working. As said above, socat and nodered are no option.

                              M Offline
                              M Offline
                              marceloaqno
                              Code Contributor
                              wrote on last edited by
                              #328

                              @Anduril Sorry, the gateway does not support what you're trying to do.

                              1 Reply Last reply
                              0
                              • P pete1450

                                @marceloaqno Well that fixed the connection issue. Now I'm just back to square one where pressing start doesn't do anything. Why do I not need to specify my controllers ip? That is the ip for my veralite. Whats the use case for that option.

                                M Offline
                                M Offline
                                marceloaqno
                                Code Contributor
                                wrote on last edited by
                                #329

                                @pete1450
                                I can't help you with this, I've never used the Vera controller. You need to search in the Vera settings where you set this option. If Vera supports being a server and opening a port for the gateway to connect, then you use the --my-controller-ip-address option.

                                1 Reply Last reply
                                1
                                • M Offline
                                  M Offline
                                  Michael Curtis
                                  wrote on last edited by
                                  #330

                                  Does anyone know if the Raspberry implementation have a UserPassword option for ./configure MQTT

                                  M 1 Reply Last reply
                                  0
                                  • M Michael Curtis

                                    Does anyone know if the Raspberry implementation have a UserPassword option for ./configure MQTT

                                    M Offline
                                    M Offline
                                    Michael Curtis
                                    wrote on last edited by
                                    #331

                                    @Michael-Curtis Nevermind, I fixed it.... you ned to add :

                                    --my-mqtt-password=<PASS>   MQTT password
                                    --my-mqtt-client-id=<ID>    MQTT client id.
                                    

                                    Under "cat"

                                    And for the actual options under "opt do"

                                    --my-mqtt-user=*)
                                        CPPFLAGS="-DMY_MQTT_USER=\\\"${optarg}\\\" $CPPFLAGS"
                                        ;;
                                    --my-mqtt-password=*)
                                        CPPFLAGS="-DMY_MQTT_PASSWORD=\\\"${optarg}\\\" $CPPFLAGS"
                                        ;;
                                    

                                    then just add those option flags to the ./configure and run make

                                    1 Reply Last reply
                                    0
                                    • Roberto Mo CaR Offline
                                      Roberto Mo CaR Offline
                                      Roberto Mo Ca
                                      wrote on last edited by
                                      #332

                                      what means "5VReg -> 3.3V" in raspberry? can connect directly to 3.3V or if requied connecto to 5V with regulator to obtain 3.3v?

                                      M 1 Reply Last reply
                                      0
                                      • M Offline
                                        M Offline
                                        macvictor
                                        wrote on last edited by
                                        #333

                                        Hi :) Does anybody know how to use MY_SIGNING_NODE_WHITELISTING in gateway raspbery pi? Where I must create/edit white list with my nodes?

                                        M 1 Reply Last reply
                                        0
                                        • OliverDogO Offline
                                          OliverDogO Offline
                                          OliverDog
                                          wrote on last edited by
                                          #334

                                          first sorry about the basics question but I think many people have the same questions and can't find the answers:
                                          After connecting the radio (including IRQ on 15pin) and the info LEDs to the GPIO, how to config it?

                                          1. Do I need to configure all the info on the same command, or can I send the command "./configure --" many times for different configs?
                                          2. Do I need to configure it as a MQTT gateway?
                                          3. Where did the 127.0.0.1 IP come from?
                                          4. Does MQTT use internet connection?
                                          5. Why do you talk about Serial Gateway here, once we have a specific type for it? this type is about using GPIO only, isn't it? That is confusing!!!
                                          M 1 Reply Last reply
                                          0

                                          Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                                          Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                                          With your input, this post could be even better 💗

                                          Register Login
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          11

                                          Online

                                          12.1k

                                          Users

                                          11.2k

                                          Topics

                                          113.4k

                                          Posts


                                          Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • MySensors
                                          • OpenHardware.io
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular