Average lux over 24 hours - is the statistics sensor what I need?

I have some plant sensors and see the light levels they get at every minute of the day is not that useful. I would like to know the average lux level they get over a 24 hours period.

Should I be using the statistics sensor:

or some other method? I didnt want to create some hideously memory intensive process, the docs give an example of:

sensor:
  - platform: statistics
    entity_id: sensor.cpu
  - platform: statistics
    entity_id: binary_sensor.movement
    max_age:
      minutes: 30

I would need

hours: 24

and as there is no method of setting the number of points to take that average from was not sure if it would use lots of compute calculating from data points every 10 seconds?

If it’s reporting every 10 seconds, for a 24hour average you will need to set the sampling size a lot higher than the default of 20.

24*60*60/10 = 8640. Call it 9000 to be safe (it will still be truncated by the max age setting).

This will not be too onerous for the minimum recommended hardware ( pi3) or better.

Perfect thanks. I am not sure to be honest how often it polls as its all going through OpenMQTT but I can see a lot of changes in the entity graph.

So going for a safe number of samples and truncating using max age should be ok.

Thanks, will give it a go.

One you have it set up and running for over a day check the developer tools states menu. The attributes of the statistics sensor will show you how many samples are being used.

1 Like