hass-core/homeassistant/components/device_tracker/geofency.py
Rohan Kapoor bdba3852d0 Split out geofency with a component and platform (#17933)
* Split out geofency with a component and platform

* Make geofency component/device_tracker more async

* Move geofency tests to new package

* Remove coroutine in geofency callback

* Lint

* Fix coroutine in geofency callback

* Fix incorrect patch
2018-11-06 20:12:03 +01:00

29 lines
876 B
Python

"""
Support for the Geofency platform.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/device_tracker.geofency/
"""
import logging
from homeassistant.components.geofency import TRACKER_UPDATE
from homeassistant.helpers.dispatcher import async_dispatcher_connect
_LOGGER = logging.getLogger(__name__)
DEPENDENCIES = ['geofency']
async def async_setup_scanner(hass, config, async_see, discovery_info=None):
"""Set up the Geofency device tracker."""
async def _set_location(device, gps, location_name, attributes):
"""Fire HA event to set location."""
await async_see(
dev_id=device,
gps=gps,
location_name=location_name,
attributes=attributes
)
async_dispatcher_connect(hass, TRACKER_UPDATE, _set_location)
return True