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. Controllers
  3. Home Assistant
  4. Raspberry Pi gateway + hass.io + MQTT + MySensors

Raspberry Pi gateway + hass.io + MQTT + MySensors

Scheduled Pinned Locked Moved Home Assistant
38 Posts 4 Posters 764 Views 5 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 Offline
    SebexS Offline
    Sebex
    wrote on last edited by
    #1

    So I successfully installed hass.io and enabled MQTT on my raspberry Pi 3+ (64) but now I am struggling to get a gateway running on the raspberry while I have read on multiple places that it should be possible, acting as a gateway and controller. Overall I am a bit lost in which step is next. Should I enable MySensor in hass.io or ensure that the Raspberry Pi becomes a gateway first? Or is this exactly the same thing.

    I need some guidance in getting to the next step, any advise is welcome.

    For context:
    My first step is to create a sensor that measures humidity and temp. connected to an arduino which sends the data via NRF24L01 to my Raspberry.

    1 Reply Last reply
    0
    • monteM Offline
      monteM Offline
      monte
      wrote on last edited by monte
      #2

      To use RPi as a gateway you need install Home Assistant on a Raspbian install and compile a Mysensors binary on it. Hass.io won't work with this scenario. I suggest you follow the docker install guide.

      SebexS 1 Reply Last reply
      0
      • SebexS Offline
        SebexS Offline
        Sebex
        wrote on last edited by
        #3

        Thanks @monte, I'm gonna try that first

        1 Reply Last reply
        0
        • monteM monte

          To use RPi as a gateway you need install Home Assistant on a Raspbian install and compile a Mysensors binary on it. Hass.io won't work with this scenario. I suggest you follow the docker install guide.

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

          @monte does docker allow complete functionality of hass.io? Here it's mentioned that docker will limit functionality, is that correct? For clarification, how would docker relate to a manual installation of hass.io

          monteM 1 Reply Last reply
          0
          • SebexS Sebex

            @monte does docker allow complete functionality of hass.io? Here it's mentioned that docker will limit functionality, is that correct? For clarification, how would docker relate to a manual installation of hass.io

            monteM Offline
            monteM Offline
            monte
            wrote on last edited by
            #5

            @sebex well, it appears that you can install hass.io manually on your raspbian installation via this script
            Also you can install plain Home Assistant docker image if you don't need any addons and additional functionality of hassio. That's the way I went.
            You need to understand that either way you can achieve the same things but a little different ways.
            The main point is that you need Raspbian setup in the first place if you want to use the same RPi as a gateway. You can't compile Mysensors gateway on a hassio image.

            1 Reply Last reply
            0
            • Dave MyersD Offline
              Dave MyersD Offline
              Dave Myers
              wrote on last edited by
              #6

              Unless there has been a recent change I’m unaware of - I don’t think you can have RPi function as gateway when it is running Hass.IO (via HassOS). There is not a way to load and run the mysensors executable.

              I’d suggest building a serial gateway with a nano (with NRF radio connected to nano). If you connect that via USB to your Pi, you should be able to use the homeassistant config for serial gateways to get everything working.

              1 Reply Last reply
              0
              • M Offline
                M Offline
                Michał Szura
                wrote on last edited by
                #7

                I think that you have concept problem. First I don't think that raspbian install have any sense at this stage. There's so much more you can do with hassos ( docker). And second why you doesn't connect gateway via USB an use serial connection. I use Arduino mega directly via USB and it is very stable. You have to add in configuration mysensors with path to USB (I recommend serial number identification).

                SebexS 1 Reply Last reply
                0
                • M Michał Szura

                  I think that you have concept problem. First I don't think that raspbian install have any sense at this stage. There's so much more you can do with hassos ( docker). And second why you doesn't connect gateway via USB an use serial connection. I use Arduino mega directly via USB and it is very stable. You have to add in configuration mysensors with path to USB (I recommend serial number identification).

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

                  @michał-szura here and there I do read the possibility of a Pi acting as a gateway and controller. But you mention that it is not possible whatsoever? Why not?

                  @Dave-Myers I agree that it is not possible via HassOS, but it should be possible when run via a virtual enivroment as monte suggested.

                  @monte hassio now shows up in docker as a container. But I am struggling to run it, what's the command to run hassio_supervisor? attach hassio_supervisor causes it to become unresponsive.

                  1 Reply Last reply
                  0
                  • M Offline
                    M Offline
                    Michał Szura
                    wrote on last edited by
                    #9

                    In this case I have question why? I Know that why not and because I can is good enough answer but...
                    You can have best from home assistant (install Hass os) and mysensors (make gateway on separate Arduino). And this way when you want to upgrade to something more than RPi you can do it with minimal damage ( I did it this way and it was quite nice upgrade). But this is only myn2 cents

                    monteM 1 Reply Last reply
                    0
                    • M Michał Szura

                      In this case I have question why? I Know that why not and because I can is good enough answer but...
                      You can have best from home assistant (install Hass os) and mysensors (make gateway on separate Arduino). And this way when you want to upgrade to something more than RPi you can do it with minimal damage ( I did it this way and it was quite nice upgrade). But this is only myn2 cents

                      monteM Offline
                      monteM Offline
                      monte
                      wrote on last edited by
                      #10

                      @michał-szura some may say that one integrated device is better than two. Also you can restart and debug mysensors gateway via ssh, try to achieve this with arduino. Anyway, even after you decide to move your controller installation to lets say dedicated server, NUC or VM you can still use your RPi as a network gateway without rebuilding anything.

                      @Sebex what exactly did you do? Did you use install script, or followed some guide on mentioned forum thread.
                      To see if supervisor is running execute sudo systemctl status hassio-supervisor.service
                      Also you can use sudo docker ps command to list running docker containers, sudo docker ps -a will show every container even if it is stopped.

                      SebexS 1 Reply Last reply
                      0
                      • monteM monte

                        @michał-szura some may say that one integrated device is better than two. Also you can restart and debug mysensors gateway via ssh, try to achieve this with arduino. Anyway, even after you decide to move your controller installation to lets say dedicated server, NUC or VM you can still use your RPi as a network gateway without rebuilding anything.

                        @Sebex what exactly did you do? Did you use install script, or followed some guide on mentioned forum thread.
                        To see if supervisor is running execute sudo systemctl status hassio-supervisor.service
                        Also you can use sudo docker ps command to list running docker containers, sudo docker ps -a will show every container even if it is stopped.

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

                        @monte said in Raspberry Pi gateway + hass.io + MQTT + MySensors:

                        @Sebex what exactly did you do? Did you use install script, or followed some guide on mentioned forum thread.
                        To see if supervisor is running execute sudo systemctl status hassio-supervisor.service
                        Also you can use sudo docker ps command to list running docker containers, sudo docker ps -a will show every container even if it is stopped.

                        I followed your github link, and used the cmd below to instal hassio.

                        curl -sL https://raw.githubusercontent.com/home-assistant/hassio-installer/master/hassio_install.sh | bash -s -- -m MY_MACHINE
                        

                        When I run your suggested status cmd I indeed see that hassio is running:

                        Dec 29 23:18:24 banana hassio-supervisor[1046]: 19-12-29 22:18:24 INFO (MainThread) [__main__] Run Hass.io
                        Dec 29 23:18:24 banana hassio-supervisor[1046]: 19-12-29 22:18:24 INFO (MainThread) [hassio.api] Start API on 172.30.32.2
                        Dec 29 23:18:24 banana hassio-supervisor[1046]: 19-12-29 22:18:24 INFO (MainThread) [hassio.addons] Phase 'initialize' start 0 add-ons
                        Dec 29 23:18:24 banana hassio-supervisor[1046]: 19-12-29 22:18:24 INFO (MainThread) [hassio.addons] Phase 'system' start 0 add-ons
                        Dec 29 23:18:24 banana hassio-supervisor[1046]: 19-12-29 22:18:24 INFO (MainThread) [hassio.addons] Phase 'services' start 0 add-ons
                        Dec 29 23:18:24 banana hassio-supervisor[1046]: 19-12-29 22:18:24 INFO (SyncWorker_1) [hassio.docker.interface] Start homeassistant/raspberrypi3-64-homeassistant
                        Dec 29 23:18:33 banana hassio-supervisor[1046]: 19-12-29 22:18:33 ERROR (MainThread) [hassio.homeassistant] Home Assistant has crashed!
                        Dec 29 23:18:33 banana hassio-supervisor[1046]: 19-12-29 22:18:33 INFO (MainThread) [hassio.addons] Phase 'application' start 0 add-ons
                        Dec 29 23:18:33 banana hassio-supervisor[1046]: 19-12-29 22:18:33 INFO (MainThread) [hassio.tasks] All core tasks are scheduled
                        Dec 29 23:18:33 banana hassio-supervisor[1046]: 19-12-29 22:18:33 INFO (MainThread) [hassio.core] Hass.io is up and running
                        

                        But I tried accessing hassio multiple times via <raspberrypi local ipadres>:8123, which is unresponsive. Any suggestions? The Pi is connected via wifi, ip adres is not yet static but doubt that this is the cause.

                        -- update

                        Now that I am looking into it again after setting Pi's IP to static, the bottom 4th line shows an error. Home assistant has crashed. So something is going wrong...

                        monteM 1 Reply Last reply
                        0
                        • SebexS Sebex

                          @monte said in Raspberry Pi gateway + hass.io + MQTT + MySensors:

                          @Sebex what exactly did you do? Did you use install script, or followed some guide on mentioned forum thread.
                          To see if supervisor is running execute sudo systemctl status hassio-supervisor.service
                          Also you can use sudo docker ps command to list running docker containers, sudo docker ps -a will show every container even if it is stopped.

                          I followed your github link, and used the cmd below to instal hassio.

                          curl -sL https://raw.githubusercontent.com/home-assistant/hassio-installer/master/hassio_install.sh | bash -s -- -m MY_MACHINE
                          

                          When I run your suggested status cmd I indeed see that hassio is running:

                          Dec 29 23:18:24 banana hassio-supervisor[1046]: 19-12-29 22:18:24 INFO (MainThread) [__main__] Run Hass.io
                          Dec 29 23:18:24 banana hassio-supervisor[1046]: 19-12-29 22:18:24 INFO (MainThread) [hassio.api] Start API on 172.30.32.2
                          Dec 29 23:18:24 banana hassio-supervisor[1046]: 19-12-29 22:18:24 INFO (MainThread) [hassio.addons] Phase 'initialize' start 0 add-ons
                          Dec 29 23:18:24 banana hassio-supervisor[1046]: 19-12-29 22:18:24 INFO (MainThread) [hassio.addons] Phase 'system' start 0 add-ons
                          Dec 29 23:18:24 banana hassio-supervisor[1046]: 19-12-29 22:18:24 INFO (MainThread) [hassio.addons] Phase 'services' start 0 add-ons
                          Dec 29 23:18:24 banana hassio-supervisor[1046]: 19-12-29 22:18:24 INFO (SyncWorker_1) [hassio.docker.interface] Start homeassistant/raspberrypi3-64-homeassistant
                          Dec 29 23:18:33 banana hassio-supervisor[1046]: 19-12-29 22:18:33 ERROR (MainThread) [hassio.homeassistant] Home Assistant has crashed!
                          Dec 29 23:18:33 banana hassio-supervisor[1046]: 19-12-29 22:18:33 INFO (MainThread) [hassio.addons] Phase 'application' start 0 add-ons
                          Dec 29 23:18:33 banana hassio-supervisor[1046]: 19-12-29 22:18:33 INFO (MainThread) [hassio.tasks] All core tasks are scheduled
                          Dec 29 23:18:33 banana hassio-supervisor[1046]: 19-12-29 22:18:33 INFO (MainThread) [hassio.core] Hass.io is up and running
                          

                          But I tried accessing hassio multiple times via <raspberrypi local ipadres>:8123, which is unresponsive. Any suggestions? The Pi is connected via wifi, ip adres is not yet static but doubt that this is the cause.

                          -- update

                          Now that I am looking into it again after setting Pi's IP to static, the bottom 4th line shows an error. Home assistant has crashed. So something is going wrong...

                          monteM Offline
                          monteM Offline
                          monte
                          wrote on last edited by monte
                          #12

                          @sebex well, that indicates that homeassistant docker container has crashed for some reason. That's why you can not access it via web.
                          I assume you tried to restart RPi? No changes?
                          Try sudo docker start homeassistant and sudo docker ps -a after this to see if it crashed or not.
                          It will print something like this:

                          CONTAINER ID   NAMES                      IMAGE                                            COMMAND                  CREATED             STATUS                  
                          b8d101b1b04d   addon_core_configurator    homeassistant/amd64-addon-configurator:4.2       "/run.sh"                13 hours ago        Up 13 hours
                          ee63787039a5   hassio_dns                 homeassistant/amd64-hassio-dns:1                 "coredns -conf /conf…"   14 hours ago        Up 14 hours
                          18c68d86c0ae   homeassistant              homeassistant/qemux86-64-homeassistant:0.103.5   "/bin/entry.sh pytho…"   14 hours ago        Up 14 hours
                          24f80b84279d   hassio_supervisor          homeassistant/amd64-hassio-supervisor            "/bin/entry.sh pytho…"   14 hours ago        Up 14 hours
                          

                          Status will show the status of the container. You can read the logs to see why it is crashing with command sudo docker logs homeassistant.
                          Yesterday after I wrote a reply I tried that install script on my server and it just worked. I hope we will find problem with your setup :)

                          SebexS 1 Reply Last reply
                          0
                          • monteM monte

                            @sebex well, that indicates that homeassistant docker container has crashed for some reason. That's why you can not access it via web.
                            I assume you tried to restart RPi? No changes?
                            Try sudo docker start homeassistant and sudo docker ps -a after this to see if it crashed or not.
                            It will print something like this:

                            CONTAINER ID   NAMES                      IMAGE                                            COMMAND                  CREATED             STATUS                  
                            b8d101b1b04d   addon_core_configurator    homeassistant/amd64-addon-configurator:4.2       "/run.sh"                13 hours ago        Up 13 hours
                            ee63787039a5   hassio_dns                 homeassistant/amd64-hassio-dns:1                 "coredns -conf /conf…"   14 hours ago        Up 14 hours
                            18c68d86c0ae   homeassistant              homeassistant/qemux86-64-homeassistant:0.103.5   "/bin/entry.sh pytho…"   14 hours ago        Up 14 hours
                            24f80b84279d   hassio_supervisor          homeassistant/amd64-hassio-supervisor            "/bin/entry.sh pytho…"   14 hours ago        Up 14 hours
                            

                            Status will show the status of the container. You can read the logs to see why it is crashing with command sudo docker logs homeassistant.
                            Yesterday after I wrote a reply I tried that install script on my server and it just worked. I hope we will find problem with your setup :)

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

                            @monte yes tried rebooting it several times and also reinstalled but no changes so far, it still crashes.

                            I tried your commands, after sudo docker start homeassistant it immediately crashes according to the logs below.

                            CONTAINER ID        IMAGE                                                 COMMAND                  CREATED             STATUS                     PORTS               NAMES
                            0b0ffff70832        homeassistant/armv7-hassio-dns:1                      "coredns -conf /conf…"   5 minutes ago       Up 5 minutes                                   hassio_dns
                            3b83e6f9db07        homeassistant/raspberrypi3-64-homeassistant:0.103.5   "/bin/entry.sh pytho…"   2 hours ago         Exited (1) 2 seconds ago                       homeassistant
                            9fd90364c61f        homeassistant/armv7-hassio-supervisor  
                            
                            sudo docker logs homeassistant
                            [FATAL tini (6)] exec /bin/entry.sh failed: Exec format error
                            [FATAL tini (6)] exec /bin/entry.sh failed: Exec format error
                            

                            Thanks for the help so far @monte hope we can fix it :D

                            monteM 1 Reply Last reply
                            0
                            • SebexS Sebex

                              @monte yes tried rebooting it several times and also reinstalled but no changes so far, it still crashes.

                              I tried your commands, after sudo docker start homeassistant it immediately crashes according to the logs below.

                              CONTAINER ID        IMAGE                                                 COMMAND                  CREATED             STATUS                     PORTS               NAMES
                              0b0ffff70832        homeassistant/armv7-hassio-dns:1                      "coredns -conf /conf…"   5 minutes ago       Up 5 minutes                                   hassio_dns
                              3b83e6f9db07        homeassistant/raspberrypi3-64-homeassistant:0.103.5   "/bin/entry.sh pytho…"   2 hours ago         Exited (1) 2 seconds ago                       homeassistant
                              9fd90364c61f        homeassistant/armv7-hassio-supervisor  
                              
                              sudo docker logs homeassistant
                              [FATAL tini (6)] exec /bin/entry.sh failed: Exec format error
                              [FATAL tini (6)] exec /bin/entry.sh failed: Exec format error
                              

                              Thanks for the help so far @monte hope we can fix it :D

                              monteM Offline
                              monteM Offline
                              monte
                              wrote on last edited by monte
                              #14

                              @sebex okay, that seems that for some reason script pulled out wrong HA container, I mean for wrong architecture. At least [FATAL tini (6)] exec /bin/entry.sh failed: Exec format error indicates that.
                              What is your RPi version?
                              You can try running the script without -m MY_MACHINE argument. It should autodetect the architecture and pull correct docker image.
                              What does uname -m show?

                              1 Reply Last reply
                              0
                              • SebexS Offline
                                SebexS Offline
                                Sebex
                                wrote on last edited by
                                #15

                                @monte yea it made me wonder as well whether I should have selected the rpi 3 64bit version for docker image.
                                I have a Raspberry pi 3 b+ (so 64bit).
                                uname -m shows armv7l, when googling I got the answer that this can also be due to that Raspbian is running in 32 mode?

                                I tried running the script without -m MY_MACHINE returns an error for setting the machine.

                                root@banana:/home/pi# sudo curl -sL https://raw.githubusercontent.com/home-assistant/hassio-installer/master/hassio_install.sh | bash -s
                                ModemManager.service enabled
                                [Warning] ModemManager service is enabled. This might cause issue when using serial devices.
                                [ERROR] Please set machine for armv7l
                                

                                I've just completely reflashed my Pi and used a different microsd card (couldn't format the original one anymore). Reinstalled raspbian, docker and hass.io. For the latter I selected raspberrpi3 (instead of rpi3-64). After accessing localip:8123 it seems that hass.io is accessible :D It's currently preparing so looking good!!

                                SebexS 1 Reply Last reply
                                0
                                • SebexS Sebex

                                  @monte yea it made me wonder as well whether I should have selected the rpi 3 64bit version for docker image.
                                  I have a Raspberry pi 3 b+ (so 64bit).
                                  uname -m shows armv7l, when googling I got the answer that this can also be due to that Raspbian is running in 32 mode?

                                  I tried running the script without -m MY_MACHINE returns an error for setting the machine.

                                  root@banana:/home/pi# sudo curl -sL https://raw.githubusercontent.com/home-assistant/hassio-installer/master/hassio_install.sh | bash -s
                                  ModemManager.service enabled
                                  [Warning] ModemManager service is enabled. This might cause issue when using serial devices.
                                  [ERROR] Please set machine for armv7l
                                  

                                  I've just completely reflashed my Pi and used a different microsd card (couldn't format the original one anymore). Reinstalled raspbian, docker and hass.io. For the latter I selected raspberrpi3 (instead of rpi3-64). After accessing localip:8123 it seems that hass.io is accessible :D It's currently preparing so looking good!!

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

                                  Ok so homeassistant is running and not crashing :) Now building the gateway, @monte to eventually communicate with hass.io do I need to select the gateway as --my-gateway=ethernet or mqtt?

                                  monteM 1 Reply Last reply
                                  0
                                  • SebexS Sebex

                                    Ok so homeassistant is running and not crashing :) Now building the gateway, @monte to eventually communicate with hass.io do I need to select the gateway as --my-gateway=ethernet or mqtt?

                                    monteM Offline
                                    monteM Offline
                                    monte
                                    wrote on last edited by
                                    #17

                                    @sebex you can chose either. I prefer ethernet, so you don't rely on another piece of software - MQTT broker, no additional setup is required.
                                    Read this docs especially the "Presentation" paragraph. At first I had trouble registering my nodes in HA, because it require particular way of presentation. "Send at least one initial value per V_TYPE. In version 2.x of MySensors, this has to be done in the loop function."

                                    SebexS 1 Reply Last reply
                                    0
                                    • monteM monte

                                      @sebex you can chose either. I prefer ethernet, so you don't rely on another piece of software - MQTT broker, no additional setup is required.
                                      Read this docs especially the "Presentation" paragraph. At first I had trouble registering my nodes in HA, because it require particular way of presentation. "Send at least one initial value per V_TYPE. In version 2.x of MySensors, this has to be done in the loop function."

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

                                      @monte ok thanks, will take it into account.
                                      Out of curiousity, since MQTT takes additional setup what''s the benefit of using MQTT? Do you know?

                                      monteM 1 Reply Last reply
                                      0
                                      • SebexS Sebex

                                        @monte ok thanks, will take it into account.
                                        Out of curiousity, since MQTT takes additional setup what''s the benefit of using MQTT? Do you know?

                                        monteM Offline
                                        monteM Offline
                                        monte
                                        wrote on last edited by
                                        #19

                                        @sebex I guess if you already have other mqtt services or devices in your system, or want to use a controller that is designed specifically around mqtt, nodered for example, or the one that doesn't have support for Mysensors specifically.
                                        Also you could use Mysensors with remote mqtt server, your own, or third party. I tried this once, when I needed one sensor exposed to internet without dedicated server hardware at place, so I've built an esp8266 gateway with mqtt connected to free online mqtt broker. The nodered controller was also hosted on a free cloud :)
                                        Not that it was particularly useful, or I would recommend it to someone, but it's a flexibility Mysensors has, and I guess it's the main reason so many people are using it for their projects.

                                        1 Reply Last reply
                                        0
                                        • SebexS Offline
                                          SebexS Offline
                                          Sebex
                                          wrote on last edited by
                                          #20

                                          @monte ok it seems to work. Temp/humidity sensor is recognised by HA and data is getting through so looks good! Only connection isnt stable which is most likely due to that I still need to get capacitors for the NRF24L01+ on both ends, and need to solder the cables to the sensor. So still some tweaks to do but happy that it works, thanks for the support @monte :grinning:

                                          Two general questions, any advice for which capacitor to select? Apart from 4.7 or 47uF, there's different types. Tanto, elco, bipolaire etc.
                                          Furthermore I wondered why the 64bit hassio software didn't work on my Arduino, while it is a 64bit RPi 3+. Does Raspbian (or dockers?) as default run in 32?

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


                                          17

                                          Online

                                          11.7k

                                          Users

                                          11.2k

                                          Topics

                                          113.1k

                                          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