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

@ -4,7 +4,7 @@
<title><![CDATA[Category: Device-Tracking | Home Assistant]]></title>
<link href="https://home-assistant.io/blog/categories/device-tracking/atom.xml" rel="self"/>
<link href="https://home-assistant.io/"/>
<updated>2016-08-22T07:26:42+00:00</updated>
<updated>2016-08-22T08:20:27+00:00</updated>
<id>https://home-assistant.io/</id>
<author>
<name><![CDATA[Home Assistant]]></name>
@ -18,153 +18,152 @@
<link href="https://home-assistant.io/blog/2016/05/26/ibeacons-how-to-track-things-that-cant-track-themselves-part-ii/"/>
<updated>2016-05-26T11:06:12+00:00</updated>
<id>https://home-assistant.io/blog/2016/05/26/ibeacons-how-to-track-things-that-cant-track-themselves-part-ii</id>
<content type="html"><![CDATA[<p><em>This post is by Home Assistant contributor <a href="https://github.com/pavoni">Greg Dowling</a>.</em></p>
<content type="html"><![CDATA[_This post is by Home Assistant contributor [Greg Dowling](https://github.com/pavoni)._
<p>In <a href="/blog/2016/04/30/ibeacons-part-1-making-presence-detection-work-better">Part 1</a> I talked about using iBeacons to improve presence tracking. In part 2 Ill talk about how to track things like keys that cant track themselves by using iBeacons.</p>
<h3><a class='title-link' name='tracking-things-using-ibeacons' href='#tracking-things-using-ibeacons'></a> Tracking things using iBeacons </h3>
<p>In the first part I mentioned that iBeacons just send out <em>Im here</em> packets, and we used this to trigger an update when your phone came close to a fixed beacon.</p>
In [Part 1](/blog/2016/04/30/ibeacons-part-1-making-presence-detection-work-better) I talked about using iBeacons to improve presence tracking. In part 2 Ill talk about how to track things like keys that cant track themselves by using iBeacons.
<p>But beacons dont have to be fixed.</p>
### <a class='title-link' name='tracking-things-using-ibeacons' href='#tracking-things-using-ibeacons'></a> Tracking things using iBeacons
In the first part I mentioned that iBeacons just send out *Im here* packets, and we used this to trigger an update when your phone came close to a fixed beacon.
<p>Your phone knows roughly where it is located (based on mobile phone masts, Wi-Fi networks or GPS). If your phone sees an <em>Im here</em> message then it knows the beacon is close.</p>
But beacons dont have to be fixed.
<p>If your phone can remember (or tell a server) where it was when it last saw the iBeacon - then it knows where the beacon was. So the result of this is that you can track where an iBeacon was - even though the iBeacon doesnt have any tracking technology itself.</p>
Your phone knows roughly where it is located (based on mobile phone masts, Wi-Fi networks or GPS). If your phone sees an *Im here* message then it knows the beacon is close.
<p>So if you put an iBeacon on your keys or in your car - then you can track them.</p>
If your phone can remember (or tell a server) where it was when it last saw the iBeacon - then it knows where the beacon was. So the result of this is that you can track where an iBeacon was - even though the iBeacon doesn't have any tracking technology itself.
<p class="img">
<img width="200" src="https://home-assistant.io/images/blog/2016-05-ibeacons/keys_with_beacon.jpg" />
So if you put an iBeacon on your keys or in your car - then you can track them.
<p class='img'>
<img width='200' src='https://home-assistant.io/images/blog/2016-05-ibeacons/keys_with_beacon.jpg'>
Here are my keys - with a Estimote Nearable iBeacon stuck to them. Ugly but effective!
</p>
<!--more-->
<p>Its easier to set up OwnTracks and HA to track a mobile beacon than the fixed beacon I discussed in Part 1, because you only need to tell OwnTracks about your iBeacon. You dont need to configure HA at all.</p>
Its easier to set up OwnTracks and HA to track a mobile beacon than the fixed beacon I discussed in Part 1, because you only need to tell OwnTracks about your iBeacon. You dont need to configure HA at all.
<p class="note warning">OwnTracks currently only supports mobile beacons on iOS.</p>
<p class='note warning'>OwnTracks currently only supports mobile beacons on iOS.</p>
<p>You set up the beacon the same way as we discussed in part 1. The only difference is that instead of calling the region the name of a location (eg -drive) you call it the name of the device you want to track (eg -keys). Remember the leading - that makes the connection more reliable.</p>
You set up the beacon the same way as we discussed in part 1. The only difference is that instead of calling the region the name of a location (eg -drive) you call it the name of the device you want to track (eg -keys). Remember the leading - that makes the connection more reliable.
<p class="img">
<img width="200" src="https://home-assistant.io/images/blog/2016-04-ibeacons/owntracks_beacon_setup.png" />
<p class='img'>
<img width='200' src='https://home-assistant.io/images/blog/2016-04-ibeacons/owntracks_beacon_setup.png'>
</p>
<p>Once youve added the iBeacon - you should be able to see it on the OwnTracks region screen. If your phone can see the packets from that beacon, OwnTracks will turn the relevant Region red.</p>
Once youve added the iBeacon - you should be able to see it on the OwnTracks region screen. If your phone can see the packets from that beacon, OwnTracks will turn the relevant Region red.
<p>Because you turned <em>Share</em> on for the region, when OwnTracks sees the beacon it will send HA a message. HA will use this message to add the beacon as a tracked device if it hasnt seen it before. So you should see a new device appear in HA called device_tracker.beacon_[name] - and its location will be where your phone thought it was when it last saw the beacon.</p>
Because you turned *Share* on for the region, when OwnTracks sees the beacon it will send HA a message. HA will use this message to add the beacon as a tracked device if it hasnt seen it before. So you should see a new device appear in HA called device_tracker.beacon_[name] - and its location will be where your phone thought it was when it last saw the beacon.
<p class="img">
<img width="200" src="https://home-assistant.io/images/blog/2016-05-ibeacons/keys_device.png" />
<p class='img'>
<img width='200' src='https://home-assistant.io/images/blog/2016-05-ibeacons/keys_device.png'>
</p>
<p>If your phone moves and sends HA a new location while it is still in range of the beacon - HA will update the location of the beacon. So if go for a drive in your car - you will see both your phone and the <em>device_tracker.beacon_car</em> move together.</p>
If your phone moves and sends HA a new location while it is still in range of the beacon - HA will update the location of the beacon. So if go for a drive in your car - you will see both your phone and the *device_tracker.beacon_car* move together.
<p>If you park your car and go shopping - <em>device_tracker.beacon_car</em> will stop moving.</p>
If you park your car and go shopping - *device_tracker.beacon_car* will stop moving.
<p>With the basic tracking working - you can use automation to do things like open your gates if your car comes home</p>
With the basic tracking working - you can use automation to do things like open your gates if your car comes home
<div class="highlighter-coderay"><div class="CodeRay">
<div class="code"><pre><span class="key">automation</span>:
- <span class="string"><span class="content">alias: 'Open gate'</span></span>
<span class="key">trigger</span>:
- <span class="string"><span class="content">platform: state</span></span>
<span class="key">entity_id</span>: <span class="string"><span class="content">device_tracker.beacon_car</span></span>
<span class="key">from</span>: <span class="string"><span class="content">'not_home'</span></span>
<span class="key">to</span>: <span class="string"><span class="content">'home'</span></span>
<span class="key">condition</span>:
- <span class="string"><span class="content">condition: state</span></span>
<span class="key">entity_id</span>: <span class="string"><span class="content">switch.gate</span></span>
<span class="key">state</span>: <span class="string"><span class="content">'off'</span></span>
<span class="key">action</span>:
<span class="key">service</span>: <span class="string"><span class="content">switch.turn_on</span></span>
<span class="key">entity_id</span>: <span class="string"><span class="content">switch.gate</span></span>
</pre></div>
</div>
</div>
```yaml
automation:
- alias: 'Open gate'
trigger:
- platform: state
entity_id: device_tracker.beacon_car
from: 'not_home'
to: 'home'
condition:
- condition: state
entity_id: switch.gate
state: 'off'
action:
service: switch.turn_on
entity_id: switch.gate
```
<p>Or warn you if you leave your keys behind</p>
Or warn you if you leave your keys behind
<div class="highlighter-coderay"><div class="CodeRay">
<div class="code"><pre><span class="key">automation</span>:
- <span class="string"><span class="content">alias: 'Forgotten keys'</span></span>
<span class="key">trigger</span>:
<span class="key">platform</span>: <span class="string"><span class="content">template</span></span>
<span class="key">value_template</span>: <span class="string"><span class="content">'{{states.device_tracker.greg_gregphone.state != states.device_tracker.beacon_keys.state}}'</span></span>
<span class="key">condition</span>:
<span class="key">condition</span>: <span class="string"><span class="content">template</span></span>
<span class="key">value_template</span>: <span class="string"><span class="content">'{{ states.device_tracker.greg_gregphone.state != &quot;home&quot; }}'</span></span>
<span class="key">action</span>:
<span class="key">service</span>: <span class="string"><span class="content">script.turn_on</span></span>
<span class="key">entity_id</span>: <span class="string"><span class="content">script.send_key_alert</span></span>
```yaml
automation:
- alias: 'Forgotten keys'
trigger:
platform: template
value_template: '{{ states.device_tracker.greg_gregphone.state != states.device_tracker.beacon_keys.state}}'
condition:
condition: template
value_template: '{{ states.device_tracker.greg_gregphone.state != "home" }}'
action:
service: script.turn_on
entity_id: script.send_key_alert
- <span class="string"><span class="content">alias: 'Forgotten keys - cancel'</span></span>
<span class="key">trigger</span>:
<span class="key">platform</span>: <span class="string"><span class="content">template</span></span>
<span class="key">value_template</span>: <span class="string"><span class="content">'{{states.device_tracker.greg_gregphone.state == states.device_tracker.beacon_keys.state}}'</span></span>
<span class="key">condition</span>:
- <span class="string"><span class="content">condition: state</span></span>
<span class="key">entity_id</span>: <span class="string"><span class="content">script.send_key_alert</span></span>
<span class="key">state</span>: <span class="string"><span class="content">'on'</span></span>
<span class="key">action</span>:
<span class="key">service</span>: <span class="string"><span class="content">script.turn_off</span></span>
<span class="key">entity_id</span>: <span class="string"><span class="content">script.send_key_alert</span></span>
</pre></div>
</div>
</div>
- alias: 'Forgotten keys - cancel'
trigger:
platform: template
value_template: '{{ states.device_tracker.greg_gregphone.state == states.device_tracker.beacon_keys.state }}'
condition:
- condition: state
entity_id: script.send_key_alert
state: 'on'
action:
service: script.turn_off
entity_id: script.send_key_alert
```
<div class="highlighter-coderay"><div class="CodeRay">
<div class="code"><pre><span class="key">script</span>:
<span class="key">send_key_alert</span>:
<span class="key">sequence</span>:
- <span class="string"><span class="content">delay:</span><span class="content">
minutes: 2</span></span>
- <span class="string"><span class="content">service: notify.notify</span></span>
<span class="key">data</span>:
<span class="key">message</span>: <span class="string"><span class="content">'You forgot your keys'</span></span>
<span class="key">target</span>: <span class="string"><span class="content">'device/gregs_iphone'</span></span>
</pre></div>
</div>
</div>
```yaml
script:
send_key_alert:
sequence:
- delay:
minutes: 2
- service: notify.notify
data:
message: 'You forgot your keys'
target: 'device/gregs_iphone'
```
<p>(The delay is needed for two reasons: -<br />
1. HA updates the beacon and phone locations at slightly different times - so you dont want the automation to trigger in the gap between the updates<br />
2. Ive found that beacons (especially the low power Estimote Nearables) can get disconnected for a few seconds so its best to wait a minute or so before deciding that youve left your keys behind)</p>
<h3><a class='title-link' name='using-both-types-of-ibeacons-at-the-same-time' href='#using-both-types-of-ibeacons-at-the-same-time'></a> Using both types of iBeacons at the same time </h3>
<p>Of course you can use both fixed and mobile beacons at the same time. I want my gates to open when I arrive home in the car - so I use an iBeacon in the car so that I can track the car, and a iBeacon on my drive so that a location update is triggered when I arrive. Ive been experimenting with a high power beacon in a waterproof box on my drive which seems to work well to notice when I get home.</p>
(The delay is needed for two reasons: -
1. HA updates the beacon and phone locations at slightly different times - so you dont want the automation to trigger in the gap between the updates
2. Ive found that beacons (especially the low power Estimote Nearables) can get disconnected for a few seconds so its best to wait a minute or so before deciding that youve left your keys behind)
<p class="img">
<img width="300" src="http://bluesensenetworks.com/wp-content/uploads/2015/02/BlueBar-Beacon-Long-Range.jpg" />
### <a class='title-link' name='using-both-types-of-ibeacons-at-the-same-time' href='#using-both-types-of-ibeacons-at-the-same-time'></a> Using both types of iBeacons at the same time
Of course you can use both fixed and mobile beacons at the same time. I want my gates to open when I arrive home in the car - so I use an iBeacon in the car so that I can track the car, and a iBeacon on my drive so that a location update is triggered when I arrive. I've been experimenting with a high power beacon in a waterproof box on my drive which seems to work well to notice when I get home.
<p class='img'>
<img width='300' src='http://bluesensenetworks.com/wp-content/uploads/2015/02/BlueBar-Beacon-Long-Range.jpg'>
</p>
<p>Long range / High power beacon</p>
Long range / High power beacon
<p class="img">
<img width="400" src="http://bluesensenetworks.com/wp-content/uploads/2015/02/BlueBar-Beacon-Weatherproof.jpg" />
<p class='img'>
<img width='400' src='http://bluesensenetworks.com/wp-content/uploads/2015/02/BlueBar-Beacon-Weatherproof.jpg'>
</p>
<p>Waterproof beacon</p>
Waterproof beacon
<h3><a class='title-link' name='buying-beacons' href='#buying-beacons'></a> Buying Beacons </h3>
<p>This isnt a buyers guide, but I just wanted to mention the iBeacons Ive been using. I think you should be able to use any iBeacon with HA and OwnTracks. You generally cant buy beacons in your local electronics shop - so I just wanted to briefly mention the two suppliers Ive used so far.</p>
<p>Ive bought quite a few iBeacons from a company called <a href="http://bluesensenetworks.com/">Blue Sense Networks</a>. I work in the tech startup sector in the UK so I partly chose them because they are a local start-up who seemed worth supporting. The products, support and software all seem good. I use a number of their beacons - from a simple USB dongle, to a long range beacon. All their products have batteries that can be changed (or no batteries in the case of the externally powered USB device) - and you can configure all the parameters youd want to using their software. I had one software issue, support got back to me at a weekend(!) - and the issue was resolved with a software release two days later.</p>
### <a class='title-link' name='buying-beacons' href='#buying-beacons'></a> Buying Beacons
This isnt a buyer's guide, but I just wanted to mention the iBeacons Ive been using. I think you should be able to use any iBeacon with HA and OwnTracks. You generally cant buy beacons in your local electronics shop - so I just wanted to briefly mention the two suppliers Ive used so far.
<p>All the beacons seem fine - and the long range unit does work over a longer range than my other beacons.</p>
Ive bought quite a few iBeacons from a company called [Blue Sense Networks](http://bluesensenetworks.com/). I work in the tech startup sector in the UK so I partly chose them because they are a local start-up who seemed worth supporting. The products, support and software all seem good. I use a number of their beacons - from a simple USB dongle, to a long range beacon. All their products have batteries that can be changed (or no batteries in the case of the externally powered USB device) - and you can configure all the parameters youd want to using their software. I had one software issue, support got back to me at a weekend(!) - and the issue was resolved with a software release two days later.
<p>I bought some other beacons from a US/Polish startup called <a href="http://estimote.com/">Estimote</a>, who I think are better known. I bought a developer pack of 10 of their <em>nearables</em> which as well as being iBeacons also send out other data (orientation and motion) using their own protocol. This is interesting if youre developing your own application, but for OwnTracks and HA they are just regular beacons. They are small and self adhesive - so you can stick them to things (like your keys). You cant change all the parameters on these devices (UUID/Major/Minor are fixed) - and the batteries cant be replaced. I also killed one of the estimote beacons (I assume the battery died) after I carried it around for a few months and dropped it many times! On the other hand they are well priced, small and waterproof!</p>
All the beacons seem fine - and the long range unit does work over a longer range than my other beacons.
<p>Ive mainly used these as <em>devices to track</em> rather that <em>location</em> beacons. Estimote also sell some slightly larger iBeacons with replaceable batteries. Estimote support responded quickly and were helpful when I couldnt work out how to edit their beacons parameters (although the answer was <em>you cant yet</em>).</p>
I bought some other beacons from a US/Polish startup called [Estimote](http://estimote.com/), who I think are better known. I bought a developer pack of 10 of their *nearables* which as well as being iBeacons also send out other data (orientation and motion) using their own protocol. This is interesting if youre developing your own application, but for OwnTracks and HA they are just regular beacons. They are small and self adhesive - so you can stick them to things (like your keys). You cant change all the parameters on these devices (UUID/Major/Minor are fixed) - and the batteries cant be replaced. I also killed one of the estimote beacons (I assume the battery died) after I carried it around for a few months and dropped it many times! On the other hand they are well priced, small and waterproof!
<p>The larger Blue Sense Network beacons seem to be better at maintaining a connection that the Estimotes - although that might be because Im reluctant to turn the power to maximum and reduce the gap between sending packets on the Estimotes where I cant replace the batteries!</p>
Ive mainly used these as *devices to track* rather that *location* beacons. Estimote also sell some slightly larger iBeacons with replaceable batteries. Estimote support responded quickly and were helpful when I couldnt work out how to edit their beacons parameters (although the answer was *you cant yet*).
<h3><a class='title-link' name='conclusion' href='#conclusion'></a> Conclusion </h3>
<p>As I said in <a href="/blog/2016/04/30/ibeacons-part-1-making-presence-detection-work-better">part 1</a>, Ive found iBeacons to be a good way of improving presence detection. I also used them to track devices like my car and my keys that cant track themselves.</p>
The larger Blue Sense Network beacons seem to be better at maintaining a connection that the Estimotes - although that might be because Im reluctant to turn the power to maximum and reduce the gap between sending packets on the Estimotes where I cant replace the batteries!
<p>Im still experimenting, so I hope I can do more with iBeacons. I hope Ive encouraged you do so the same. If you do please share your experiences.</p>
### <a class='title-link' name='conclusion' href='#conclusion'></a> Conclusion
As I said in [part 1](/blog/2016/04/30/ibeacons-part-1-making-presence-detection-work-better), Ive found iBeacons to be a good way of improving presence detection. I also used them to track devices like my car and my keys that cant track themselves.
<h3><a class='title-link' name='notes' href='#notes'></a> Notes </h3>
I'm still experimenting, so I hope I can do more with iBeacons. I hope I've encouraged you do so the same. If you do please share your experiences.
### <a class='title-link' name='notes' href='#notes'></a> Notes
Please see the [notes at the end of Part 1](/blog/2016/04/30/ibeacons-part-1-making-presence-detection-work-better/#tips) for documentation information.
<p>Please see the <a href="/blog/2016/04/30/ibeacons-part-1-making-presence-detection-work-better/#tips">notes at the end of Part 1</a> for documentation information.</p>
]]></content>
</entry>

View file

@ -202,7 +202,7 @@
<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>