2015-10-12 00:14:05 +02:00
|
|
|
"""
|
2016-03-07 18:12:06 +01:00
|
|
|
Support for the Locative platform.
|
2015-10-12 00:14:05 +02:00
|
|
|
|
2015-10-13 20:50:15 +02:00
|
|
|
For more details about this platform, please refer to the documentation at
|
2015-12-21 08:54:14 -07:00
|
|
|
https://home-assistant.io/components/device_tracker.locative/
|
2015-10-12 00:14:05 +02:00
|
|
|
"""
|
2015-12-23 03:52:52 -07:00
|
|
|
import logging
|
|
|
|
|
2019-01-11 15:14:11 -08:00
|
|
|
from homeassistant.components.locative import TRACKER_UPDATE
|
|
|
|
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
2015-10-12 00:14:05 +02:00
|
|
|
|
2015-12-23 03:52:52 -07:00
|
|
|
_LOGGER = logging.getLogger(__name__)
|
2015-10-12 00:14:05 +02:00
|
|
|
|
2019-01-11 15:14:11 -08:00
|
|
|
DEPENDENCIES = ['locative']
|
2015-10-12 00:14:05 +02:00
|
|
|
|
|
|
|
|
2019-01-11 15:14:11 -08:00
|
|
|
async def async_setup_scanner(hass, config, async_see, discovery_info=None):
|
|
|
|
"""Set up an endpoint for the Locative device tracker."""
|
|
|
|
async def _set_location(device, gps_location, location_name):
|
|
|
|
"""Fire HA event to set location."""
|
|
|
|
await async_see(
|
|
|
|
dev_id=device,
|
|
|
|
gps=gps_location,
|
|
|
|
location_name=location_name
|
|
|
|
)
|
2015-10-12 00:14:05 +02:00
|
|
|
|
2019-01-11 15:14:11 -08:00
|
|
|
async_dispatcher_connect(hass, TRACKER_UPDATE, _set_location)
|
2015-10-12 00:14:05 +02:00
|
|
|
return True
|