hass-core/homeassistant/components/device_tracker
Eric Hagan ed3f7d1581 OwnTracks work. Beacon logic and testcases (#10183)
* OwnTracks work. Beacon logic and testcases

The existing test cases don't really make clear what is being
tested and the iBeacon / Region / Zone / Tracker thing is all
a bit confused.

I'm distinguishing a fixed-place beacon used to trigger entrance
into an HA zone (as a Region Beacon) from a beacon affixed to a
portable or mobile object (as a Mobile Beacon). The behaviors
and test cases for those usages should be different. A Region Beacon
will be named the same as a Home Assistant Zone and seeing an event
from that beacon should trigger a device tracker update related
to that zone. It would be appropriate, though unnecessary, to
configure the Region Beacon with the GPS coordinates of its static
physical location.

A Mobile Beacon is not named after any HA Zone and seeing the beacon
triggers an update in HA setting the location of the beacon to the
current device_tracker location. In this way, when my_phone sees
the beacon on my_keys, the location of my_keys is set to where
my_phone is. And when my_phone stops seeing my_keys, my_keys location
is the location of my_phone the last time it saw them.

A Mobile Beacon's GPS information should be ignored because it's
almost certain to be incorrect because the beacon moves. In fact,
beacons typcially come configured with lat/lon as 0.0/0.0 so using
the location of the beacon in an update has a nasty habit of
setting you and your keys on the bottom of the Atlantic Ocean.

Leave message handling is changed to treat mobile beacons
differently from region beacons and gps regions.

active beacons should be a set. you shouldn't end up
with multiple "active" entries for the same beacon. Let's
enforce that with the correct data structure.

Added test for real-world bug that is fixed.
A series of mobile beacon and region beacon
enter and leave events could cause a mobile
beacon to stick to the tracking device even
though it had tracked through a "leave" event.

Changed two tests to look at the size
of the 'mobile_beacons_active' structure rather
than at the object which will allow this test
to work with any sort of list, set, etc.

* Removing excess logging and unnecessary try catch.

From review on PR #10183 I've removed some info logging
that was unnecessary and I've made the suggested changes
to an if block and a try/catch.
2017-10-31 00:18:45 -07:00
..
__init__.py added platform discovery code back into device_tracker (#10169) 2017-10-27 07:57:31 +02:00
actiontec.py Cleanup old device_tracker stuff (#8627) 2017-07-24 07:45:02 -07:00
aruba.py Allow empty hostnames when detecting devices with the aruba device_tracker. (#9440) 2017-09-15 22:55:53 -07:00
asuswrt.py Move constant to 'const.py' and use already definied ones (#10204) 2017-10-29 12:32:02 +01:00
automatic.py Aioautomatic bump and scope update (#10043) 2017-10-22 17:11:35 -04:00
bbox.py Fix pylint 1.7.2 no-else-return issues (#8361) 2017-07-05 23:30:01 -07:00
bluetooth_le_tracker.py Update docstrings (#7361) 2017-04-29 22:04:49 -07:00
bluetooth_tracker.py Update docstrings (#7361) 2017-04-29 22:04:49 -07:00
bt_home_hub_5.py Cleanup old device_tracker stuff (#8627) 2017-07-24 07:45:02 -07:00
cisco_ios.py Cleanup old device_tracker stuff (#8627) 2017-07-24 07:45:02 -07:00
ddwrt.py Cleanup old device_tracker stuff (#8627) 2017-07-24 07:45:02 -07:00
demo.py Update docstrings (#7361) 2017-04-29 22:04:49 -07:00
fritz.py Update fritzconnection to 0.6.5 (#9950) 2017-10-18 20:58:26 +02:00
geofency.py Add Geofency device tracker (#9106) 2017-09-01 23:56:59 +02:00
gpslogger.py Fix more deprecation warnings (#7778) 2017-05-26 13:12:17 -07:00
huawei_router.py Add new device tracker for Huawei Routers. (#8488) 2017-08-10 17:01:52 +02:00
icloud.py Fix a bunch of typos (#9545) 2017-09-23 17:15:46 +02:00
keenetic_ndms2.py Added Zyxel Keenetic NDMS2 based routers support for device tracking (#9315) 2017-09-16 10:29:24 +02:00
linksys_ap.py Cleanup old device_tracker stuff (#8627) 2017-07-24 07:45:02 -07:00
linksys_smart.py Cleanup old device_tracker stuff (#8627) 2017-07-24 07:45:02 -07:00
locative.py Fix pylint 1.7.2 no-else-return issues (#8361) 2017-07-05 23:30:01 -07:00
luci.py Cleanup old device_tracker stuff (#8627) 2017-07-24 07:45:02 -07:00
mikrotik.py Librouteros capsman fix (#10217) 2017-10-30 08:41:37 +01:00
mqtt.py Update docstrings (#7361) 2017-04-29 22:04:49 -07:00
mqtt_json.py Update docstrings (#7361) 2017-04-29 22:04:49 -07:00
mysensors.py Refactor mysensors callback and add validation (#9069) 2017-08-25 08:58:05 -07:00
netgear.py Cleanup old device_tracker stuff (#8627) 2017-07-24 07:45:02 -07:00
nmap_tracker.py Cleanup old device_tracker stuff (#8627) 2017-07-24 07:45:02 -07:00
owntracks.py OwnTracks work. Beacon logic and testcases (#10183) 2017-10-31 00:18:45 -07:00
owntracks_http.py Add OwnTracks over HTTP (#9582) 2017-09-28 09:49:35 +02:00
ping.py Update ping.py (#7944) 2017-06-08 07:30:51 +02:00
services.yaml Update services.yaml files (#10229) 2017-10-30 21:39:12 +01:00
sky_hub.py Cleanup old device_tracker stuff (#8627) 2017-07-24 07:45:02 -07:00
snmp.py Upgrade pysnmp to 4.4.1 (#10138) 2017-10-26 10:38:27 +02:00
swisscom.py Cleanup old device_tracker stuff (#8627) 2017-07-24 07:45:02 -07:00
tado.py Fix pylint 1.7.2 no-else-return issues (#8361) 2017-07-05 23:30:01 -07:00
tesla.py Tesla platform (#9211) 2017-08-30 23:13:02 -05:00
thomson.py Cleanup old device_tracker stuff (#8627) 2017-07-24 07:45:02 -07:00
tomato.py Cleanup old device_tracker stuff (#8627) 2017-07-24 07:45:02 -07:00
tplink.py Cleanup old device_tracker stuff (#8627) 2017-07-24 07:45:02 -07:00
trackr.py Update docstrings (#7361) 2017-04-29 22:04:49 -07:00
ubus.py Fix Lint 2017-07-28 20:53:15 -07:00
unifi.py Use the Last Seen attribute in unify (#8998) 2017-10-13 10:13:58 +02:00
upc_connect.py using defusedxml ElementTree for safer parsing of untrusted XML data (#9934) 2017-10-18 16:21:46 +02:00
volvooncall.py Handle the case where no registration number is available (instead display VIN (vehicle identification number)). (#9073) 2017-09-05 09:10:01 -07:00
xiaomi.py Fix a bunch of typos (#9545) 2017-09-23 17:15:46 +02:00