{"id":200,"date":"2021-08-22T16:53:58","date_gmt":"2021-08-22T15:53:58","guid":{"rendered":"https:\/\/robert-metzler.com\/?p=200"},"modified":"2021-12-29T23:38:06","modified_gmt":"2021-12-29T22:38:06","slug":"building-a-raspberry-pi-3-b-based-homegear-server-using-opensuse-kubic-and-docker","status":"publish","type":"post","link":"https:\/\/www.robert-metzler.com\/?p=200","title":{"rendered":"Building a Raspberry Pi 3 b+ based homegear server using openSuse Kubic and Docker"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">Abstract<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">This article is about how to setup an homegear server for controlling Homematic wired homeautomation components, replacing or complementing a CCU2\/3.  <\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Results and conclusions first &#8230;<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">After running homegear with an non docker direct installation on Ubuntu for several years with good experience, but having sometimes a hard time with updates, I thought I do it differntly next.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I thought about using SuSE MicroOS for improving updates and stability. <br>Using Docker and the homegear docker image, to improve homegear updates as well, ease the installation and make it more flexible.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In the end, I managed to install it, and basically it works fine, updates going smoothly, automatic and snapshots and rollebacks on MicroOS are low maintenance.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">HOWEVER &#8230;.<br>Using this setup, the MicroSD card inside the Raspberry Pi seems to be pretty stressed, and I got corrupted filesystems after 3-6 months now using my 3rd sd card, that just died again.<br>I mean, that was outlined already on the Web by several people, that this could be an issue, because the sd cards are not suitable for this type of workload.<br>But I didn&#8217;t think it was THAT bad &#8230; <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To fix the issue, I would have to add some sort of a USB3 ssd, hdd or M2\/USB drive. But this requires again some additional power, cost and space.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Therefore I decided to go another way, using a LAN RS485 gateway from Homematic instead, and moving homegear to my home server that also runs Openhab.<br>In addition, I added a Raspi based RaspberryMATIC installation as a CCU equivalent, but I will add my experience with that to another blog article here that follows soon.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Anyway, this was a nice project, with quite a few challenges and plenty of learnings.<br>Maybe the experience is helpful still for one or the other.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Let me know your feedback !<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Here&#8217;s the story &#8230;.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Overview<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">The Hardware<\/h3>\n\n\n\n<ul class=\"wp-block-list\"><li>Raspberry Pi 3 b+<\/li><li>LiIO Battery backup unit shield<\/li><li>RS485 module<\/li><li>DC\/DC converter for a wide input power range<\/li><li>Housing and mounting equipment<\/li><\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Software<\/h3>\n\n\n\n<ul class=\"wp-block-list\"><li>OpenSuse MicroOS Kubic based on Tumbleweed<\/li><li>Docker<\/li><li>Homegear Docker image<\/li><li>libgpio2<\/li><li>libgpio-tools<\/li><li>python3-gpiod<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Prepare Hardware<\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li>Install BBU shield<\/li><li>Instll Raspi 3 + BBU shield in housing<\/li><li>Add RS485 module<\/li><li>Add DC\/DC converter<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">OS installation : OpenSuSE MicroOS Kubic based on Tumbleweed<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">OpenSuSE MicroOS Kubic<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">This distribution is pretty new, based on Tumbleweed and should fit perfect for Edge devices, like the Homegear RasPi server.<br>The Kubic distribution includes a minimum OS and kubeadm, so it should be perfectly suited for running any container deployments on the Edge.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I actually expect to reduce the effort for maintaining and updating this edge server, and I hope many of the maintainance tasks run smoother and are less time consuming.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">However, since this is pretty new, time and experience in the next months will tell, if my expectations are satisfied.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Useful links and information<\/h3>\n\n\n\n<figure class=\"wp-block-table is-style-regular\"><table><thead><tr><th>Topic<\/th><th>Link<\/th><\/tr><\/thead><tbody><tr><td>OpenSuse Kubic Portal<\/td><td><a href=\"https:\/\/en.opensuse.org\/Portal:Kubic\" data-type=\"URL\" data-id=\"https:\/\/en.opensuse.org\/Portal:Kubic\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/en.opensuse.org\/Portal:Kubic<\/a><\/td><\/tr><tr><td>Using Combustion with MicroOS for first boot \/ setup<\/td><td><a href=\"https:\/\/en.opensuse.org\/Portal:MicroOS\/Combustion\" data-type=\"URL\" data-id=\"https:\/\/en.opensuse.org\/Portal:MicroOS\/Combustion\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/en.opensuse.org\/Portal:MicroOS\/Combustion<\/a><\/td><\/tr><tr><td>Micro OS Portal<\/td><td><a href=\"https:\/\/en.opensuse.org\/Portal:MicroOS\" data-type=\"URL\" data-id=\"https:\/\/en.opensuse.org\/Portal:MicroOS\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/en.opensuse.org\/Portal:MicroOS<\/a><\/td><\/tr><tr><td>Manual Network setup \/ wicked &#8211; OpenSuSE<br>This is for Leap, but also applies to MicroOS<\/td><td><a href=\"https:\/\/doc.opensuse.org\/documentation\/leap\/reference\/html\/book-opensuse-reference\/cha-network.html#sec-network-manconf\" data-type=\"URL\" data-id=\"https:\/\/doc.opensuse.org\/documentation\/leap\/reference\/html\/book-opensuse-reference\/cha-network.html#sec-network-manconf\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/doc.opensuse.org\/documentation\/leap\/reference\/html\/book-opensuse-reference\/cha-network.html#sec-network-manconf<\/a><\/td><\/tr><tr><td>OpenSuSE Managing GPIOs with libgpiod and tools<\/td><td><a href=\"https:\/\/en.opensuse.org\/openSUSE:GPIO#direction:_choose_input_or_output_pin\" data-type=\"URL\" data-id=\"https:\/\/en.opensuse.org\/openSUSE:GPIO#direction:_choose_input_or_output_pin\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/en.opensuse.org\/openSUSE:GPIO#direction:_choose_input_or_output_pin<\/a><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Installation<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Download the required Version from <a rel=\"noreferrer noopener\" href=\"https:\/\/en.opensuse.org\/Portal:Kubic\" target=\"_blank\">Kubic Portal<\/a><br>Copy to a suitable MicroSD card, using the procedures outlined on the linked site.<br><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Create USB stick with combustion\/ignititon &#8211;&gt; combustion script used<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Get a USB stick, make sure it has sufficient space, a supported Filesystem (I used vfat but e.g. ext4 also works) and the filesystem has a label named &#8222;combustion&#8220;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Create the following folders and files :<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/combustion\n\/combustion\/script\n\/combustion\/routes\n\/combustion\/ifcfg-eth0<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Content of the &#8222;script&#8220; file :<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#!\/bin\/bash\n# combustion: network\n# Redirect output to the console\nexec &gt; &gt;(exec tee -a \/dev\/tty0) 2&gt;&amp;1\n# Install network config files\ncp ifcfg-eth0 routes \/etc\/sysconfig\/network\nchmod 644 \/etc\/sysconfig\/network\/ifcfg-eth0\nchmod 644 \/etc\/sysconfig\/network\/routes\nsystemctl restart network\n# Set a password for root, generate the hash with \"openssl passwd -6\"\necho  'root:SomeHashofPasswordHere' | chpasswd -e\nsystemctl enable sshd.service\n# Install vim-small\nzypper --non-interactive install vim-small\n# Leave a marker\necho \"Configured with combustion for Homegear\" &gt; \/etc\/issue.d\/combustion<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Content of &#8222;ifcfg-eth0&#8220; file :<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>STARTMODE='auto'\nBOOTPROTO='static'\nIPADDR='192.168.2.222\/24'<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Content of &#8222;routes&#8220; file &#8211; replace IP address with your gateway\/router :<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>default 192.168.1.1 - eth0<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">You can add other first boot setup steps to the script, that you think are useful.<br><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Additional Software installed using transactional-update<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>Packages : \nrpi-eeprom-config\nlibgpiod-utils\npython3-gpiod\nlibgpiod2\nopenSUSE-release-appliance-docker\nyast2-docker\nzypper-docker\nyast2<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">RS485 Module connection and config<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-background\" style=\"background-color:#f3f4f5\"><thead><tr><th>&#8211; RS485 Module Pin<\/th><th>RasPi 3 b+<br>GPIO connector pin#<\/th><th>Function<\/th><th>GPIO #<br>Homegear, raspi-gpio<\/th><th>UART tty device<\/th><\/tr><\/thead><tbody><tr><td>RO<\/td><td>10<\/td><td>RxD1 alt=5<\/td><td>15<\/td><td>ttyAMA0<\/td><\/tr><tr><td>RE-<\/td><td>31<\/td><td>OUTPUT pull=NONE<\/td><td>6<\/td><td><\/td><\/tr><tr><td>DE<\/td><td>29<\/td><td>OUTPUT pull=NONE<\/td><td>5<\/td><td><\/td><\/tr><tr><td>DI<\/td><td>8<\/td><td>TxD1 alt=5<\/td><td>14<\/td><td>ttyAMA0<\/td><\/tr><tr><td>VCC<\/td><td>4<\/td><td>+5V<\/td><td><\/td><td><\/td><\/tr><tr><td>GND<\/td><td>6<\/td><td>GND<\/td><td><\/td><td><\/td><\/tr><tr><td>A<\/td><td>None<\/td><td>A &#8211; RS485<\/td><td><\/td><td><\/td><\/tr><tr><td>B<\/td><td>None<\/td><td>B &#8211; RS485<\/td><td><\/td><td><\/td><\/tr><\/tbody><\/table><figcaption>RS485 Module connection to Raspi GPIO pins<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Adjust Memory Map permissions<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">A kernel parameter needs to be added to allow the software to memory map \/dev\/mem or some of the tools below won&#8217;t work and give an mmap error.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">in \/etc\/default\/grub change the following (comment original and copy and modify) :<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#GRUB_CMDLINE_LINUX_DEFAULT=\"quiet systemd.show_status=yes console=ttyS0,115200n8 console=tty0 net.ifnames=0 \\$ignition_firstboot ignition.platform.id=metal\"\nGRUB_CMDLINE_LINUX_DEFAULT=\"quiet systemd.show_status=yes console=tty0 net.ifnames=0 iomem=relaxed\"<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The important part is the added &#8222;iomem=relaxed&#8220; and notice that we removed ttyS0 as serial console, which is also important to avoid later issues with the serial UART.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">On Kubic, you need to call transactional update for the kernel command line changes to apply :<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>transactional-update grub.cfg<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Note : If you do multiple updates and changes at once, you might need the option &#8211;continue<\/p>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-8f761849 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis:100%\">\n<h2 class=\"wp-block-heading\">Raspi 3 b+ GPIO pins and UART \/ serial devices<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Raspberry Pi 3 b+ has 2 serial devices. <br>There is a PL011 and a mini UART. The later has only reduced capabilities.<br>Unfortunately, compared to the Raspi 2, these 2 devices are switched primary \/ secondary.<br>Furthermore, Blootooth is by default occuppying the PL011 UART, which is another cause of issues.<br>In some cases, by default, only the mini UART is available on GPIO Pins 8 and 10.<br>The mini UART does not work properly for the RS485 module.<br>Therefore, the GPIO settings have to be changed so that the PL011 UART uses the GPIO pins and the best is to disable BT.<\/p>\n\n\n\n<h6 class=\"wp-block-heading\">Additional details can be found here<\/h6>\n\n\n\n<p class=\"wp-block-paragraph\">UART configuration RasPi : <a rel=\"noreferrer noopener\" href=\"https:\/\/www.raspberrypi.org\/documentation\/configuration\/uart.md\" data-type=\"URL\" data-id=\"https:\/\/www.raspberrypi.org\/documentation\/configuration\/uart.md\" target=\"_blank\">https:\/\/www.raspberrypi.org\/documentation\/configuration\/uart.md<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">RasPi GPIO Howto : <a href=\"http:\/\/raspberrypiguide.de\/howtos\/raspberry-pi-gpio-how-to\/\" data-type=\"URL\" data-id=\"http:\/\/raspberrypiguide.de\/howtos\/raspberry-pi-gpio-how-to\/\" target=\"_blank\" rel=\"noreferrer noopener\">http:\/\/raspberrypiguide.de\/howtos\/raspberry-pi-gpio-how-to\/<\/a><\/p>\n<\/div>\n<\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Diable any getty on ttyS0<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">To avoid later issues, any getty running on ttyS0 or ttyAMA* needs to be disabled.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>chkconfig | grep getty<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Typically with Kubic, there is a getty running on ttyS0 but not ttyAMA*<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>systemctl disable serial-getty@ttyS0.service\nsystemctl stop serial-getty@ttyS0.service<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Make sure, you don&#8217;t accidentally disable the getty on tty1, or otherwise you won&#8217;t be able to login from the console.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Optional, I have added another getty to tty0 to have a second login on the virtual console.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For this, you need to do a few teps on Kubic, using the transactiona update :<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>transactional-update shell\ncd \/usr\/lib\/systemd\/system\ncp -a <strong>getty<\/strong>@tty1.service.d <strong>getty<\/strong>@tty0.service.d\nexit\nsystemctl start getty@tty0\nsystemctl enable getty@tty0<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Now reboot to update the snapshot.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Compile raspi-gpio from sources for Micro-OS<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Install raspi-gpio from github sources : <a href=\"https:\/\/github.com\/RPi-Distro\/raspi-gpio.git\" data-type=\"URL\" data-id=\"https:\/\/github.com\/RPi-Distro\/raspi-gpio.git\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/github.com\/RPi-Distro\/raspi-gpio.git<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I have not found a similar tool to manage device alternate functions. <br>Since I did not find that tool as a rpm package, I had to compile the latest revision from sources.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If you do opt out to install this tool, it will make it more difficult to troubleshoot any GPIO \/ UART related issues.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Dependencies : git, make, automake, gcc, &#8230;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cd #Change to Root Home\ngit clone https:\/\/github.com\/RPi-Distro\/raspi-gpio\ncd raspi-gpio\n.\/configure #fails if you did not change the kernel parameters above\nmake\n#make install #installed binary manual in \/usr\/local\/bin\nmv raspi-gpio \/usr\/local\/bin\n#Remove raspi-gpio source and build files for cleanup<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Normally, on a Raspi 3, the serial0 is on GPIOs 32 and 33 while serial1 is on GPIOs 14 and 15.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>raspi-gpio get #check the output for GPIO 32,33,14 and 15<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Here is the compiled file for convenience, might not run on your version and you might need to compile it yourself, using the above procedure.<\/p>\n\n\n\n<div class=\"wp-block-file\"><a href=\"https:\/\/robert-metzler.com\/wp-content\/uploads\/2021\/08\/raspi-gpio.zip\">raspi-gpio<\/a><a href=\"https:\/\/robert-metzler.com\/wp-content\/uploads\/2021\/08\/raspi-gpio.zip\" class=\"wp-block-file__button\" download>Herunterladen<\/a><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Modify RasPi configuration for GPIOs,UARTs and Serial devices<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Set as needed for our homegear setup.<\/p>\n\n\n\n<h6 class=\"wp-block-heading\">Change the UART usage in config.txt<\/h6>\n\n\n\n<p class=\"wp-block-paragraph\">Modifications to config.txt are required to fix the UART configuration for homegear.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">On OpenSuSE MicroOS it is recommended to use extraconfig.txt for any custom changes to be save for updates.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>transactional-update shell\nvi \/boot\/vc\/extraconfig.txt <\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\" id=\"block-b304af50-c0ed-476a-baa6-a894c744b4af\"><br>Edit the extraconfig.txt file (should be empty normally) and add the following lines :<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#Make sure UART is enable \nenable_uart=1 \n\n&#91;pi3]\n\n# Use miniUART for BT\/WiFi and free the UART for RS485 module \n#dtoverlay=pi3-miniuart-bt \ndtoverlay=disable-bt \n\n&#91;all]\n\ndtparam=spi=on \ndtparam=i2c_arm=on<\/code><\/pre>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>Remark : <br>I had issues with using &#8222;pi3-miniuart-bt&#8220;, which occationally worked, providing ttyAMA1 (!!) as devicefile for the PL011 UART.<br>However, suddenly this stopped working and I had no ttyAMA* at all anymore. The ttyAMA1 disapeared suddenly at a reboot after an update. A rollback did not bring it back, so I have no idea what caused this. Maybe some Raspi Firmware update that can not be rolled back with transactional-update.<br>The only way making this consistently work, was using &#8222;disable-bt&#8220;, which is not a big issue, because BlueTooth shouldn&#8217;t be used used anyway.<br>Disabling BT brings back the PL011 UART, but now as ttyAMA0, which I am using further in this article.<\/p><\/blockquote>\n\n\n\n<p class=\"wp-block-paragraph\">Copy file :<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cp \/boot\/vc\/extraconfig.txt \/boot\/efi\/extraconfig.txt<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Exit the transactional update shell and complete the changes with a reboot<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>exit\n\nPlease reboot your machine to activate the changes and avoid data loss. \nNew default snapshot is #13 (\/.snapshots\/13\/snapshot). \ntransactional-update finished\n\nreboot<\/code><\/pre>\n\n\n\n<h6 class=\"wp-block-heading\">Set the DE\/RE pins for the RS485 module<\/h6>\n\n\n\n<pre class=\"wp-block-code\"><code>raspi-gpio set 5 op pn dh\nraspi-gpio set 6 op pn dl<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Homegear Docker Image installation<\/h2>\n\n\n\n<h6 class=\"wp-block-heading\">Useful Homegear Links<\/h6>\n\n\n\n<figure class=\"wp-block-table is-style-regular\"><table><thead><tr><th>Topic<\/th><th>Link<\/th><\/tr><\/thead><tbody><tr><td>Homegear<\/td><td><a href=\"https:\/\/homegear.eu\/\" data-type=\"URL\" data-id=\"https:\/\/homegear.eu\/\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/homegear.eu\/<\/a><\/td><\/tr><tr><td>Docker<\/td><td><a href=\"https:\/\/www.docker.com\/\" data-type=\"URL\" data-id=\"https:\/\/www.docker.com\/\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/www.docker.com\/<\/a><\/td><\/tr><tr><td>Homegear \/ Docker<\/td><td><a href=\"https:\/\/hub.docker.com\/r\/homegear\/homegear\/\" data-type=\"URL\" data-id=\"https:\/\/hub.docker.com\/r\/homegear\/homegear\/\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/hub.docker.com\/r\/homegear\/homegear\/<\/a><\/td><\/tr><tr><td><\/td><td><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h6 class=\"wp-block-heading\">Homegear user<\/h6>\n\n\n\n<p class=\"wp-block-paragraph\">Create a home directory \/srv\/homegear<br>Create a group for homegear<br>Create a user &#8222;homegear&#8220; for homegear with the group and home above, set password<br>Add homegear user to additional groups : tty, dialout, docker<\/p>\n\n\n\n<h6 class=\"wp-block-heading\">Configure systemd docker service<\/h6>\n\n\n\n<p class=\"wp-block-paragraph\">Change the timeout for the docker service, because startup might take some time.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>transactional-update run vi \/usr\/lib\/systemd\/system\/docker.service<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Add the following timeout to the [Service] section.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>TimeoutSec=900<\/code><\/pre>\n\n\n\n<h6 class=\"wp-block-heading\">Docker image<\/h6>\n\n\n\n<p class=\"wp-block-paragraph\">Get homegear docker image, create container and run it.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>su - homegear\nmkdir homegear-data\n\ndocker pull homegear\/homegear\n\ndocker container create --privileged --stop-timeout 300 --restart always -v \/srv\/homegear\/homegear-data\/etc:\/etc\/homegear:Z -v \/srv\/homegear\/homegear-data\/lib:\/var\/lib\/homegear:Z -v \/srv\/homegear\/homegear-data\/log:\/var\/log\/homegear:Z -e TZ=Europe\/Berlin -e HOST_USER_ID=1201 -e HOST_USER_GID=1200 -p 2001:2001 -p 2002:2002 -p 2003:2003 -p 2004:2004 --device=\/dev\/ttyAMA0 --name homegear homegear\/homegear\n\ndocker start homegear<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Copy raspi-gpio :<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cp \/usr\/local\/bin\/raspi-gpio \/srv\/homegear\/homegear-data\/etc<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Modify \/srv\/homegear\/homegear-data\/etc\/homegear-start.sh<br>&#8230; add the lines for adding tty group for tty permissions for homegear<br>&#8230; add the lines for modifying gpio ports<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Code of homegear-start.sh.sh with modifications, remember the directory mappings : \/srv\/homegear\/homegear-data\/etc:\/etc\/homegear  &#8211; so, raspi-gpio is to be found there !<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#!\/bin\/bash\n\n# This script is executed before Homegear starts.\n\n#Add group tty to homegear user, to access tty device\nusermod -G tty,dialout homegear\n\n#Modify GPIO settings to use proper tty on RasPi3\n#Set the GPIOs 32 and 33 as Input and remove the serial functionality\n\/etc\/homegear\/raspi-gpio set 32 ip pn\n\/etc\/homegear\/raspi-gpio set 33 ip pn\n#Change GPIO 14 and 15 from serial1 to serial0 (to use advanced PL011)\n\/etc\/homegear\/raspi-gpio set 14 a0 pn\n\/etc\/homegear\/raspi-gpio set 15 a0 pn\n\n# Set permissions on interfaces and directories, export GPIOs.\n\/usr\/bin\/homegear -u homegear -g homegear -p \/var\/run\/homegear\/homegear.pid -pre<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Restart docker image<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>docker restart homegear<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Connect to homegear and search actors<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>docker exec -i homegear homegear -r<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Use homegear interactive commands to search for actors and configure homegear.<br>Enter &#8222;help&#8220; for help.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">See homegear documentation in the links table at the top of this article.<br><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Abstract This article is about how to setup an homegear server for controlling Homematic wired homeautomation components, replacing or complementing a CCU2\/3. Results and conclusions first &#8230; After running homegear with an non docker direct installation on Ubuntu for several years with good experience, but having sometimes a hard time with updates, I thought I &hellip; <a href=\"https:\/\/www.robert-metzler.com\/?p=200\" class=\"more-link\"><span class=\"screen-reader-text\">\u201eBuilding a Raspberry Pi 3 b+ based homegear server using openSuse Kubic and Docker\u201c <\/span>weiterlesen<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,53,12,11,6,10,51,9,55,52],"tags":[56,57,60,59,58,61],"class_list":["post-200","post","type-post","status-publish","format-standard","hentry","category-computer-electronics","category-docker","category-homegear","category-homematic","category-linux","category-openhab","category-raspberrypi","category-rs485","category-suse-kubic","category-suse-microos","tag-homegesr","tag-homematic","tag-homematicwired","tag-raspberrypi","tag-raspi","tag-rs485"],"_links":{"self":[{"href":"https:\/\/www.robert-metzler.com\/index.php?rest_route=\/wp\/v2\/posts\/200","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.robert-metzler.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.robert-metzler.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.robert-metzler.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.robert-metzler.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=200"}],"version-history":[{"count":60,"href":"https:\/\/www.robert-metzler.com\/index.php?rest_route=\/wp\/v2\/posts\/200\/revisions"}],"predecessor-version":[{"id":377,"href":"https:\/\/www.robert-metzler.com\/index.php?rest_route=\/wp\/v2\/posts\/200\/revisions\/377"}],"wp:attachment":[{"href":"https:\/\/www.robert-metzler.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=200"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.robert-metzler.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=200"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.robert-metzler.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=200"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}