Raspberry Pi gateway + hass.io + MQTT + MySensors
-
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. -
-
@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
@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. -
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.
-
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).
-
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).
@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.
-
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 -
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@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 executesudo systemctl status hassio-supervisor.service
Also you can usesudo docker pscommand to list running docker containers,sudo docker ps -awill show every container even if it is stopped. -
@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 executesudo systemctl status hassio-supervisor.service
Also you can usesudo docker pscommand to list running docker containers,sudo docker ps -awill show every container even if it is stopped.@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 executesudo systemctl status hassio-supervisor.service
Also you can usesudo docker pscommand to list running docker containers,sudo docker ps -awill 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_MACHINEWhen 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 runningBut 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...
-
@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 executesudo systemctl status hassio-supervisor.service
Also you can usesudo docker pscommand to list running docker containers,sudo docker ps -awill 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_MACHINEWhen 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 runningBut 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...
@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?
Trysudo docker start homeassistantandsudo docker ps -aafter 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 hoursStatus 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 :) -
@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?
Trysudo docker start homeassistantandsudo docker ps -aafter 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 hoursStatus 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 :)@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 homeassistantit 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-supervisorsudo docker logs homeassistant [FATAL tini (6)] exec /bin/entry.sh failed: Exec format error [FATAL tini (6)] exec /bin/entry.sh failed: Exec format errorThanks for the help so far @monte hope we can fix it :D
-
@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 homeassistantit 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-supervisorsudo docker logs homeassistant [FATAL tini (6)] exec /bin/entry.sh failed: Exec format error [FATAL tini (6)] exec /bin/entry.sh failed: Exec format errorThanks for the help so far @monte hope we can fix it :D
@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 errorindicates that.
What is your RPi version?
You can try running the script without-m MY_MACHINEargument. It should autodetect the architecture and pull correct docker image.
What doesuname -mshow? -
@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 -mshows 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_MACHINEreturns 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 armv7lI'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!!
-
@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 -mshows 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_MACHINEreturns 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 armv7lI'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!!
-
@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." -
@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." -
@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?@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. -
@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?