home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
74.15k stars 31.13k forks source link

Tankerkoenig - Error in location data #115912

Closed jorgwolski closed 7 months ago

jorgwolski commented 7 months ago

The problem

Tankerkoenig entities are showing on the map as expected. But using those to create a distance template just results in null.

What version of Home Assistant Core has the issue?

core-2024.4.3

What was the last working version of Home Assistant Core?

core-2024.3.x

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Tankerkoenig

Link to integration documentation on our website

https://www.home-assistant.io/integrations/tankerkoenig/

Diagnostics information

config_entry-tankerkoenig-cbe826f93ac56c4b37ca046e7ab21c61.json

Example YAML snippet

template:
  - sensor:
    - name: Distance
      state: "{{ distance('sensor.hem_mecklenheidestr_77_diesel') }}"

Anything in the logs that might be useful for us?

No response

Additional information

No response

home-assistant[bot] commented 7 months ago

Hey there @guillempages, @mib1185, @jpbede, mind taking a look at this issue as it has been labeled with an integration (tankerkoenig) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `tankerkoenig` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign tankerkoenig` Removes the current integration label and assignees on the issue, add the integration domain after the command. - `@home-assistant add-label needs-more-information` Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue. - `@home-assistant remove-label needs-more-information` Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


tankerkoenig documentation tankerkoenig source (message by IssueLinks)

mib1185 commented 7 months ago

this is not an issue with the tankerkoenig integration. I think your template is just wrong - have a look into the docs

jorgwolski commented 7 months ago

Same template is working flawlessly with an entity from the Pegelonline integration (with geolocation). And until recently that template was working with Tankerkoenig as well.

mib1185 commented 7 months ago

mhhh ... I've checked the docs again, it is not mentioned that this should work also with sensor entities, but it is also not mentioned to be limited to device tracker and personal entities 🤔 need to check the code how it should work

jorgwolski commented 7 months ago

It seems to work with all entities providing latitude/longitude information.

distance() will measure the distance in kilometers between home, entity, coordinates.

But for some reason, it stopped working for Tankerkoenig entities only, even though they have those attributes.

mib1185 commented 7 months ago

when you say "it stopped" working, so it was working before? Since the tankerkoenig entities are still shown on the map, they also still have coordinates in an expected format. Is there anything in the full log of homeassistent?

jorgwolski commented 7 months ago

Maybe I found something. I looked those two entities up. The Pegelonline entity's geolocation attributes are formatted like this:

latitude: 52.38806781246802
longitude: 9.676062044544127

The Tankerkoenig ones like this:

latitude: "52.4158"
longitude: "9.678132"

Maybe distance() doesn't like it to be a string.

Edit: Yeah. If I remove the quotation marks in the dev tools, distance() is working

home-assistant[bot] commented 7 months ago

Hey there @guillempages, mind taking a look at this issue as it has been labeled with an integration (tankerkoenig) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `tankerkoenig` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign tankerkoenig` Removes the current integration label and assignees on the issue, add the integration domain after the command. - `@home-assistant add-label needs-more-information` Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue. - `@home-assistant remove-label needs-more-information` Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


tankerkoenig documentation tankerkoenig source (message by IssueLinks)