mandarons / ha-bouncie

Home Assistant custom integration for Bouncie.com - track your car stuff in Home Assistant
BSD 3-Clause "New" or "Revised" License
32 stars 3 forks source link

[BUG]Car Address often displays “Unknown” in Home Assistant #41

Closed jlipsit closed 9 months ago

jlipsit commented 10 months ago

Update: I just figured out what is happening. The car address will never update in Home Assistant until the user opens the Bouncie app and selects the vehicle. It’s strange because there is a view in the app that will display an accurate current address that updates continuously, even while driving. Perhaps this field is available to pull into Home Assistant. If this is not possible, then we should contact the dev team at Bouncie to correct the updating of the address (Location) in the API.


I have been a Bouncie user for many years and before that used Automatic ODB2 trackers. Thanks so much for making this integration.

The bug I am reporting is that the Car Address often displays “Unknown” in Home Assistant even when the Bouncie APP displays the proper address. This is an intermittent problem that happens often. I have 2 vehicles, and this happens with both. All other sensors on both cars update as expected. The Bouncie app displays the proper address 100% of the time but in Home Assistant – I would guess it displays “Unknown” about 90% of the time.

This is the only thing that I saw in my logs: 2024-01-09 16:44:44.235 WARNING (MainThread) [homeassistant.components.device_tracker] SOURCE_TYPE_GPS was used from bouncie, this is a deprecated constant which will be removed in HA Core 2025.1. Use SourceType.GPS instead, please create a bug report at https://github.com/mandarons/ha-bouncie/issues

IMG_1512

IMG_1518

mandarons commented 9 months ago

Perhaps this field is available to pull into Home Assistant. If this is not possible, then we should contact the dev team at Bouncie to correct the updating of the address (Location) in the API.

Bouncie API exposed to developers isn't the same as they use for their app. I initiated discussion with Bouncie dev team back in Jan 2023 (https://github.com/mandarons/ha-bouncie/issues/10) but no success so far.

I have been a Bouncie user for many years

If you can help influence Bouncie dev team, that would greatly help all the users.

mandarons commented 9 months ago

2024-01-09 16:44:44.235 WARNING (MainThread) [homeassistant.components.device_tracker] SOURCE_TYPE_GPS was used from bouncie, this is a deprecated constant which will be removed in HA Core 2025.1. Use SourceType.GPS instead, please create a bug report at https://github.com/mandarons/ha-bouncie/issues

Thank you for sharing this. I don't have Bouncie hence, I cannot track these kind of issues unless a user like you notifies. I will change it.

dgarozzo commented 9 months ago

If I recall, there are two ways to use the API/service from Bouncie. One is to poll the API. The other is to receive webhook calls. The webhook calls provide information while driving. If I recall, the actual address information might come from the webhooks. I'm not positive on that.

Either way, I've worked around this problem by integrating with the Google Maps Travel Time component:

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

I have three 3 sensors (one for each Bouncie device), and and I have an automation that will request an update from Google Maps when it senses a change from Bouncie, and then announce the location on my Alexas. I have Zones configured that will give addresses names for the announcement. (ie, "The minivan is parked at Kohls") It will use the street address if the Zone is not defined. Hope this all makes sense.

alias: Announce Car
description: ""
trigger:
  - platform: state
    entity_id: sensor.2018_honda_odyssey_car_info
    id: 2018_honda_odyssey
    to: null
    variables:
      car_name: minivan
      sensor: sensor.google_travel_time_honda_odyssey
      tracker: device_tracker.2018_honda_odyssey
  - platform: state
    entity_id: sensor.2013_audi_s4_car_info
    id: 2013_audi_s4
    to: null
    variables:
      car_name: audi
      sensor: sensor.google_travel_time_audi
      tracker: device_tracker.2013_audi_s4
  - platform: state
    entity_id: sensor.2012_mini_cooper_clubman_car_info
    id: 2012_mini_cooper
    to: null
    variables:
      car_name: mini cooper
      sensor: sensor.2012_mini_cooper_clubman_car_info
      tracker: device_tracker.2012_mini_cooper_clubman
condition: []
action:
  - service: homeassistant.update_entity
    data: {}
    target:
      entity_id: "{{ sensor }}"
  - delay:
      hours: 0
      minutes: 0
      seconds: 2
      milliseconds: 0
  - variables:
      sound_effect: >-
        {% set info = states(trigger.entity_id) %} {{ '<audio
        src="soundbank://soundlibrary/vehicles/cars/cars_02"/>' if info != "Not
        Running" else '<audio
        src="soundbank://soundlibrary/vehicles/skids_tires/skids_tires_09"/>' }}
      car_info: >-
        {% set info = states(trigger.entity_id) %} {{ info if info != "Not
        Running" else "Parked" }}
      car_location_address: >-
        {% set state = states( tracker) %} {{ state if state != "not_home" else
        state_attr(sensor, 'origin_addresses')[0].split(",")[0] }}
  - service: notify.alexa_media
    data:
      message: >-
        {{ sound_effect }} The {{ car_name }} is {{ car_info }} at {{
        car_location_address }}
      target:
        - media_player.alexa_man_cave
        - media_player.living_room
        - media_player.master_bedroom
mode: single
mandarons commented 9 months ago

Cool. Looks like you have a workaround for this problem. I will just fix the warning message for this issue.