1 """The GPSD integration."""
3 from __future__
import annotations
5 from gps3.agps3threaded
import AGPS3mechanism
11 PLATFORMS: list[Platform] = [Platform.SENSOR]
13 type GPSDConfigEntry = ConfigEntry[AGPS3mechanism]
17 """Set up GPSD from a config entry."""
18 agps_thread = AGPS3mechanism()
19 entry.runtime_data = agps_thread
21 def setup_agps() -> None:
22 host = entry.data.get(CONF_HOST)
23 port = entry.data.get(CONF_PORT)
24 agps_thread.stream_data(host, port)
25 agps_thread.run_thread()
27 await hass.async_add_executor_job(setup_agps)
29 await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
35 """Unload a config entry."""
36 if unload_ok := await hass.config_entries.async_unload_platforms(entry, PLATFORMS):
37 agps_thread = entry.runtime_data
38 await hass.async_add_executor_job(
39 lambda: agps_thread.stream_data(
40 host=entry.data.get(CONF_HOST),
41 port=entry.data.get(CONF_PORT),
bool async_unload_entry(HomeAssistant hass, GPSDConfigEntry entry)
bool async_setup_entry(HomeAssistant hass, GPSDConfigEntry entry)