Setting friendly name by sensor attribute

I’m using 2 Google Maps Travel Time sensors for which I need to set friendly name.

I have noticed that generated entities are swapping, meaning sometimes route A>B is sensor.google_travel_time__driving but after a service restart sensor.google_travel_time__driving becomes B>A. Obviously it swaps with the other entity sensor.google_travel_time__driving_2

That makes it impossible to set a friendly name using customization so I thought I could use sensor template. As above sensor has origin and destination attribute I imagine I would use this to set friendly route name.

Is that possible?

You can’t set the name in the sensor itself, instead of customization?

How?

- platform: google_travel_time
  api_key: <apikey>
  mode: driving
  origin: A
  destination: B
  friendly_name: "Route home"

does not seem to work, I get generic Google Travel Time - Driving in result.

name: Route Home :slight_smile:

There we go, I realized that I have tried that before but I haven’t noticed that caused those sensors to change changed entity. I got what I needed, much appreciated @poebae!

1 Like