Home Assistant Unofficial Reference 2024.12.1
homeassistant.helpers.location Namespace Reference

Functions

str _get_location_from_attributes (State entity_state)
 
State|None closest (float latitude, float longitude, Iterable[State] states)
 
str|None find_coordinates (HomeAssistant hass, str name, list|None recursion_history=None)
 
bool has_location (State state)
 
str|None resolve_zone (HomeAssistant hass, str zone_name)
 

Variables

 _LOGGER = logging.getLogger(__name__)
 

Detailed Description

Location helpers for Home Assistant.

Function Documentation

◆ _get_location_from_attributes()

str homeassistant.helpers.location._get_location_from_attributes ( State  entity_state)
private
Get the lat/long string from an entities attributes.

Definition at line 124 of file location.py.

◆ closest()

State | None homeassistant.helpers.location.closest ( float  latitude,
float  longitude,
Iterable[State states 
)
Return closest state to point.

Async friendly.

Definition at line 27 of file location.py.

◆ find_coordinates()

str | None homeassistant.helpers.location.find_coordinates ( HomeAssistant  hass,
str  name,
list | None   recursion_history = None 
)
Try to resolve the a location from a supplied name or entity_id.

Will recursively resolve an entity if pointed to by the state of the supplied
entity.

Returns coordinates in the form of '90.000,180.000', an address or
the state of the last resolved entity.

Definition at line 49 of file location.py.

◆ has_location()

bool homeassistant.helpers.location.has_location ( State  state)
Test if state contains a valid location.

Async friendly.

Definition at line 15 of file location.py.

◆ resolve_zone()

str | None homeassistant.helpers.location.resolve_zone ( HomeAssistant  hass,
str  zone_name 
)
Get a lat/long from a zones friendly_name.

None is returned if no zone is found by that friendly_name.

Definition at line 111 of file location.py.

Variable Documentation

◆ _LOGGER

homeassistant.helpers.location._LOGGER = logging.getLogger(__name__)
private

Definition at line 12 of file location.py.