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 422.9k 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.
  • SebexS Sebex

    I'm getting a bad file descriptor error, any advice? Seems only 1 instance to be running.

    pi@raspberrypi:~ $ sudo mysgw
    Mar 19 20:14:04 INFO  Starting gateway...
    Mar 19 20:14:04 INFO  Protocol version - 2.3.2
    Mar 19 20:14:04 DEBUG MCO:BGN:INIT GW,CP=RNNGL---,FQ=NA,REL=255,VER=2.3.2
    Mar 19 20:14:04 DEBUG TSF:LRT:OK
    Mar 19 20:14:04 DEBUG TSM:INIT
    Mar 19 20:14:04 DEBUG TSF:WUR:MS=0
    Mar 19 20:14:04 DEBUG TSM:INIT:TSP OK
    Mar 19 20:14:04 DEBUG TSM:INIT:GW MODE
    Mar 19 20:14:04 DEBUG TSM:READY:ID=0,PAR=0,DIS=0
    Mar 19 20:14:04 DEBUG MCO:REG:NOT NEEDED
    Mar 19 20:14:04 ERROR bind: Address already in use
    Mar 19 20:14:04 ERROR Failed to bind!
    Mar 19 20:14:04 DEBUG MCO:BGN:STP
    Mar 19 20:14:04 DEBUG MCO:BGN:INIT OK,TSP=1
    Mar 19 20:14:04 ERROR accept: Bad file descriptor
    Mar 19 20:14:04 ERROR accept: Bad file descriptor
    Mar 19 20:14:04 ERROR accept: Bad file descriptor
    Mar 19 20:14:04 ERROR accept: Bad file descriptor
    Mar 19 20:14:04 ERROR accept: Bad file descriptor
    Mar 19 20:14:04 ERROR accept: Bad file descriptor
    Mar 19 20:14:04 ERROR accept: Bad file descriptor
    Mar 19 20:14:04 ERROR accept: Bad file descriptor
    Mar 19 20:14:04 ERROR accept: Bad file descriptor
    Mar 19 20:14:04 ERROR accept: Bad file descriptor
    Mar 19 20:14:04 DEBUG TSM:READY:NWD REQ
    Mar 19 20:14:04 DEBUG ?TSF:MSG:SEND,0-0-255-255,s=255,c=3,t=20,pt=0,l=0,sg=0,ft=0,st=OK:
    Mar 19 20:14:04 ERROR accept: Bad file descriptor
    Mar 19 20:14:04 ERROR accept: Bad file descriptor
    Mar 19 20:14:04 ERROR accept: Bad file descriptor
    Mar 19 20:14:04 ERROR accept: Bad file descriptor
    Mar 19 20:14:04 ERROR accept: Bad file descriptor
    
    mfalkviddM Offline
    mfalkviddM Offline
    mfalkvidd
    Mod
    wrote on last edited by
    #1040

    @Sebex don't run multiple instances that try to listen to the same tcp port.

    SebexS 1 Reply Last reply
    0
    • mfalkviddM mfalkvidd

      @Sebex don't run multiple instances that try to listen to the same tcp port.

      SebexS Offline
      SebexS Offline
      Sebex
      wrote on last edited by
      #1041

      @mfalkvidd thanks, I was wrongly under the impression that sudo mysgw would show the logs but it creates a second instance. Thanks for helping :smile:!

      1 Reply Last reply
      1
      • OldSurferDudeO Offline
        OldSurferDudeO Offline
        OldSurferDude
        wrote on last edited by
        #1042

        I have an Arduino Mesh network (see https://tmrh20.github.io/RF24Mesh/) (master and 4 nodes)
        networkChannel 120, networkDataRate RF24_1MBPS, nodes 0-4

        Now I want to have my master be an RPi because it can talk to the real world.

        It looks like I have the RPi wired up and software loaded (per https://www.mysensors.org/build/raspberry). Now I need to know how to talk to my Arduino's.

        Now how do I talk to my Arduino's?

        o- general description of what you are trying to do
        Raspberry Pi controller with serial gateway with nrf24l01+ to connect to Arduino's
        o- the exact configure command you used
        git clone https://github.com/mysensors/MySensors.git --branch master
        cd MySensors
        ./configure --my-transport=rf24 --my-gateway=serial --my-serial-is-pty --my-serial-port=/dev/ttyMySensorsGateway
        make
        sudo ./bin/mysgw
        [reboot RPi]
        cd MySensors
        sudo make install
        sudo systemctl enable mysgw.service
        sudo systemctl start mysgw.service
        ls -als /dev/ttyMySensorsGateway [yeilds: 0 lrwxrwxrwx 1 root root 10 Apr 9 19:22 /dev/ttyMySensorsGateway -> /dev/pts/1]

        o- the output from the test
        Apr 09 18:47:32 INFO Config file /etc/mysensors.conf does not exist, creating new file.
        Apr 09 18:47:32 INFO Starting gateway...
        Apr 09 18:47:32 INFO Protocol version - 2.3.2
        Apr 09 18:47:32 DEBUG Serial port /dev/ttyMySensorsGateway (115200 baud) created
        Apr 09 18:47:32 INFO EEPROM file /etc/mysensors.eeprom does not exist, creating new file.
        Apr 09 18:47:32 DEBUG MCO:BGN:INIT GW,CP=RNNGL---,FQ=NA,REL=255,VER=2.3.2
        Apr 09 18:47:32 DEBUG TSF:LRT:OK
        Apr 09 18:47:32 DEBUG TSM:INIT
        Apr 09 18:47:32 DEBUG TSF:WUR:MS=0
        Apr 09 18:47:32 DEBUG TSM:INIT:TSP OK
        Apr 09 18:47:32 DEBUG TSM:INIT:GW MODE
        Apr 09 18:47:32 DEBUG TSM:READY:ID=0,PAR=0,DIS=0
        Apr 09 18:47:32 DEBUG MCO:REG:NOT NEEDED
        Apr 09 18:47:32 DEBUG MCO:BGN:STP
        Apr 09 18:47:32 DEBUG MCO:BGN:INIT OK,TSP=1
        Apr 09 18:47:32 DEBUG TSM:READY:NWD REQ
        Apr 09 18:47:32 DEBUG ?TSF:MSG:SEND,0-0-255-255,s=255,c=3,t=20,pt=0,l=0,sg=0,ft=0,st=OK:
        [did not return to command prompt]
        o- the settings you used in your controller
        n/a

        mfalkviddM 1 Reply Last reply
        0
        • OldSurferDudeO OldSurferDude

          I have an Arduino Mesh network (see https://tmrh20.github.io/RF24Mesh/) (master and 4 nodes)
          networkChannel 120, networkDataRate RF24_1MBPS, nodes 0-4

          Now I want to have my master be an RPi because it can talk to the real world.

          It looks like I have the RPi wired up and software loaded (per https://www.mysensors.org/build/raspberry). Now I need to know how to talk to my Arduino's.

          Now how do I talk to my Arduino's?

          o- general description of what you are trying to do
          Raspberry Pi controller with serial gateway with nrf24l01+ to connect to Arduino's
          o- the exact configure command you used
          git clone https://github.com/mysensors/MySensors.git --branch master
          cd MySensors
          ./configure --my-transport=rf24 --my-gateway=serial --my-serial-is-pty --my-serial-port=/dev/ttyMySensorsGateway
          make
          sudo ./bin/mysgw
          [reboot RPi]
          cd MySensors
          sudo make install
          sudo systemctl enable mysgw.service
          sudo systemctl start mysgw.service
          ls -als /dev/ttyMySensorsGateway [yeilds: 0 lrwxrwxrwx 1 root root 10 Apr 9 19:22 /dev/ttyMySensorsGateway -> /dev/pts/1]

          o- the output from the test
          Apr 09 18:47:32 INFO Config file /etc/mysensors.conf does not exist, creating new file.
          Apr 09 18:47:32 INFO Starting gateway...
          Apr 09 18:47:32 INFO Protocol version - 2.3.2
          Apr 09 18:47:32 DEBUG Serial port /dev/ttyMySensorsGateway (115200 baud) created
          Apr 09 18:47:32 INFO EEPROM file /etc/mysensors.eeprom does not exist, creating new file.
          Apr 09 18:47:32 DEBUG MCO:BGN:INIT GW,CP=RNNGL---,FQ=NA,REL=255,VER=2.3.2
          Apr 09 18:47:32 DEBUG TSF:LRT:OK
          Apr 09 18:47:32 DEBUG TSM:INIT
          Apr 09 18:47:32 DEBUG TSF:WUR:MS=0
          Apr 09 18:47:32 DEBUG TSM:INIT:TSP OK
          Apr 09 18:47:32 DEBUG TSM:INIT:GW MODE
          Apr 09 18:47:32 DEBUG TSM:READY:ID=0,PAR=0,DIS=0
          Apr 09 18:47:32 DEBUG MCO:REG:NOT NEEDED
          Apr 09 18:47:32 DEBUG MCO:BGN:STP
          Apr 09 18:47:32 DEBUG MCO:BGN:INIT OK,TSP=1
          Apr 09 18:47:32 DEBUG TSM:READY:NWD REQ
          Apr 09 18:47:32 DEBUG ?TSF:MSG:SEND,0-0-255-255,s=255,c=3,t=20,pt=0,l=0,sg=0,ft=0,st=OK:
          [did not return to command prompt]
          o- the settings you used in your controller
          n/a

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

          @OldSurferDude if you want your nodes to use MySensors, you'll need to upload MySensors sketches to them.

          1 Reply Last reply
          0
          • Nicolás PotierN Offline
            Nicolás PotierN Offline
            Nicolás Potier
            wrote on last edited by
            #1044

            hi i am trying to install an MQTT type gateway on a raspberry pi 3,
             
            I configured it as in the example:

            ./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

            Then I do make and it does not generate errors.

            and when i run

            sudo mysgw

            returns the following result, I do not understand what it can be or what it means.

            Apr 10 15:12:21 DEBUG connected to 127.0.0.1
            Apr 10 15:12:22 DEBUG! GWT: RMQ: FAIL
            Apr 10 15:12:22 DEBUG GWT: RMQ: CONNECTING ...
            Apr 10 15:12:22 DEBUG connected to 127.0.0.1
            Apr 10 15:12:23 DEBUG! GWT: RMQ: FAIL
            Apr 10 15:12:23 DEBUG GWT: RMQ: CONNECTING ...
            Apr 10 15:12:23 DEBUG connected to 127.0.0.1

            I appreciate your time to explain this to me please, I am just starting to use Mysensors and it is incredible everything that can be generated.

            Also I want to connect it to Mycontrroller.org to manage my devices from my sensor network with only 1 Gateway, I already downloaded it in my RPI3 and it runs fine, but when I connect or create the mqtt type gateway, it asks me for the broker host and I do not know what to put there, I thought of 127.0.0.1, but after that it tells me that the State is down and an error message with the IP of 127.0.0.1 and I do not know then that I need this. Thanks again for your time to explain this to you.

            1 Reply Last reply
            0
            • MasMatM Offline
              MasMatM Offline
              MasMat
              wrote on last edited by MasMat
              #1045

              You're not being able to connect to your MQTT broker (Mosquitto or Moqutte as was in mycontroller.org). I havent used mycontroller so I cant help with that.

              I use Mosquitto on the same Rpi (so just install mosquitto and mosquitto-clients). You should secure it but test first without credentials to get going. Remember to create credentials in mosquitto AND reconfig your gw

              Nicolás PotierN 1 Reply Last reply
              0
              • MasMatM MasMat

                You're not being able to connect to your MQTT broker (Mosquitto or Moqutte as was in mycontroller.org). I havent used mycontroller so I cant help with that.

                I use Mosquitto on the same Rpi (so just install mosquitto and mosquitto-clients). You should secure it but test first without credentials to get going. Remember to create credentials in mosquitto AND reconfig your gw

                Nicolás PotierN Offline
                Nicolás PotierN Offline
                Nicolás Potier
                wrote on last edited by
                #1046

                @MasMat I already managed to configure my gateway it already works with Mycontroller.org, I like the interface of this, but I was thinking if the nodes of my network, which are esp8266 can be configured an operating system like FreeRTOS, TinyOS or ApacHE MyNewt can be configured in my osp and handle all Mysensors processes?
                There is a possibility or it is impossible

                MasMatM 1 Reply Last reply
                0
                • Nicolás PotierN Nicolás Potier

                  @MasMat I already managed to configure my gateway it already works with Mycontroller.org, I like the interface of this, but I was thinking if the nodes of my network, which are esp8266 can be configured an operating system like FreeRTOS, TinyOS or ApacHE MyNewt can be configured in my osp and handle all Mysensors processes?
                  There is a possibility or it is impossible

                  MasMatM Offline
                  MasMatM Offline
                  MasMat
                  wrote on last edited by
                  #1047

                  @Nicolás-Potier that's way way over my understanding and fluency with Mysensors. And way off topic, I think.

                  1 Reply Last reply
                  0
                  • R Offline
                    R Offline
                    rafal9318
                    wrote on last edited by
                    #1048

                    Hi all,

                    I want to launch gateway on RaspberryPi with a RS485 network.
                    I downloaded the software (MySensors Library v2.4.0-alpha).
                    And i made coniguration:
                    ./configure --my-transport=rs485 --my-rs485-serial-port=/dev/ttyUSB0 --my-rs485-baudrate=9600 --my-gateway=serial --my-serial-is-pty --my-serial-port=/dev/ttyUSB20 -my-serial-baudrate=115200 -my-serial-groupname=tty

                    I have USB-RS485 (it uses FT232RL) converter connected to the /dev/ttyUSB0.
                    On the other side i have Arduino uno with UART-RS485 (MAX485) converter, and a MotionSensorRS485 example on it.

                    After i made the program (make), and type sudo ./bin/mysgw, i've got this:
                    8e71edb2-f77b-46c9-8a6b-929527fda8a8-image.png

                    I'm able to add the hardware in domoticz (serial gateway ttyYSB20, 115200), but it doesn't see nodes.
                    bbb6c72d-87cf-4e50-95f0-a0501174bfe3-image.png

                    Please help.

                    mfalkviddM 1 Reply Last reply
                    0
                    • R rafal9318

                      Hi all,

                      I want to launch gateway on RaspberryPi with a RS485 network.
                      I downloaded the software (MySensors Library v2.4.0-alpha).
                      And i made coniguration:
                      ./configure --my-transport=rs485 --my-rs485-serial-port=/dev/ttyUSB0 --my-rs485-baudrate=9600 --my-gateway=serial --my-serial-is-pty --my-serial-port=/dev/ttyUSB20 -my-serial-baudrate=115200 -my-serial-groupname=tty

                      I have USB-RS485 (it uses FT232RL) converter connected to the /dev/ttyUSB0.
                      On the other side i have Arduino uno with UART-RS485 (MAX485) converter, and a MotionSensorRS485 example on it.

                      After i made the program (make), and type sudo ./bin/mysgw, i've got this:
                      8e71edb2-f77b-46c9-8a6b-929527fda8a8-image.png

                      I'm able to add the hardware in domoticz (serial gateway ttyYSB20, 115200), but it doesn't see nodes.
                      bbb6c72d-87cf-4e50-95f0-a0501174bfe3-image.png

                      Please help.

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

                      @rafal9318 please don't post the same question in multiple threads. Posting in multiple threads means the discussion is split. Important information might be available in one thread, but not the other, which means people have to ask you for that information multiple times. It is a waste of the community members' (including you) time.

                      If anyone can help @rafal9318 please respond in https://forum.mysensors.org/topic/11128/raspberrypi-4-as-a-gateway-controller

                      R 1 Reply Last reply
                      0
                      • mfalkviddM mfalkvidd

                        @rafal9318 please don't post the same question in multiple threads. Posting in multiple threads means the discussion is split. Important information might be available in one thread, but not the other, which means people have to ask you for that information multiple times. It is a waste of the community members' (including you) time.

                        If anyone can help @rafal9318 please respond in https://forum.mysensors.org/topic/11128/raspberrypi-4-as-a-gateway-controller

                        R Offline
                        R Offline
                        rafal9318
                        wrote on last edited by
                        #1050

                        @mfalkvidd Okey, sorry.

                        1 Reply Last reply
                        1
                        • E Offline
                          E Offline
                          ej3-martin
                          wrote on last edited by
                          #1051

                          I’m sorry if this is a newbie question. I have managed to create a controller using MyController on a Raspberry Pi. I have connected a NRF24l01 and created a gateway, and my controller picks up that I have a gateway present, so I assume my wiring is correct.
                          I have started to wire up the status LEDs, and this is where I am confused. I am used to using LEDs on PI, but connecting between he GPIO pin and ground, where the GPIO provides the voltage. The diagram above suggests that they should be permanently connected to the voltage and the GPIO provides the ground connection. Is this correct? And if it is, is it possible to test the LEDs? Thanks in advance.

                          MasMatM 1 Reply Last reply
                          0
                          • E ej3-martin

                            I’m sorry if this is a newbie question. I have managed to create a controller using MyController on a Raspberry Pi. I have connected a NRF24l01 and created a gateway, and my controller picks up that I have a gateway present, so I assume my wiring is correct.
                            I have started to wire up the status LEDs, and this is where I am confused. I am used to using LEDs on PI, but connecting between he GPIO pin and ground, where the GPIO provides the voltage. The diagram above suggests that they should be permanently connected to the voltage and the GPIO provides the ground connection. Is this correct? And if it is, is it possible to test the LEDs? Thanks in advance.

                            MasMatM Offline
                            MasMatM Offline
                            MasMat
                            wrote on last edited by
                            #1052

                            @ej3-martin My LEDs come on when the Rpi boots (is that what you mean by testing?). Also you can invert the LEDs (on but blink off) if you want. I figured the wiring makes for better power delivery rather than feeding voltage from the GPIO

                            1 Reply Last reply
                            1
                            • E Offline
                              E Offline
                              ej3-martin
                              wrote on last edited by
                              #1053

                              @MasMat I was purely wanting to find a way of testing them, to check my wiring, if they do come on during boot then this is a great way to test. It would also possibly be useful (for those of us less experienced) to have a script to run to check the wiring is correct. I think it much more useful to have them off, and blink on, and it was the wiring that confused me. I will have to see if I can investigate this further.

                              mfalkviddM 1 Reply Last reply
                              0
                              • E ej3-martin

                                @MasMat I was purely wanting to find a way of testing them, to check my wiring, if they do come on during boot then this is a great way to test. It would also possibly be useful (for those of us less experienced) to have a script to run to check the wiring is correct. I think it much more useful to have them off, and blink on, and it was the wiring that confused me. I will have to see if I can investigate this further.

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

                                Since the pins are configurable before compilation, creating a script that uses the same settings as the compiled code would be pretty hard.

                                The easiest way with existing code is probably to add --my-leds-blinking-inverse to your configure command and start the gateway, as suggested by @MasMat

                                1 Reply Last reply
                                0
                                • F Offline
                                  F Offline
                                  Fear na Boinne
                                  wrote on last edited by
                                  #1055

                                  Just trying to figure out whether there is a switch or config file option for the channel, or whether the only option to change the channel is truly to recompile?!...

                                  Just ran the Poor Man's scanner and channels 1-98 a a garbage mess, so I need to go >> 100, but am surprised the only option there seems to be a recompile?...

                                  mfalkviddM 1 Reply Last reply
                                  0
                                  • F Fear na Boinne

                                    Just trying to figure out whether there is a switch or config file option for the channel, or whether the only option to change the channel is truly to recompile?!...

                                    Just ran the Poor Man's scanner and channels 1-98 a a garbage mess, so I need to go >> 100, but am surprised the only option there seems to be a recompile?...

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

                                    @Fear-na-Boinne yes that is correct

                                    1 Reply Last reply
                                    0
                                    • F Offline
                                      F Offline
                                      Fear na Boinne
                                      wrote on last edited by
                                      #1057

                                      Sorry for the lack of response, life's been crazy... Thanks for the reply, I have since recompiled, but need to make some add'l changes to the sensor sketches, so I want to do all of that at once before I deploy to the new channel... ;)

                                      mfalkviddM 1 Reply Last reply
                                      1
                                      • F Fear na Boinne

                                        Sorry for the lack of response, life's been crazy... Thanks for the reply, I have since recompiled, but need to make some add'l changes to the sensor sketches, so I want to do all of that at once before I deploy to the new channel... ;)

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

                                        @Fear-na-Boinne if you want to be able to switch your rpi gateway between the old and the new channel while testing, you could try my patch which allows configurable service name

                                        https://github.com/mysensors/MySensors/pull/1421

                                        Or just skip running make install so you don’t overwrite the old gateway

                                        F 1 Reply Last reply
                                        0
                                        • mfalkviddM mfalkvidd

                                          @Fear-na-Boinne if you want to be able to switch your rpi gateway between the old and the new channel while testing, you could try my patch which allows configurable service name

                                          https://github.com/mysensors/MySensors/pull/1421

                                          Or just skip running make install so you don’t overwrite the old gateway

                                          F Offline
                                          F Offline
                                          Fear na Boinne
                                          wrote on last edited by
                                          #1059

                                          @mfalkvidd Just a quick update...

                                          Been extremely busy, so not a lot of time, but when I run the recompiled version (channel 109) gateway and use the existing - known good - sensor sketches with the channel 109 macro declaration included, it doesn't connect at all.
                                          When I run the "old" version of the gateway and the same sensor sketches with channel 109 commented out, it just-worksâ„¢...

                                          More testing and such due I guess! :(

                                          1 Reply Last reply
                                          1
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          10

                                          Online

                                          11.7k

                                          Users

                                          11.2k

                                          Topics

                                          113.0k

                                          Posts


                                          Copyright 2019 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