hass-core/homeassistant/components/device_tracker/locative.py

29 lines
863 B
Python
Raw Normal View History

"""
2016-03-07 18:12:06 +01:00
Support for the Locative platform.
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-12-23 03:52:52 -07:00
import logging
from homeassistant.components.locative import TRACKER_UPDATE
from homeassistant.helpers.dispatcher import async_dispatcher_connect
2015-12-23 03:52:52 -07:00
_LOGGER = logging.getLogger(__name__)
DEPENDENCIES = ['locative']
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
)
async_dispatcher_connect(hass, TRACKER_UPDATE, _set_location)
return True