Closed ravor-org closed 1 year ago
Hi @ravor-org , it works for me and is also displayed correctly.
I've tried that again and even enabled debugging for google_travel_time and in my case it looks different.
Heres the log from travel integration:
Sep 21 10:31:38 hwr-server01 hass[28207]: 2022-09-21 10:31:38.121 DEBUG (SyncWorker_0) [homeassistant.components.google_travel_time.sensor] Getting update for origin: not_home destination: 52.5685,13.8941
It does not matter, if device or person is used as origin. I'm not sure, what causes the origin to be displayed as "not_home" as the coordinates are displayed correctly in the map.
I've enabled debugging and somehow home-assistant thinks, that the "not_home" is a nested entity:
Sep 21 11:15:00 hwr-server01 hass[3135]: 2022-09-21 11:15:00.007 DEBUG (SyncWorker_7) [homeassistant.helpers.location] Getting nested entity for state: not_home
But as this is no nested entity, it is not resolved and therefore inaccessible.
After reviewing the location helper, this could be the culprit.
def has_location(state: State) -> bool: return ( isinstance(state, State) and isinstance(state.attributes.get(ATTR_LATITUDE), float) and isinstance(state.attributes.get(ATTR_LONGITUDE), float) )
So there are actually 3 questions: Is the state a real state? As I can see them in Dev-tools, it seems that way Are the latitude and longitude real float values? As python is not strictly typed, this could be the problem here.
After adding additional debug in the location helper, the following things occured: Sep 21 11:37:02 hwr-server01 hass[7215]: 2022-09-21 11:37:02.766 DEBUG (SyncWorker_5) [homeassistant.helpers.location] Location lookup for person.***** Sep 21 11:37:02 hwr-server01 hass[7215]: 2022-09-21 11:37:02.766 DEBUG (SyncWorker_5) [homeassistant.helpers.location] State: state is <class 'homeassistant.core.State'> Sep 21 11:37:02 hwr-server01 hass[7215]: 2022-09-21 11:37:02.766 DEBUG (SyncWorker_5) [homeassistant.helpers.location] latitude is <class 'str'> Sep 21 11:37:02 hwr-server01 hass[7215]: 2022-09-21 11:37:02.766 DEBUG (SyncWorker_5) [homeassistant.helpers.location] longitude is <class 'str'>
It seems, that the API is returning strings sometimes. Maybe because the source is WIFI instead of GPS or CELL.
I've created a pull request (as a quick fix): #59
Maybe you could also change the underlying API lib to maintain the type.
Is your feature request related to a problem? Please describe.
After adding the functionality for home / not_home state - Thank you very much for that - I tried to use the Google Travel Time together with the person (which only has Xplora attached to it) or with the device tracker but it still shows unknown as it seems to be unable to get the coordinates for the Xplora entities.
Describe the feature you want
I want to use the Google Travel Time together with the Xplora entities, but it seems, that this is not implemented either.
Additional context
No response