<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>home automation Archives - gj</title>
	<atom:link href="https://blog.gaiterjones.com/tag/home-automation/feed/" rel="self" type="application/rss+xml" />
	<link>https://blog.gaiterjones.com/tag/home-automation/</link>
	<description>gaiterjones</description>
	<lastBuildDate>Fri, 02 Jun 2017 13:23:37 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.4.3</generator>
	<item>
		<title>How to run FHEM as a Docker Container on a Raspberry Pi</title>
		<link>https://blog.gaiterjones.com/how-to-run-fhem-as-a-docker-container-on-a-raspberry-pi/</link>
					<comments>https://blog.gaiterjones.com/how-to-run-fhem-as-a-docker-container-on-a-raspberry-pi/#comments</comments>
		
		<dc:creator><![CDATA[PAJ]]></dc:creator>
		<pubDate>Wed, 31 May 2017 17:58:27 +0000</pubDate>
				<category><![CDATA[Docker]]></category>
		<category><![CDATA[Home Automation]]></category>
		<category><![CDATA[Raspberry Pi]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[docker]]></category>
		<category><![CDATA[fhem]]></category>
		<category><![CDATA[home automation]]></category>
		<category><![CDATA[raspberry pi]]></category>
		<guid isPermaLink="false">http://blog.gaiterjones.com/?p=1640</guid>

					<description><![CDATA[I use FHEM as the engine for home automation tasks on my Raspberry Pi. This is how to build and run FHEM as a container in Docker on your Raspberry...<a class="more-link" href="https://blog.gaiterjones.com/how-to-run-fhem-as-a-docker-container-on-a-raspberry-pi/" title="Continue reading">Continue reading</a>]]></description>
										<content:encoded><![CDATA[<p>I use <a href="http://fhem.de">FHEM</a> as the engine for home automation tasks on my Raspberry Pi. This is how to build and run FHEM as a container in Docker on your Raspberry Pi Zero, Pi2 or Pi3.</p>
<p><img decoding="async" src="https://blog.gaiterjones.com/dropbox/docker-fhem-container-installation.gif" alt="fhem docker container installation" class="aligncenter" /></p>
<h1>Install Docker</h1>
<p>Installing Docker is a no brainer</p>
<pre class="brush: plain; title: ; notranslate">
curl -sSL get.docker.com | sh
sudo usermod your-username -aG docker
reboot
</pre>
<h1>Install docker-compose</h1>
<p>Docker-compose makes building, starting and stopping Docker containers really simple.</p>
<pre class="brush: plain; title: ; notranslate">
apt-get -y install python-pip
pip install docker-compose
</pre>
<h1>Build the container</h1>
<p>Pull the container build files from github and run docker-compose build to build the container image.</p>
<pre class="brush: plain; title: ; notranslate">
git clone https://github.com/gaiterjones/docker-rpi-fhem
cd docker-rpi-fhem
docker-compose build
</pre>
<h1>Start the container</h1>
<pre class="brush: plain; title: ; notranslate">
docker-compose up -d
</pre>
<h1>Connect to FHEM</h1>
<p>Enter the following url into your browser to connect to FHEM.</p>
<p><strong>http://my.pi:8803/fhem</strong></p>
<p>Update FHEM by entering with the <em>update </em>command.<br />
Restart FHEM by entering the <em>shutdown restart</em> command.</p>
<p>FHEM is now running and up to date.</p>
<p>You can start configuring it or copy your existing FHEM config or editing the <em>fhem.cfg</em> file in <em>./fhem</em>. This is a Docker volume on the host mapped to <em>/opt/fhem</em> in the container. Docker host volumes will persist when you bring down the container (docker-compose down) or clear the volume caches (docker-compose down -v) so you will not lose your configuration or logs when the container restarts or is rebuilt.</p>
<h1>Customising</h1>
<p>Take a look at docker-compose.yml</p>
<pre class="brush: plain; title: ; notranslate">
# RPI
# FHEM CONTAINER
#
version: &quot;3&quot;

services:
    server:
        build: ./build/
        hostname: fhem
        domainname: home.com
        privileged: true
        ports:
          - &quot;8083:8083&quot;
          - &quot;7072:7072&quot;
        expose:
            - 8083
            - 7072
        volumes:
            - ./fhem:/opt/fhem
            #- /dev/ttyUSB0:/dev/ttyUSB0
        networks:
            - server
        restart: always
        healthcheck:
           test: &#x5B;&quot;CMD-SHELL&quot;, &quot;echo 'QUIT' | nc -w 5 localhost 7072 &gt; /dev/null 2&gt;&amp;1 &amp;&amp; echo 'FHEM OK'&quot;]
           interval: 15m
           timeout: 10s
           retries: 3
networks:
    server:
</pre>
<p>You can see we are configuring global ports 8083 and 7072 on the host as well as exposing them on the container. I have an SSL certificate installed on my Pi and use Nginx as a frontend proxy to my Docker containers, this lets me connect to FHEM using SSL</p>
<p><strong>https://my.pi/fhem</strong></p>
<p>To remove the global host ports delete or comment out the ports config leaving just the expose config. Nginx can be configured to proxy to fhem using the following configuration:</p>
<pre class="brush: plain; title: ; notranslate">
# FHEM
location /fhem {
  proxy_pass http://fhem_container_1:8083/fhem;
}
</pre>
<p>The container runs in privileged mode which gives it access to the hosts hardware and devices. If you are using external USB devices connected to the Pi you must add them as a volume in the container i.e.</p>
<p><strong>&#8211; /dev/ttyUSB0:/dev/ttyUSB0</strong></p>
<p>Make sure the fhem user running in the container has the same user id as your host user, in this case uid 1001.</p>
<pre class="brush: plain; title: ; notranslate">	 	 
user@raspberrypi:/dev# id your-user-name	 	 
uid=1001(your-user-name) gid=1001(your-user-name) groups=1001(your-user-name),27(sudo),996(docker)	 	 
</pre>
<p>This will ensure there are no permission problems when the container tries to access devices on the host.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.gaiterjones.com/how-to-run-fhem-as-a-docker-container-on-a-raspberry-pi/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
	</channel>
</rss>
