How can I get a smoother Graph?

my solar panel returns quite some messy data, see graph above. Using the statistics sesnor, I already managed to clean it up a bit, but I get some strange gaps in the chart below (e.g. at 10:00am in the example)

How can I:
1.) get a continous chart?
2.) get an even smoother chart (without HACS)?

  - platform: statistics
    name: "Solar W Mean"
    entity_id: input_number.solarnow
      minutes: 10
    state_characteristic: average_linear

The statistics card gives me a beautiful graph, however there are still gaps between sunset and sunrise where the value should be zero and continous.

I generated a persistent sensor using an input number and an automation that writes the last value or zero if there is none into it, however I cannot chose that sensor for the statistics graph card :confused: .

Use a template sensor.

But template sensors cannot save the value at a reboot, or am I missing sth?

My setup is:

1.) Unreliable, messy Solarvalues with lots of ‘unavailable’ data →
2.) Automation that writes continius data to an input value, using the original data when available, last data when unavailable, and “0” when unavialable for more than 10 minutes. →
3.) Statistics sensor that generates a mean or something out of the input value. but that’s still very choppy and I’d like to have it cleaner. Maybe @parautenbach 's idea of using a filter on the input value could work, but which filter would be best? Moving Average?

The ones with trigger do. So put some fitting triggers on it.

Template sensors are recalculated whenever the sensor changes, their state is also restored after a restart.

Low pass filter. I found 20 minutes worked well for me to switch loads based on solar generation.

It will not fix the gaps in your data. The only way you can fix that is to stop your sensor from becoming unavailable, or use a template sensor that replaces unavailable with the last state.

So: sensor → template sensor to keep last known good state → LP filter.

1 Like

Thanks, I’ll try it out

Sure? This would be diiferent to what Mike said recently. And because of/according to this my answer above.

Trigger template entities do restore state. This is because their state can’t be easily reconstituted otherwise. Their state isn’t updated until the trigger fires and that could be a long time after startup.

Non-trigger template entities do not restore state. Their state can be easily reconstituted by simply evaluating the template. Which is what HA does on startup already for all non-trigger template entities.

Ok so “evaluated” after a restart rather than “restored”. Outcome is the same. The template sensor has a value right after start up.

1 Like