andystewart999 / ha_transportnsw

A Home Assistant component to provide real-time Transport NSW journey information
GNU General Public License v3.0
7 stars 1 forks source link

"n/a" in realtime location (longitude and latitude attributes) is impacting HA Map dashboard #5

Closed radman3362 closed 2 months ago

radman3362 commented 2 months ago

When the longitude and latitude fields are not 'float', it breaks the HA "map" dashboard. The map dashboard is unable to show location of devices, and shows "Amsterdam" instead. See the attached jpgs. An explanation of this issue is also in this thread - https://community.home-assistant.io/t/map-issue-home-zone-is-not-recognized/172748/8

Sometimes, longitude and latitude attributes are "n/a". I assume Transport NSW is not returning the realtime location data consistently? Can there be some logic in the code, so that if Transport NSW is not returning proper longitude/latitude, the values are set to 0 instead?

For now, I have simply override it to 0, in lines 232, 233, 297, 298, 356, 357 of the sensor.py file. This override has confirmed to fix the issue for me. Once fixed, make sure all existing sensors don't have "n/a" for longitude or latitude. The "map" dashboard should work properly after that.

lon_lat_show_na map_show_amsterdam

andystewart999 commented 2 months ago

Thanks for calling that out radman, I've fixed it and will push out an update.

radman3362 commented 1 month ago

Thanks Andy. I have tested and confirm that the latest release has fixed the issue now.