Adding multiple sensors with the same platform in order

Hey everyone. I’ve been fiddling with Home Assistant for the past few days and have found everything pretty straight forward when following the docs and posts in this community. I have just hit a wall on a topic though and was wondering if anyone else has has a similar issue.

I am trying to add multiple uber sensors to my my Home Assistant so that I can see readily how expensive and the time it would take to uber to different places all at once. I can add the sensors fine, but each sensor after the first one gets a “_#” appended to the end of the entity id. The issue I’m having with that is it is non-deterministic which “_#” gets added to which sensor. Because of this, there is no way for me to know in my lovelace configuration which entity belongs to which uber sensor.

Here is a snippet of my uber.yaml package:

sensor:

  - platform: uber
    start_latitude: !secret home_latitude
    start_longitude: !secret home_longitude
    end_latitude: !secret my_work_latitude
    end_longitude: !secret my_work_longitude
    server_token: !secret uber_key
    product_ids:
      - "26546650-e557-4a7b-86e7-6a3942445247"
      - "a1111c8c-c720-46c3-8534-2fcdd730040d"

  - platform: uber
    start_latitude: !secret home_latitude
    start_longitude: !secret home_longitude
    end_latitude: !secret wife_work_latitude
    end_longitude: !secret wife_work_longitude
    server_token: !secret uber_key
    product_ids:
      - "26546650-e557-4a7b-86e7-6a3942445247"
      - "a1111c8c-c720-46c3-8534-2fcdd730040d"

Is there any way to make sure sensor.uberx_price is associated with my work and sensor.uberx_price_2 is associated with my wife’s work?

Any help would be greatly appreciated!

looking at the documentation, I dont think the integration expects more than one start/finish.

Yeah, I’m not adding more than one start/end for each sensor. I am making a new sensor for each end address.

poor wording on my part - given there is no ‘naming’ for the sensor, I think the expectation was only one sensor in a system

Okay. So there is no way to get different uber prices based on an input-select selection? I also tried adding just one Uber sensor and having the end_latitude and end_longitude controlled by a template sensor connected to my input-select. That also didn’t work.

I guess I could try to add a name to the existing Uber platform sensor, but I feel like there should be an easier way to do this Any other ideas for getting Uber pricing dynamically?

https://www.home-assistant.io/components/sensor.uber/ suggests that the sensor is built/configured at boot time, and the values for the sensors change but the sensor config doesn’t.

Going to need help from someone with more understanding of how sensors are instantiated and named…

I’ve added a pull request here to try to fix this issue: https://github.com/home-assistant/home-assistant/pull/20185. We’ll see how that goes in the next few days.