What is slightly frustrating about this is that the original sensor-graph custom component seemed to work perfectly (although I actually found it after the official version was released I so only used it for a couple of days before I realised and then swapped).
What is doubly frustrating is the way official versions of original custom components often seem to be less functional than the custom component they replace. This is one and the button-entity is another.
There may be very good reasons for this but it is frustrating
Thanks for digging into that.
BTW, where are the Lovelace component ? Didn’t find them in site-package, so ?
Point 1 : that’s why we see those behavior with variable input devices, like the xiaomi sensors. We don’t know how many data in 24h we’ll have. I thought I’d be safe increasing the number, wrong !
Point 2 : that’s why I had those curve totally off, I posted the screenshot #2
Point 3 : this was the most obvious error.
Well, I’ll leave it for now, expecting improvements in next versions.
Not sure why that is. Must be a fluke. The original card has the exact same function.
I don’t have a dev environment but I’m going to try to make it work. I know code very well, but i’ve never coded in JS. So that will be a challenge.
I’m not sure. The loop looks optimized. Typically math operations like that are fast so the trade off is negligible.
That’s a nice idea, Unfortunately, I know math. I do not know JS well. I know math and a little JS enough to make the change to the sensor graph but not enough to add new properties. I don’t understand a lot of the ‘glue’ that makes CSS, JS, and HTML work that I don’t understand.
Not sure where they are stored. The lovelace frontend is home-assistant-polymer. So i’d start looking around for phrases like that.
I’ve thought about this quite a bit and I’ve decided to avoid incorporating a moving average filter. The UI really shouldn’t be chugging away at math. I will however fix the flat line and you should now have the ability to get to a resolution of 1 to 1 (which was impossible before).
EDIT: Made the changes. Did not include a moving average. If you guys want an exact representation of your data, setting the accuracy to a very large number will give you that now. The flat line should also be gone.
I’m not sure when the PR will make it into the software.
Thank’s a lot!
Can you please share the link to your PR?
I’m afraid I have the same problem as the others. If the accuracy value is too high, the first half of the graph is a flat line, if the accuracy value is too low, the graph of the sensor card usually does not match the history graph anymore.
I found the PR and I was expecting to test it, but in fact the JS are not as component, stored in a file.
You’ll find all that in a “chunk1234567890…js” file (or something as less readable as that…), that is in the site-packages/hass_frontend folder.
Hey guys, I’m the author of the original custom mini-graph-card which I upon request contributed to the HA core as the sensor card.
When I initially made this card I didn’t have a ton of sensor data play around with. The implementation I ended up with was simple and seemed to work fairly well with the data the sensors I had at home provided me with.
But as discussed in this thread, the current implementation is not very elegant and flawed many ways.
I’ve worked on a new algorithm to calculate the data points for the line graph, which should solve issues discussed in this thread.
The new implementation would take moving average as well as the actual timestamps of the history entries into account. This should make the graph way more accurate and better represent the actual history, regardless of if the sensor data is updated sporadically or regularly.
However with this new implementation we would have to replace the accuracy option (which as mentioned is poorly named) with something like detail : 1 or 2, 1 for one data point every hour and 2 for one data point every 10 minute.
I was wondering, since the 81.0 upgrade i’ve had an issue with sensor cards. They just flatline.
I can see the date changing but the graph just stays the same what so ever. Ex the outside temp went from -2 to 10 in less than 24h but nothing…
Thank you both for the heads up. But it doesn’t seem to work. If i restart the server it works for a couple hours then flat-lines. Could it be a db issue ? Whats is weird is that when i click on the graph, the line doesn’t correspond to the actual shown data.