Weird line graphs

HA graphing component treats everything between states as static, sure, but it doesn’t need to be this way. In fact, some versions ago the behaviour was the opposite. For example, the demo in HA website uses conventional (non stepped) line charts.

It’s not that a choice is always better than the other, it depends on every case. For something like CPU usage, stepped is the right way, but for things like temperatures it’s plain wrong.

I tried filtering, graphs are nicer but they don’t reflect actual values anymore, just averages. For example, if temperature was 30 ºC and then got down to 28 ºC, you’ll probably end up with a single 29 ºC value.

Feed it into InfluxDB and use Grafana to view the data. Let HomeAssistant do its automation thing and Grafana do its beautiful graphing thing.

I think you are remembering incorrectly. I’ve been using this for the better part of 2 years and it has always been steps because it bothered me at the beginning.

No, it was a spline style graph back around version 0.5x or so. I don’t remember the exact version, but I remember it changed right around the time the history component had some issues with the data lines having shading under it or only the first couple on a chart showing up. I raised an issue (in a thread here) when that all changed. It changed to a staircase style graph and I immediately went “What the f is this?” and found there was no way to change it back easily. I agree there should be a way to change the graphing style on a per sensor basis, but I feel that would be pretty involved in the back end coding and there will always be edge cases missed because of how a sensor can be customized or represented. I’m currently looking into InfluxDB and Grafana, but haven’t made the switch.

EDIT: It was around version 0.58 the graph style changed. In the thread I linked you’ll see some have the spline style and some have a staircase style. In fact, further down in one of my replies, you’ll see the climate component graphs show a spline style, however now if I go to that same graph in the history component, it displays as a staircase style.

I think it was 0.64 that introduced the new behaviour.

See the issue on github:

Just look at Home Assistant demo, linked in HA front page. It uses an old version and line graphs are non stepped.

That’s a lot of work for just a simple sensor history graph.

I already had influx and grafana setup monitoring other things outside of HA. So it was pretty simple. Should be pretty simple for the Hass.io folks with the add ons too.

My mistake. If you want changes made to the component, write a PR against the component.

Any update on this topic? I’m using HA 0.81.1 and still getting stepped graphs, which are unrealistic. It would be desirable let the user choose the graph type. Python has a lot of modules to deal with that.

2 Likes

I too am looking for a way to revert this back to how it was.

See this example: https://github.com/home-assistant/home-assistant/issues/10590#issuecomment-350068847
This makes it clear why stairs are more correct. But of course they are not beautiful and it would be nice if it could be configured. An option could be “discrete” vs. “analog”. Normally if you have floating point values, you do not want discrete stairs. Whereas if you have fixed values like “0”,“1”,“2” you may want to display them discrete.

Stairs are more correct in that particular case you link, but in others it may not. Using stairs for discrete values and linear for floating values may work well in most cases, but I’m sure it wouldn’t cover everything, and would require ugly things. For example, what if I have a humidity sensor that gives me integer values in the 0-100 range? Graphs would be staired since values are discrete, when linear should be a much better representation, so I would need to hack a template sensor or something that converts 57 to 57.0 in order to have a proper graph.

Since there doesn’t seem to be a perfect way of doing this detection automatically, I think a graph parameter is needed to manually select staired graphs or not.

What temperature sensor are you using?

If you use one that is more accuarate you get graphs like this:

temperaturess

what are you using?

Bosch BME280 - It does humidity and pressure also

1 Like

Wall powered temperature sensors may probably send values frequently enough as to avoid the stairs effect. But battery powered sensors tend to send data only when there’s a significant change, thus making stairs noticeable. At least my Xiaomi sensors work that way.

1 Like

Sorry to revive this topic but you may be interested in the workaround to plot with spline line style in this new topic post.

2 Likes

And how to make linear line ?