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 423.0k 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.
  • mfalkviddM mfalkvidd

    @rolo6442u where did you find my-rfm69-networkid? I don't think such an option has ever existed. If you found it somewhere we probably need to update that documentation.

    Follow the instructions at https://www.mysensors.org/build/raspberry#advanced to set defines.

    R Offline
    R Offline
    Rolo6442u
    wrote on last edited by
    #1012

    @mfalkvidd
    I did not found it, I kind of made it up, following the syntax of other options.
    Looks like there is no way of changing the ID at this moment for the PI gateway.

    mfalkviddM 1 Reply Last reply
    0
    • R Rolo6442u

      @mfalkvidd
      I did not found it, I kind of made it up, following the syntax of other options.
      Looks like there is no way of changing the ID at this moment for the PI gateway.

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

      @rolo6442u ok. Well, making things up will usually not add them to the code ;-)

      There is a way. Two actually. Set the define in one of the two ways described on the link I provided.

      R 1 Reply Last reply
      0
      • mfalkviddM mfalkvidd

        @rolo6442u ok. Well, making things up will usually not add them to the code ;-)

        There is a way. Two actually. Set the define in one of the two ways described on the link I provided.

        R Offline
        R Offline
        Rolo6442u
        wrote on last edited by
        #1014

        @mfalkvidd
        Thanks, will take a look at that.

        1 Reply Last reply
        0
        • M Offline
          M Offline
          mafe
          wrote on last edited by
          #1015

          Is it also possible to read a sensor directly at the Raspberry Pi MQTT Gateway? I only want to send the status of a GPIO via MQTT. Is there an example code for this combination?

          1 Reply Last reply
          0
          • alowhumA Offline
            alowhumA Offline
            alowhum
            Plugin Developer
            wrote on last edited by alowhum
            #1016

            Might be nice to know it compilation still seems to works fine on Raspbian Buster on a Raspberry Pi 4.

            // Update: unlike on the Pi 3 I now had to activate SPI. Might be good to make that more prominent in the explanation now.

            mfalkviddM 1 Reply Last reply
            0
            • alowhumA alowhum

              Might be nice to know it compilation still seems to works fine on Raspbian Buster on a Raspberry Pi 4.

              // Update: unlike on the Pi 3 I now had to activate SPI. Might be good to make that more prominent in the explanation now.

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

              @alowhum to my knowledge, activating SPI has always been required, unless the user has already activated SPI by some other means.

              Do you have a suggestion on how to make it more prominent that what it is now? Preferably without contributing too much to the pileup of notices that scare users - everything is super-important to at least 1 person.

              alowhumA 1 Reply Last reply
              0
              • mfalkviddM mfalkvidd

                @alowhum to my knowledge, activating SPI has always been required, unless the user has already activated SPI by some other means.

                Do you have a suggestion on how to make it more prominent that what it is now? Preferably without contributing too much to the pileup of notices that scare users - everything is super-important to at least 1 person.

                alowhumA Offline
                alowhumA Offline
                alowhum
                Plugin Developer
                wrote on last edited by alowhum
                #1018

                @mfalkvidd I don't know, perhaps mention it as something that has to be done upfront instead of something that might need to be done if there is an error?

                I'm not having any luck actually getting the radio to work. I now noticed this warning during compilation:

                g++ -MT build/drivers/Linux/GPIO.o -MMD -MP -DMY_RADIO_RF24 -DMY_GATEWAY_LINUX -DMY_GATEWAY_MQTT_CLIENT -DMY_DEBUG -DLINUX_SPI_SPIDEV -DMY_MQTT_CLIENT_ID=\"mygateway1\" -DMY_MQTT_SUBSCRIBE_TOPIC_PREFIX=\"mysensors-in\" -DMY_MQTT_PUBLISH_TOPIC_PREFIX=\"mysensors-out\" -DMY_CONTROLLER_IP_ADDRESS=127,0,0,1  -Ofast -g -Wall -Wextra  -I. -I./core -I./drivers/Linux -c drivers/Linux/GPIO.cpp -o build/drivers/Linux/GPIO.o
                drivers/Linux/GPIO.cpp: In constructor ‘GPIOClass::GPIOClass()’:
                drivers/Linux/GPIO.cpp:53:18: warning: ‘%s’ directive writing up to 255 bytes into a region of size 48 [-Wformat-overflow=]
                    sprintf(file, "/sys/class/gpio/%s/base", de->d_name);
                                  ^~~~~~~~~~~~~~~~~~~~~~~~~
                drivers/Linux/GPIO.cpp:53:11: note: ‘sprintf’ output between 22 and 277 bytes into a destination of size 64
                    sprintf(file, "/sys/class/gpio/%s/base", de->d_name);
                    ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                drivers/Linux/GPIO.cpp:62:18: warning: ‘%s’ directive writing up to 255 bytes into a region of size 48 [-Wformat-overflow=]
                    sprintf(file, "/sys/class/gpio/%s/ngpio", de->d_name);
                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~
                drivers/Linux/GPIO.cpp:62:11: note: ‘sprintf’ output between 23 and 278 bytes into a destination of size 64
                    sprintf(file, "/sys/class/gpio/%s/ngpio", de->d_name);
                    ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                
                1 Reply Last reply
                1
                • alowhumA Offline
                  alowhumA Offline
                  alowhum
                  Plugin Developer
                  wrote on last edited by alowhum
                  #1019

                  Could this be an issue?

                  ./configure without any additional parameters gives:

                  [SECTION] Detecting target machine.
                    [OK] machine detected: SoC=unknown, Type=unknown, CPU=armv7l.
                  

                  The rest looks fine:

                  [SECTION] Checking GPIO Sysfs.
                    [OK] /sys/class/gpio/export found.
                  [SECTION] Detecting SPI driver.
                    [OK] SPI driver detected:SPIDEV.
                  [SECTION] Gateway configuration.
                    [OK] Type: ethernet.
                    [OK] Transport: rf24.
                    [OK] Signing: Disabled.
                    [OK] Encryption: Disabled.
                    [OK] CPPFLAGS: -DMY_RADIO_RF24 -DMY_GATEWAY_LINUX -DMY_DEBUG -DLINUX_SPI_SPIDEV 
                  [SECTION] Detecting init system.
                    [OK] Init system detected: systemd.
                  [SECTION] Saving configuration.
                    [OK] Saved.
                  [SECTION] Cleaning previous builds.
                    [OK] Finished.
                  

                  Same thing happens with the dev version

                  1 Reply Last reply
                  0
                  • mfalkviddM Offline
                    mfalkviddM Offline
                    mfalkvidd
                    Mod
                    wrote on last edited by mfalkvidd
                    #1020

                    Yes, if the configure script cannot detect which hardware to use, compilation failure could very well be the result.

                    1 Reply Last reply
                    1
                    • S Offline
                      S Offline
                      swedchef
                      wrote on last edited by
                      #1021

                      Hi All

                      I'm just venturing into this world of building my own sensors - but perhaps i am a tad late? Two months since last update.. Typically me - showing up to the party when everybody else has left.

                      My main issue is, i am running the Raspberry Pi 4 - and when trying to build (i've tried both the development and master builds) i get from 4 (master build) to A BUNCH (development) of errors. First of all, the autodetect of SoC does not work for me either (just like @alowhum, and with the same warnings), and when using --help the actual SoC is not listed either, so should i just assume it does not work for Raspberry Pi 4?

                      Is there any chance the 4 will be supported soon?

                      Just a note - i can actually complete the configure and then make - but unfortunately i just get a TSP error when trying to fire up the radio.

                      Hope i can get this working as it was the main reason for upgrading my RaspberryPi version 1 to a version 4 :man-facepalming:

                      Thanks in advance for any and all help!

                      mfalkviddM 1 Reply Last reply
                      0
                      • S swedchef

                        Hi All

                        I'm just venturing into this world of building my own sensors - but perhaps i am a tad late? Two months since last update.. Typically me - showing up to the party when everybody else has left.

                        My main issue is, i am running the Raspberry Pi 4 - and when trying to build (i've tried both the development and master builds) i get from 4 (master build) to A BUNCH (development) of errors. First of all, the autodetect of SoC does not work for me either (just like @alowhum, and with the same warnings), and when using --help the actual SoC is not listed either, so should i just assume it does not work for Raspberry Pi 4?

                        Is there any chance the 4 will be supported soon?

                        Just a note - i can actually complete the configure and then make - but unfortunately i just get a TSP error when trying to fire up the radio.

                        Hope i can get this working as it was the main reason for upgrading my RaspberryPi version 1 to a version 4 :man-facepalming:

                        Thanks in advance for any and all help!

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

                        Thanks for sharing your experience @swedchef

                        From the problems reported by users (you included), it seems like the rpi4 is quite different fom the earlier rpis. To add support, the following ingredients are needed in one person

                        • person needs to have sufficient knowledge and skills to figure out how to support the rpi4
                        • person needs to have sufficient time to do the work
                        • person needs to have a rpi4
                        • person needs to be sufficiently interested/motivated to do the work

                        It seems like, so far, we haven't found this person (or this person hasn't found us).

                        phildeferP 1 Reply Last reply
                        1
                        • mfalkviddM mfalkvidd

                          Thanks for sharing your experience @swedchef

                          From the problems reported by users (you included), it seems like the rpi4 is quite different fom the earlier rpis. To add support, the following ingredients are needed in one person

                          • person needs to have sufficient knowledge and skills to figure out how to support the rpi4
                          • person needs to have sufficient time to do the work
                          • person needs to have a rpi4
                          • person needs to be sufficiently interested/motivated to do the work

                          It seems like, so far, we haven't found this person (or this person hasn't found us).

                          phildeferP Offline
                          phildeferP Offline
                          phildefer
                          wrote on last edited by
                          #1023

                          Re: 💬 Building a Raspberry Pi Gateway

                          Hi all,

                          i compile with success the gateway in Raspberry PI 4 (with some code modification)

                          this is not perfect.. but it works.

                          if someone wants to try, i upload the gateway compiled with this options :

                          --my-transport=rf24 --my-gateway=ethernet --my-port=5003
                          

                          https://gofile.io/?c=fRxeF7

                          AnticimexA mfalkviddM 2 Replies Last reply
                          0
                          • phildeferP phildefer

                            Re: 💬 Building a Raspberry Pi Gateway

                            Hi all,

                            i compile with success the gateway in Raspberry PI 4 (with some code modification)

                            this is not perfect.. but it works.

                            if someone wants to try, i upload the gateway compiled with this options :

                            --my-transport=rf24 --my-gateway=ethernet --my-port=5003
                            

                            https://gofile.io/?c=fRxeF7

                            AnticimexA Offline
                            AnticimexA Offline
                            Anticimex
                            Contest Winner
                            wrote on last edited by
                            #1024

                            @phildefer could you please share what you changed? The security concerned might not be comfortable running a binary with unspecified changes that manages their home automation setup. Especially not a project supposed to be open source.

                            Do you feel secure today? No? Start requiring some signatures and feel better tomorrow ;)

                            1 Reply Last reply
                            0
                            • phildeferP phildefer

                              Re: 💬 Building a Raspberry Pi Gateway

                              Hi all,

                              i compile with success the gateway in Raspberry PI 4 (with some code modification)

                              this is not perfect.. but it works.

                              if someone wants to try, i upload the gateway compiled with this options :

                              --my-transport=rf24 --my-gateway=ethernet --my-port=5003
                              

                              https://gofile.io/?c=fRxeF7

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

                              @phildefer would you mind sharing the code modifications that were needed?

                              phildeferP 1 Reply Last reply
                              0
                              • mfalkviddM mfalkvidd

                                @phildefer would you mind sharing the code modifications that were needed?

                                phildeferP Offline
                                phildeferP Offline
                                phildefer
                                wrote on last edited by
                                #1026

                                @mfalkvidd @Anticimex : yes i sharing the code perhaps this week end. I need to find time to make a PR to GITHUB
                                As I said, my code may not be as clean as you'd like, but it works.

                                1 Reply Last reply
                                2
                                • P Offline
                                  P Offline
                                  patrikr76
                                  wrote on last edited by patrikr76
                                  #1027

                                  Hey all,

                                  I got the same problem as @swedchef and saw the warnings @alowhum mentioned.
                                  Simply upping the buffer that is declared in GPIO.cpp solved the warnings and made it compile without issue but the radio still won't work.
                                  Maybe it has to do with the soc not being detected, as mentioned, and that the pin positions on the new soc are different from previous ones.

                                  @phildefer, weekend has come and gone buddy. Patience is a virtue some do not have. :)

                                  Edit: So looking a little more through the files today i see that configure looks for the soc type in /proc/cpuinfo and funnily my raspi 4 reports a BCM2835

                                  mfalkviddM 1 Reply Last reply
                                  0
                                  • P patrikr76

                                    Hey all,

                                    I got the same problem as @swedchef and saw the warnings @alowhum mentioned.
                                    Simply upping the buffer that is declared in GPIO.cpp solved the warnings and made it compile without issue but the radio still won't work.
                                    Maybe it has to do with the soc not being detected, as mentioned, and that the pin positions on the new soc are different from previous ones.

                                    @phildefer, weekend has come and gone buddy. Patience is a virtue some do not have. :)

                                    Edit: So looking a little more through the files today i see that configure looks for the soc type in /proc/cpuinfo and funnily my raspi 4 reports a BCM2835

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

                                    @patrikr76 I beleive @phildefer pushed the code 4 days ago. See https://github.com/mysensors/MySensors/pull/1353

                                    Something has seriously mangled whitespace in the modified code, but apart from that it looks good to me, but I am not that familiar with the rpi code and I have not tested it myself.

                                    P K 2 Replies Last reply
                                    0
                                    • mfalkviddM mfalkvidd

                                      @patrikr76 I beleive @phildefer pushed the code 4 days ago. See https://github.com/mysensors/MySensors/pull/1353

                                      Something has seriously mangled whitespace in the modified code, but apart from that it looks good to me, but I am not that familiar with the rpi code and I have not tested it myself.

                                      P Offline
                                      P Offline
                                      patrikr76
                                      wrote on last edited by patrikr76
                                      #1029

                                      @mfalkvidd said in 💬 Building a Raspberry Pi Gateway:

                                      @patrikr76 I beleive @phildefer pushed the code 4 days ago. See https://github.com/mysensors/MySensors/pull/1353

                                      You are correct.
                                      @phildefer, thank you.
                                      There were a couple of minor warnings about indentations and the buffer size i mentioned earlier fixed by upping the declared buffer in GPIO.cpp. Not sure if that is a good fix or not, the warning goes away though.
                                      A few other warnings looks like this:

                                      In member function ‘char* MyMessage::getString(char*) const’,
                                          inlined from ‘bool transportSendWrite(uint8_t, MyMessage&)’ at ./core/MyTransport.cpp:987:2,
                                          inlined from ‘bool transportRouteMessage(MyMessage&)’ at ./core/MyTransport.cpp:560:40,
                                          inlined from ‘void stUplinkTransition()’ at ./core/MyTransport.cpp:252:29:
                                      ./core/MyMessage.cpp:284:17: warning: ‘char* strncpy(char*, const char*, size_t)’ output may be truncated copying between 0 and 25 bytes from a string of length 25 [-Wstringop-truncation]
                                          (void)strncpy(buffer, this->data, this->getLength());
                                                ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                      

                                      Not sure how to fix those.

                                      Edit: Forgot to mention, it seems to be working though.

                                      1 Reply Last reply
                                      0
                                      • franz-unixF Offline
                                        franz-unixF Offline
                                        franz-unix
                                        wrote on last edited by
                                        #1030

                                        Thanks guys for the effort to port MySensors for the Pi 4.

                                        I'm very interested, but my coding skills are not sufficient to help in the development. Maybe I can do some debug when my Pi4 will arrive

                                        MySensors for the Pi4 is a must-have!😊

                                        1 Reply Last reply
                                        0
                                        • mfalkviddM mfalkvidd

                                          @patrikr76 I beleive @phildefer pushed the code 4 days ago. See https://github.com/mysensors/MySensors/pull/1353

                                          Something has seriously mangled whitespace in the modified code, but apart from that it looks good to me, but I am not that familiar with the rpi code and I have not tested it myself.

                                          K Offline
                                          K Offline
                                          kiesel
                                          wrote on last edited by
                                          #1031

                                          @mfalkvidd @phildefer

                                          I can confirm that the code compiles and runs on my rasbperry pi 4 model b. I am using a rfm69 radio and that seems to be working too. I couldn't test it yet though since I haven't wired any rfm69 nodes up yet.

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


                                          13

                                          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