Get the lowest / highest entity value from a specific entity group

Hi, i´m relative new to HA and maybe i did not search for the right terms but i would like to get the lowest / highest entity value from a specific entity group.

My example:
I use the “tankerkoenig” API to get the prices of fuel stations nearby. All the Entries name like: sensor.tankerkoenig_* where after the * comes the description of the individual gas station.

So i would like to know about the lowest and highest price of all my gas stations but not to show the value on a card but to set “lower_bound” and “upper_bound” as a variable of a card i print on my dashboard.

So how do i get a variable “lowest_price” as the lowest price of all my sensor.tankerkoenig_* entrys?

Thanks a lot i´m having so much fun with HA.

Should get you in the right direction

Thanks a lot. This solves the calculation of my entities. But there is still the problem of getting all the gas station entities into this min_max function. I could add all the 70 gas stations manually but the future proof version would be the sensor.tankerkoenig_* wildcard. Is there also a function to get them dynamically loaded?

{% for s in states.sensor if 'sensor.tankerkoenig_' in s.entity_id%}
  {{ s.entity_id }}
{% endfor %}

This will print out a list in template. But i dont know how to implement this into a min_max sensor in config.
But that will not dynamic adjust anyway. Since you need a server restart to load in the new sensors anyway.

Hi,

it’s a while since the last update, but could you manage to get the min or max of the prices?
I want to integrate the lowest price in my mushroom dashboard (chip section).

If there is any solution I would be happy if you can share.

Thanks!