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. Gateway Addon for Hass.io

Gateway Addon for Hass.io

Scheduled Pinned Locked Moved Home Assistant
19 Posts 6 Posters 7.4k Views 8 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.
  • G ghiglie

    Hi there,
    in these days I've been trying to get the Gateway working as an add-on for Hass.io, running on RaspberryPi3.
    You can find all my work (well, tons of hours for just some lines! :D) here on GitHub. Even it's the master branch, it's totally in development...
    So, now, I'm stuck.

    It looks like that if I start the Docker container as privileged, it works! But not when it start with the configuration you see, and neither I can give the privileged capability to the container.
    Any ideas on what on the host I should expose?

    hautomateH Offline
    hautomateH Offline
    hautomate
    wrote on last edited by
    #2

    @ghiglie I presume you've seen this. Tried them all?

    Privilege for access to hardware/system. Available access: NET_ADMIN, SYS_ADMIN, SYS_RAWIO, SYS_TIME, SYS_NICE

    1 Reply Last reply
    0
    • hautomateH Offline
      hautomateH Offline
      hautomate
      wrote on last edited by
      #3

      Is this the error you're taking about?

      [services.d] starting services
      [services.d] done.
      ifelse: fatal: unable to exec /run.sh: Permission denied
      [cmd] /run.sh exited 111
      [cont-finish.d] executing container finish scripts...
      [cont-finish.d] 99-message.sh: executing... 
      -----------------------------------------------------------
                      Oops! Something went wrong.
       
       We are so sorry, but something went terribly wrong when
       starting or running this add-on.
       
       Be sure to check the log above, line by line, for hints.
      -----------------------------------------------------------
      [cont-finish.d] 99-message.sh: exited 0.
      [cont-finish.d] done.
      
      1 Reply Last reply
      0
      • hautomateH Offline
        hautomateH Offline
        hautomate
        wrote on last edited by
        #4

        Try setting permissions on run.sh.

        RUN chmod a+x /run.sh
        
        CMD [ "/run.sh" ]
        
        1 Reply Last reply
        0
        • G Offline
          G Offline
          ghiglie
          wrote on last edited by ghiglie
          #5

          oops, sorry, I've fixed that locally after I pushed the code to git. I see just now I'm not exposing the 5003 port... :|

          I'll add the RUN command.

          I mean, mysgw hangs on activating the transport.

          @hautomate said in Gateway Addon for Hass.io:

          @ghiglie I presume you've seen this. Tried them all?

          Privilege for access to hardware/system. Available access: NET_ADMIN, SYS_ADMIN, SYS_RAWIO, SYS_TIME, SYS_NICE

          Yes, tried all, even with gpio set to true.

          atmega328p serial killer
          HomeAssistant / gateway: ESP8266 & NRF24L01+ gateway

          1 Reply Last reply
          0
          • hautomateH Offline
            hautomateH Offline
            hautomate
            wrote on last edited by hautomate
            #6

            Add...

            "host_network": true,

            and for port 5003, what about this?

            "ports": {
            "5003/tcp": 5003
            },

            Or put the port as an option so it could be configured by the user. I'm not sure what else would be needed for this to work.

            "options": {
            "port": 5003,

            G 1 Reply Last reply
            0
            • hautomateH hautomate

              Add...

              "host_network": true,

              and for port 5003, what about this?

              "ports": {
              "5003/tcp": 5003
              },

              Or put the port as an option so it could be configured by the user. I'm not sure what else would be needed for this to work.

              "options": {
              "port": 5003,

              G Offline
              G Offline
              ghiglie
              wrote on last edited by
              #7

              @hautomate said in Gateway Addon for Hass.io:

              Add...

              "host_network": true,

              and for port 5003, what about this?

              "ports": {
              "5003/tcp": 5003
              },

              Or put the port as an option so it could be configured by the user. I'm not sure what else would be needed for this to work.

              "options": {
              "port": 5003,

              I've added it locally, since it's primaly a MQTT image.

              I'm stopping here now:

              mysgw: Starting gateway...
              mysgw: Protocol version - 2.2.0-rc.2
              mysgw: MCO:BGN:INIT GW,CP=RNNGL---,VER=2.2.0-rc.2
              mysgw: TSF:LRT:OK
              mysgw: TSM:INIT
              mysgw: TSF:WUR:MS=0

              so it's not starting the transport.
              Any idea on what I shoudl enable?

              atmega328p serial killer
              HomeAssistant / gateway: ESP8266 & NRF24L01+ gateway

              hautomateH 1 Reply Last reply
              0
              • G ghiglie

                @hautomate said in Gateway Addon for Hass.io:

                Add...

                "host_network": true,

                and for port 5003, what about this?

                "ports": {
                "5003/tcp": 5003
                },

                Or put the port as an option so it could be configured by the user. I'm not sure what else would be needed for this to work.

                "options": {
                "port": 5003,

                I've added it locally, since it's primaly a MQTT image.

                I'm stopping here now:

                mysgw: Starting gateway...
                mysgw: Protocol version - 2.2.0-rc.2
                mysgw: MCO:BGN:INIT GW,CP=RNNGL---,VER=2.2.0-rc.2
                mysgw: TSF:LRT:OK
                mysgw: TSM:INIT
                mysgw: TSF:WUR:MS=0

                so it's not starting the transport.
                Any idea on what I shoudl enable?

                hautomateH Offline
                hautomateH Offline
                hautomate
                wrote on last edited by
                #8

                @ghiglie hmm, not sure. Would you please update your repo with the latest and I'll try a reinstall and have a closer look?

                G 1 Reply Last reply
                0
                • hautomateH hautomate

                  @ghiglie hmm, not sure. Would you please update your repo with the latest and I'll try a reinstall and have a closer look?

                  G Offline
                  G Offline
                  ghiglie
                  wrote on last edited by ghiglie
                  #9

                  @hautomate said in Gateway Addon for Hass.io:

                  @ghiglie hmm, not sure. Would you please update your repo with the latest and I'll try a reinstall and have a closer look?

                  sorry, I'm out for work :( I'll do ASAP tomorrow!

                  EDIT: Updated!

                  atmega328p serial killer
                  HomeAssistant / gateway: ESP8266 & NRF24L01+ gateway

                  hautomateH 1 Reply Last reply
                  0
                  • G ghiglie

                    @hautomate said in Gateway Addon for Hass.io:

                    @ghiglie hmm, not sure. Would you please update your repo with the latest and I'll try a reinstall and have a closer look?

                    sorry, I'm out for work :( I'll do ASAP tomorrow!

                    EDIT: Updated!

                    hautomateH Offline
                    hautomateH Offline
                    hautomate
                    wrote on last edited by
                    #10

                    @ghiglie It shows the last commit as 14 days ago...

                    G 1 Reply Last reply
                    0
                    • S Offline
                      S Offline
                      swcrawford
                      wrote on last edited by
                      #11

                      Will be watching with interest. I'd like to move to hass.io but this is the one thing stopping me.

                      1 Reply Last reply
                      0
                      • hautomateH hautomate

                        @ghiglie It shows the last commit as 14 days ago...

                        G Offline
                        G Offline
                        ghiglie
                        wrote on last edited by
                        #12

                        @hautomate said in Gateway Addon for Hass.io:

                        @ghiglie It shows the last commit as 14 days ago...

                        git-noob mistake! updated!

                        atmega328p serial killer
                        HomeAssistant / gateway: ESP8266 & NRF24L01+ gateway

                        hautomateH 1 Reply Last reply
                        0
                        • G ghiglie

                          @hautomate said in Gateway Addon for Hass.io:

                          @ghiglie It shows the last commit as 14 days ago...

                          git-noob mistake! updated!

                          hautomateH Offline
                          hautomateH Offline
                          hautomate
                          wrote on last edited by hautomate
                          #13

                          @ghiglie said in Gateway Addon for Hass.io:

                          git-noob mistake! updated!

                          Haha! I forgot to tell you that I have no idea what I'm doing :)

                          The 'run chmod' command is still missing in the dockerfile.

                          1 Reply Last reply
                          0
                          • R Offline
                            R Offline
                            rusg323
                            wrote on last edited by
                            #14

                            Wondering what the status of this is. Would love to try it out as I have migrated to hassio and would love to integrate mysensors gateway back on the same rpi.

                            1 Reply Last reply
                            0
                            • kwekK Offline
                              kwekK Offline
                              kwek
                              wrote on last edited by
                              #15

                              I'm also trying to make a hassio addon for the mysensors gateway which is connected on the same raspberry pi 2.

                              If I run the docker image with --privileged then it runs correctly: it manages to read from the nrf2401, it connects to the MQTT server and publishes incoming messages.

                              However, if I run the container without --privileged (like hassio does), the mysgw program does not output anything else after:

                              : Starting gateway...
                              : Protocol version - 2.2.0
                              : MCO:BGN:INIT GW,CP=RNNGL---,VER=2.2.0
                              : TSF:LRT:OK
                              : TSM:INIT
                              : TSF:WUR:MS=0
                              

                              I'm running the container like this:

                              docker run -it --rm --cap-add SYS_RAWIO --device /dev/mem --device /dev/gpiomem local/mysgw
                              

                              If I run a strace on the mysgw binary, I see:

                              bash-4.4# strace mysgw -d 2>&1 | grep open
                              open("/sys/class/gpio", O_RDONLY|O_LARGEFILE|O_DIRECTORY|O_CLOEXEC) = 3
                              open("/sys/class/gpio/gpiochip0/base", O_RDONLY|O_LARGEFILE) = 4
                              open("/sys/class/gpio/gpiochip0/ngpio", O_RDONLY|O_LARGEFILE) = 4
                              open("/sys/class/gpio/gpiochip100/base", O_RDONLY|O_LARGEFILE) = 4
                              open("/sys/class/gpio/gpiochip100/ngpio", O_RDONLY|O_LARGEFILE) = 4
                              open("/etc/mysensors.dat", O_RDONLY|O_LARGEFILE) = 3
                              open("/dev/urandom", O_RDONLY|O_LARGEFILE) = 3
                              open("/dev/console", O_WRONLY|O_NOCTTY|O_LARGEFILE|O_CLOEXEC) = 5
                              open("/dev/console", O_WRONLY|O_NOCTTY|O_LARGEFILE|O_CLOEXEC) = 5
                              open("/dev/console", O_WRONLY|O_NOCTTY|O_LARGEFILE|O_CLOEXEC) = 5
                              open("/etc/mysensors.dat", O_RDONLY|O_LARGEFILE) = 5
                              open("/dev/console", O_WRONLY|O_NOCTTY|O_LARGEFILE|O_CLOEXEC) = 5
                              open("/dev/console", O_WRONLY|O_NOCTTY|O_LARGEFILE|O_CLOEXEC) = 5
                              open("/dev/console", O_WRONLY|O_NOCTTY|O_LARGEFILE|O_CLOEXEC) = 5
                              open("/proc/cpuinfo", O_RDONLY|O_LARGEFILE) = 5
                              open("/proc/device-tree/soc/ranges", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
                              open("/dev/mem", O_RDWR|O_SYNC|O_LARGEFILE) = 5
                              

                              It looks like it can't open a device which is also described in https://www.mysensors.org/apidocs/group__BCM2835grp.html

                              It seems to be a symlink to some device in /sys, but this directory is empty somehow.

                              bash-4.4# ls -al /proc/device-tree 
                              lrwxrwxrwx    1 root     root            29 May  7 15:10 /proc/device-tree -> /sys/firmware/devicetree/base
                              bash-4.4# ls -al /sys/firmware
                              total 0
                              drwxrwxrwt    2 root     root            40 May  7 15:34 .
                              dr-xr-xr-x   12 root     root             0 May  7 15:34 ..
                              

                              That's how far I got. Does anyone know how to make this device available within the container without having to use --privileged?

                              G 1 Reply Last reply
                              0
                              • kwekK kwek

                                I'm also trying to make a hassio addon for the mysensors gateway which is connected on the same raspberry pi 2.

                                If I run the docker image with --privileged then it runs correctly: it manages to read from the nrf2401, it connects to the MQTT server and publishes incoming messages.

                                However, if I run the container without --privileged (like hassio does), the mysgw program does not output anything else after:

                                : Starting gateway...
                                : Protocol version - 2.2.0
                                : MCO:BGN:INIT GW,CP=RNNGL---,VER=2.2.0
                                : TSF:LRT:OK
                                : TSM:INIT
                                : TSF:WUR:MS=0
                                

                                I'm running the container like this:

                                docker run -it --rm --cap-add SYS_RAWIO --device /dev/mem --device /dev/gpiomem local/mysgw
                                

                                If I run a strace on the mysgw binary, I see:

                                bash-4.4# strace mysgw -d 2>&1 | grep open
                                open("/sys/class/gpio", O_RDONLY|O_LARGEFILE|O_DIRECTORY|O_CLOEXEC) = 3
                                open("/sys/class/gpio/gpiochip0/base", O_RDONLY|O_LARGEFILE) = 4
                                open("/sys/class/gpio/gpiochip0/ngpio", O_RDONLY|O_LARGEFILE) = 4
                                open("/sys/class/gpio/gpiochip100/base", O_RDONLY|O_LARGEFILE) = 4
                                open("/sys/class/gpio/gpiochip100/ngpio", O_RDONLY|O_LARGEFILE) = 4
                                open("/etc/mysensors.dat", O_RDONLY|O_LARGEFILE) = 3
                                open("/dev/urandom", O_RDONLY|O_LARGEFILE) = 3
                                open("/dev/console", O_WRONLY|O_NOCTTY|O_LARGEFILE|O_CLOEXEC) = 5
                                open("/dev/console", O_WRONLY|O_NOCTTY|O_LARGEFILE|O_CLOEXEC) = 5
                                open("/dev/console", O_WRONLY|O_NOCTTY|O_LARGEFILE|O_CLOEXEC) = 5
                                open("/etc/mysensors.dat", O_RDONLY|O_LARGEFILE) = 5
                                open("/dev/console", O_WRONLY|O_NOCTTY|O_LARGEFILE|O_CLOEXEC) = 5
                                open("/dev/console", O_WRONLY|O_NOCTTY|O_LARGEFILE|O_CLOEXEC) = 5
                                open("/dev/console", O_WRONLY|O_NOCTTY|O_LARGEFILE|O_CLOEXEC) = 5
                                open("/proc/cpuinfo", O_RDONLY|O_LARGEFILE) = 5
                                open("/proc/device-tree/soc/ranges", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
                                open("/dev/mem", O_RDWR|O_SYNC|O_LARGEFILE) = 5
                                

                                It looks like it can't open a device which is also described in https://www.mysensors.org/apidocs/group__BCM2835grp.html

                                It seems to be a symlink to some device in /sys, but this directory is empty somehow.

                                bash-4.4# ls -al /proc/device-tree 
                                lrwxrwxrwx    1 root     root            29 May  7 15:10 /proc/device-tree -> /sys/firmware/devicetree/base
                                bash-4.4# ls -al /sys/firmware
                                total 0
                                drwxrwxrwt    2 root     root            40 May  7 15:34 .
                                dr-xr-xr-x   12 root     root             0 May  7 15:34 ..
                                

                                That's how far I got. Does anyone know how to make this device available within the container without having to use --privileged?

                                G Offline
                                G Offline
                                ghiglie
                                wrote on last edited by ghiglie
                                #16

                                Hi @kwek, sorry for taking so much to reply. We've been taking the same path!

                                @kwek said in Gateway Addon for Hass.io:

                                I'm also trying to make a hassio addon for the mysensors gateway which is connected on the same raspberry pi 2.

                                If I run the docker image with --privileged then it runs correctly: it manages to read from the nrf2401, it connects to the MQTT server and publishes incoming messages.

                                However, if I run the container without --privileged (like hassio does), the mysgw program does not output anything else after:

                                Same here. I've been trying some time ago, if I get to start the container in privileged mode it runs without any problems!

                                So, I've been looking to how enable the GPIO on the board to the container, using the ResinOS guide: https://docs.resin.io/learn/develop/hardware/gpio/

                                ...but I got nothing of use. You see anyway that the GPIO definitions are under the /sys/class/gpio/ device tree...

                                I hope to have some more spare time to test this.

                                atmega328p serial killer
                                HomeAssistant / gateway: ESP8266 & NRF24L01+ gateway

                                hautomateH 1 Reply Last reply
                                0
                                • G ghiglie

                                  Hi @kwek, sorry for taking so much to reply. We've been taking the same path!

                                  @kwek said in Gateway Addon for Hass.io:

                                  I'm also trying to make a hassio addon for the mysensors gateway which is connected on the same raspberry pi 2.

                                  If I run the docker image with --privileged then it runs correctly: it manages to read from the nrf2401, it connects to the MQTT server and publishes incoming messages.

                                  However, if I run the container without --privileged (like hassio does), the mysgw program does not output anything else after:

                                  Same here. I've been trying some time ago, if I get to start the container in privileged mode it runs without any problems!

                                  So, I've been looking to how enable the GPIO on the board to the container, using the ResinOS guide: https://docs.resin.io/learn/develop/hardware/gpio/

                                  ...but I got nothing of use. You see anyway that the GPIO definitions are under the /sys/class/gpio/ device tree...

                                  I hope to have some more spare time to test this.

                                  hautomateH Offline
                                  hautomateH Offline
                                  hautomate
                                  wrote on last edited by
                                  #17

                                  @ghiglie Here's an add-on that uses a pi gpio pin. Maybe it will help.

                                  https://github.com/pantomax/hassio-addons/tree/master/rpi-rf-receiver

                                  It's discussed in this thread:
                                  https://community.home-assistant.io/t/rpi-rf-receiver-addon/32947

                                  G 1 Reply Last reply
                                  0
                                  • hautomateH hautomate

                                    @ghiglie Here's an add-on that uses a pi gpio pin. Maybe it will help.

                                    https://github.com/pantomax/hassio-addons/tree/master/rpi-rf-receiver

                                    It's discussed in this thread:
                                    https://community.home-assistant.io/t/rpi-rf-receiver-addon/32947

                                    G Offline
                                    G Offline
                                    ghiglie
                                    wrote on last edited by ghiglie
                                    #18

                                    @hautomate Thanks! I didn't notice it at all.
                                    EDIT: A quick look:
                                    @pantomax in config.json "only" has:

                                        "devices": ["/dev/mem:/dev/mem:rw"],
                                        "privileged": ["SYS_RAWIO"],
                                        "gpio": "true",
                                    

                                    ...while I put an overpowered:

                                      "devices": [ "/dev/mem:/dev/mem:rw" ],
                                      "privileged": [ "SYS_RAWIO", "SYS_ADMIN", "NET_ADMIN" ],
                                      "gpio": "true",
                                    

                                    so... it should work :(

                                    atmega328p serial killer
                                    HomeAssistant / gateway: ESP8266 & NRF24L01+ gateway

                                    1 Reply Last reply
                                    0
                                    • B Offline
                                      B Offline
                                      BlackChart
                                      wrote on last edited by
                                      #19

                                      Did you get this up and running?

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


                                      30

                                      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