1 """Support for the Locative platform."""
9 from .
import DOMAIN
as LT_DOMAIN, TRACKER_UPDATE
13 hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback
15 """Configure a dispatcher connection based on a config entry."""
18 def _receive_data(device, location, location_name):
19 """Receive set location."""
20 if device
in hass.data[LT_DOMAIN][
"devices"]:
23 hass.data[LT_DOMAIN][
"devices"].
add(device)
27 hass.data[LT_DOMAIN][
"unsub_device_tracker"][entry.entry_id] = (
33 """Represent a tracked device."""
35 def __init__(self, device, location, location_name):
36 """Set up Locative entity."""
45 """Return the name of the device."""
46 return self.
_name_name
49 """Register state update callback."""
55 """Clean up after entity before removal."""
60 """Update device data."""
61 if device != self.
_name_name:
66 self.async_write_ha_state()
def _async_receive_data(self, device, location, location_name)
None async_added_to_hass(self)
None async_will_remove_from_hass(self)
def __init__(self, device, location, location_name)
bool add(self, _T matcher)
None async_setup_entry(HomeAssistant hass, ConfigEntry entry, AddEntitiesCallback async_add_entities)
Callable[[], None] async_dispatcher_connect(HomeAssistant hass, str signal, Callable[..., Any] target)