Help Understanding the Graph Component: Range vs Value

The esphome docs for the graph component says the following:

  • max_range (Optional): Specifies the maximum Y-axis range.
  • min_range (Optional): Specifies the minimum Y-axis range.
  • max_value (Optional): Specifies the maximum Y-axis value.
  • min_value (Optional): Specifies the minimum Y-axis value.

Can someone help clarify what the difference between range and value is?

I would like to have a set scale, for example I have a sensor “pm_2_5” and I want to display a range from 0.0 to 9.0, the sensor may go above 9.0 or may never get anywhere near 9.0 but I don’t want the scale to ever change. If the value goes above 9.0 will it disappear, clamp to 9.0 or draw over other items?

Also does anyone know why setting min_range: 0 gives the error value must be higher than 0.?

I was drafting almost exactly the same question. I want my scale to stay fixed. Have you figured out anything?

I rarely ever see or hear about people using this so, I wouldn’t expect lots of help in a timely manner.

That’s a good question that I didn’t know the answer to either. A quick Google search was all it took for me to learn the difference so, I’d recommend giving that a try and there’s a good chance you’ll find the answer to your other question why the min_range can’t be 0.0

https://www.google.com/search?q=y+axis+range+vs+value&oq=y+axis+range+vs+value&gs_lcrp=EgZjaHJvbWUyCQgAEEUYORigATIGCAEQRRhAMgYIAhBFGEDSAQg4NzE5ajBqN6gCALACAA&sourceid=chrome&ie=UTF-8

As far as tailoring the graph the way you want, the best thing to do is input some numbers or don’t and leave them default. Flash the esp board and see what happens. Trial and error is a good way to learn something new and it gives you the benefit of actually seeing the differences instead of just copying some code on here and not really understanding what is going on and why.

Try it out and see what happens! Whats the worst that’s gonna happen?

You do realize HA comes equipped with lots of graphing capabilities that are far better than this pretty basic graph in esphome?

Thanks I’ve done exactly this - trial and error, but it’s difficult because you have to wait 30 minutes + to collect enough data to see a change, and then the changes are unexpected and confusing, i.e. a max range of 1000 did not make a difference on data points 0 - 10 range. There are 16 combinations to do.

I could not figure out from your google search why min range isn’t allowed to be 0.

We’re aware there’s better graphing tools on HA dashboards itself, but the use case is for ESPHome devices in particular.

So far it’s great, if we can just understand how to set a fixed scale it would mean more.