I’ m trying to create a message to get the cheapest petrol price whenever I leave work. So far, I checked one petrol station directly on the way - that worked well.
Now I created a sensor (Min Helper) that checks multiple (6) petrol stations which are very close by. I can pull the price from that sensor with
{ (states('sensor.sensor_digital_min_petrol_price')| float|round(3)) }} without problems.
While I’m not sure it’s good - it works
The issue with the comparison of multiple petrol stations is, that I need to match the resulting price with the petrol station in question, so I know where to go. I somehow achived this with:
Unfortunately, it now shows something like sensor.petrolstation_name_place.
Can I somehow transform that information into a friendly name?
The message part so far is good, just that I don’t like to read:
The petrol price is 1.889 in sensor.petrolstation_name_place but rather
The petrol price is 1.889 in Friendly name (of that sensor)
Templating in itself I somehow understood, but very limited, therefore I’m happy for every information I can get.
In general use the developer tools to see the state, abbributes and its values, so you know what you can extract of information and with what names to do it.
That’s what I did @WallyR but im not happy with it. When I can „pull“ the attribute and value, can’t I „translate“ that into something else?
My thinking:
The min-sensor checks the entities I provided and analyzes which one is the cheapest.
It now „pulls“ that information into its attribute-list as sensor.cheapest_petrol_station_city.
I could use this info, but unlike a prize or temperature, it only shows the sensor as sensor.cheapest_petrol_station_city. This isn’t nice to read in a message unless I could use the friendly name of that entity.
That’s why I wonder if I can take that information of sensor.cheapest_petrol_station_city to „pull“ the friendly name of that sensor e.g. Paris - Diesel from its entity information into my message.
When I had only one sensor it was easy because I could enter the name into the text, but that’s not possible anymore as the cheapest petrol station could also be Rome or Berlin so to speak.
If the value of sensor.cheapest_petrol_station_city is directly related to a name of another sensor, then it should be possible to make a rewrite and use that to extract more info.
I am not sure how to use dynamic sensor names in HA, since I use NodeRed for this, but ask that question in a new thread maybe.