Site updated at 2016-08-22 08:21:42 UTC

This commit is contained in:
Travis CI 2016-08-22 08:21:43 +00:00
parent f9d65cbe57
commit 4acb07bf8e
559 changed files with 18878 additions and 21688 deletions

View file

@ -93,11 +93,11 @@
<ul class="tags unstyled">
<li><a class='category' href='/blog/categories/owntracks/'>OwnTracks</a></li>
<li>OwnTracks</li>
<li><a class='category' href='/blog/categories/presence-detection/'>Presence-Detection</a></li>
<li>Presence-Detection</li>
<li><a class='category' href='/blog/categories/ibeacons/'>iBeacons</a></li>
<li>iBeacons</li>
</ul>
@ -136,17 +136,15 @@
<p>You tell HomeAssistant about fixed locations by creating a Zone with the longitude and latitude of your beacon. You should also give the zone a name which you will also use when you set up OwnTracks. An an example this zone specifies the location of my drive way.</p>
<p><strong>Example <code>configuration.yaml</code> entry</strong></p>
<p><strong>Example <code class="highlighter-rouge">configuration.yaml</code> entry</strong></p>
<div class="highlighter-coderay"><div class="CodeRay">
<div class="code"><pre>
<span class="key">zone</span>:
- <span class="string"><span class="content">name: 'Drive'</span></span>
<span class="key">latitude</span>: <span class="string"><span class="content">XXX</span></span>
<span class="key">longitude</span>: <span class="string"><span class="content">YYY</span></span>
<span class="key">radius</span>: <span class="string"><span class="content">100</span></span>
</pre></div>
</div>
<div class="language-yaml highlighter-rouge"><pre class="highlight"><code>
<span class="s">zone</span><span class="pi">:</span>
<span class="pi">-</span> <span class="s">name</span><span class="pi">:</span> <span class="s1">'</span><span class="s">Drive'</span>
<span class="s">latitude</span><span class="pi">:</span> <span class="s">XXX</span>
<span class="s">longitude</span><span class="pi">:</span> <span class="s">YYY</span>
<span class="s">radius</span><span class="pi">:</span> <span class="s">100</span>
</code></pre>
</div>
<p>The radius isnt used by the beacon code, but it is used by the GPS location sensing code. Ill come back to this a little later. For now just use 50 or 100.</p>
@ -157,13 +155,13 @@
<ol>
<li>Go to the OwnTracks app on your phone</li>
<li>Touch the <code>Regions</code> menu at the bottom of the screen</li>
<li>Touch the <code>+</code> symbol at the top right of the screen</li>
<li>Give the beacon a name e.g. <code>-drive</code> (start the name with a <code>-</code> see below for the reason)</li>
<li>Turn Share to <code>On</code></li>
<li>Skip the <code>Circular Region</code> section</li>
<li>Enter the <code>UUID</code> of your beacon - this may be written on your beacon - or you can copy it from the management app that came with your iBeacon device. Its a long number so its easier to copy if you can!</li>
<li>Enter the <code>Minor</code> and <code>Major</code> numbers for your iBeacon - or leave them at 0 which will match all beacons with that <code>UUID</code></li>
<li>Touch the <code class="highlighter-rouge">Regions</code> menu at the bottom of the screen</li>
<li>Touch the <code class="highlighter-rouge">+</code> symbol at the top right of the screen</li>
<li>Give the beacon a name e.g. <code class="highlighter-rouge">-drive</code> (start the name with a <code class="highlighter-rouge">-</code> see below for the reason)</li>
<li>Turn Share to <code class="highlighter-rouge">On</code></li>
<li>Skip the <code class="highlighter-rouge">Circular Region</code> section</li>
<li>Enter the <code class="highlighter-rouge">UUID</code> of your beacon - this may be written on your beacon - or you can copy it from the management app that came with your iBeacon device. Its a long number so its easier to copy if you can!</li>
<li>Enter the <code class="highlighter-rouge">Minor</code> and <code class="highlighter-rouge">Major</code> numbers for your iBeacon - or leave them at 0 which will match all beacons with that <code class="highlighter-rouge">UUID</code></li>
</ol>
<p class="img">
@ -178,7 +176,7 @@
<p>When OwnTracks sees the beacon (and turns the region red), it also sends an MQTT packet to HA to say that you have entered that region.</p>
<p>The result of the configuration above would be to set the location of device.phone to <code>Drive</code> , (and the GPS location to XXX,YYY) when your phone sees the beacon.</p>
<p>The result of the configuration above would be to set the location of device.phone to <code class="highlighter-rouge">Drive</code> , (and the GPS location to XXX,YYY) when your phone sees the beacon.</p>
<p>So with the steps above you should be able to improve the reliability of tracking your phone - and send timely updates to HA. I did this for my home - and the lights now turn on before I reach the house on foot. If I arrive by car they turn on within a few seconds of arriving, before I can get to the front door.</p>
@ -190,27 +188,25 @@
<p>However you can also use beacons for situations where GPS doesnt work well.</p>
<p>This might be because the zones are too close together - or even on top of each other!<br />
<p>This might be because the zones are too close together - or even on top of each other!
For example, my wife works next door - and I couldnt detect whether shes at home or in the office via GPS because the accuracy wasnt high enough. However I can do this by using two beacons.</p>
<p>To make this type of presence detection work you need to turn GPS off for a zone in Home Assistant by making them <code>passive</code>. This is important because otherwise HA will try to decide between two close together zones without enough data. This doesnt work well.</p>
<p>To make this type of presence detection work you need to turn GPS off for a zone in Home Assistant by making them <code class="highlighter-rouge">passive</code>. This is important because otherwise HA will try to decide between two close together zones without enough data. This doesnt work well.</p>
<p>A passive zone can only be entered via an iBeacon, so a GPS location update will always pick the other zone.</p>
<p>I set up my Home zone to be a standard region, and my office zone to be passive, so the home zone can be entered in the normal way via either GPS or a Beacon.</p>
<p><strong>Example <code>configuration.yaml</code> entry</strong></p>
<p><strong>Example <code class="highlighter-rouge">configuration.yaml</code> entry</strong></p>
<div class="highlighter-coderay"><div class="CodeRay">
<div class="code"><pre>
<span class="key">zone</span>:
- <span class="string"><span class="content">name: 'Office'</span></span>
<span class="key">latitude</span>: <span class="string"><span class="content">XXX</span></span>
<span class="key">longitude</span>: <span class="string"><span class="content">YYY</span></span>
<span class="key">radius</span>: <span class="string"><span class="content">3</span></span>
<span class="key">passive</span>: <span class="string"><span class="content">true</span></span>
</pre></div>
</div>
<div class="language-yaml highlighter-rouge"><pre class="highlight"><code>
<span class="s">zone</span><span class="pi">:</span>
<span class="pi">-</span> <span class="s">name</span><span class="pi">:</span> <span class="s1">'</span><span class="s">Office'</span>
<span class="s">latitude</span><span class="pi">:</span> <span class="s">XXX</span>
<span class="s">longitude</span><span class="pi">:</span> <span class="s">YYY</span>
<span class="s">radius</span><span class="pi">:</span> <span class="s">3</span>
<span class="s">passive</span><span class="pi">:</span> <span class="s">true</span>
</code></pre>
</div>
<p>You could use this technique to try to detect which room someone is in. This might allow you to notice whether someone is in the living room or the bedroom - even though one is above the other (although beacon packets do pass through walls and floors).</p>
@ -229,18 +225,18 @@ For example, my wife works next door - and I couldnt detect whether shes a
<h4><a class="title-link" name="connections-and-disconnecting" href="#connections-and-disconnecting"></a> Connections and disconnecting</h4>
<p>Owntracks treats a region name with a leading <code>-</code> as a hint that it shouldnt disconnect after a single missed packet. This improves the ability to keep a connection to a beacon.</p>
<p>Owntracks treats a region name with a leading <code class="highlighter-rouge">-</code> as a hint that it shouldnt disconnect after a single missed packet. This improves the ability to keep a connection to a beacon.</p>
<p>However, even when using this feature Ive noticed that you can still lose connections (although it seems to vary by beacon manufacturer and type - Ill talk more about this in <em>part 2</em>). This means that its best to take into account that you may see false enter/leave events in HA. You may be able to improve this by changing how often the beacons send packets - and by increasing the signal strength (both will drain your beacon batteries more quickly). You can usually change these parameters in the app supplied by the iBeacon maker. You can also find some high power beacons (which have worked well for me).</p>
<p>In automations you can use a <code>for:</code> to avoid triggering during a brief disconnect, or use a script with a delay. Stay tuned for <em>part 2</em> for an example of this.</p>
<p>In automations you can use a <code class="highlighter-rouge">for:</code> to avoid triggering during a brief disconnect, or use a script with a delay. Stay tuned for <em>part 2</em> for an example of this.</p>
<h4><a class="title-link" name="using-multiple-beacons-for-the-same-zone" href="#using-multiple-beacons-for-the-same-zone"></a> Using Multiple beacons for the same Zone</h4>
<p>iBeacons have a <code>UUID</code> (usually set to the same value for beacons from the same manufacturer), as well as a <code>minor</code> and <code>major</code> number. If you set two beacons to have exactly same details then OwnTracks will think multiple beacons are at the same location.</p>
<p>iBeacons have a <code class="highlighter-rouge">UUID</code> (usually set to the same value for beacons from the same manufacturer), as well as a <code class="highlighter-rouge">minor</code> and <code class="highlighter-rouge">major</code> number. If you set two beacons to have exactly same details then OwnTracks will think multiple beacons are at the same location.</p>
<p>This means you can have more than one beacon around your home - and a connection to any of them will count as <code>home</code> to OwnTracks and HA. This reduces disconnections.</p>
<p>This means you can have more than one beacon around your home - and a connection to any of them will count as <code class="highlighter-rouge">home</code> to OwnTracks and HA. This reduces disconnections.</p>
<p>You can achieve the same effect by using the same the same <code>UUID</code> but different <code>major</code> / <code>minor</code> numbers - and tell OwnTracks not to worry about the <code>minor</code> / <code>major</code> numbers for a particular region by setting them to 0).</p>
<p>You can achieve the same effect by using the same the same <code class="highlighter-rouge">UUID</code> but different <code class="highlighter-rouge">major</code> / <code class="highlighter-rouge">minor</code> numbers - and tell OwnTracks not to worry about the <code class="highlighter-rouge">minor</code> / <code class="highlighter-rouge">major</code> numbers for a particular region by setting them to 0).</p>
<p><em>Make sure to also check out <a href="/blog/2016/05/26/ibeacons-how-to-track-things-that-cant-track-themselves-part-ii/">part II</a> where I talk about how to use iBeacons to track any object.</em></p>
</article>
@ -316,7 +312,7 @@ For example, my wife works next door - and I couldnt detect whether shes a
<li class="post">
<a href="/blog/2016/08/13/foursquare-fast-com-ffmpeg-gpsd/">0.26: Foursquare, Fast.com, FFMPEG and GPSD</a>
<a href="/blog/2016/08/13/foursquare-fast.com-ffmpeg-gpsd/">0.26: Foursquare, Fast.com, FFMPEG and GPSD</a>
</li>