1 """Support for the Geofency device tracker platform."""
13 from .
import DOMAIN
as GF_DOMAIN, TRACKER_UPDATE
18 config_entry: ConfigEntry,
19 async_add_entities: AddEntitiesCallback,
21 """Set up Geofency config entry."""
24 def _receive_data(device, gps, location_name, attributes):
25 """Fire HA event to set location."""
26 if device
in hass.data[GF_DOMAIN][
"devices"]:
29 hass.data[GF_DOMAIN][
"devices"].
add(device)
33 hass.data[GF_DOMAIN][
"unsub_device_tracker"][config_entry.entry_id] = (
38 dev_reg = dr.async_get(hass)
41 for device
in dev_reg.devices.get_devices_for_config_entry_id(
44 for identifier
in device.identifiers
48 hass.data[GF_DOMAIN][
"devices"].
update(dev_ids)
53 """Represent a tracked device."""
55 _attr_has_entity_name =
True
58 def __init__(self, device, gps=None, location_name=None, attributes=None):
59 """Set up Geofency entity."""
69 identifiers={(GF_DOMAIN, device)},
74 """Register state update callback."""
88 attr = state.attributes
93 """Clean up after entity before removal."""
100 """Mark the device as seen."""
101 if device != self.
_name_name:
_attr_extra_state_attributes
def __init__(self, device, gps=None, location_name=None, attributes=None)
None async_added_to_hass(self)
def _async_receive_data(self, device, gps, location_name, attributes)
None async_will_remove_from_hass(self)
None async_write_ha_state(self)
State|None async_get_last_state(self)
bool add(self, _T matcher)
bool remove(self, _T matcher)
None async_setup_entry(HomeAssistant hass, ConfigEntry config_entry, AddEntitiesCallback async_add_entities)
IssData update(pyiss.ISS iss)
Callable[[], None] async_dispatcher_connect(HomeAssistant hass, str signal, Callable[..., Any] target)