Hi,
I got power meter and i wolud like to create statistics but need to update once per 5min.
- platform: statistics
name: grid_monitoring_power_median
entity_id: sensor.grid_monitoring_power
state_characteristic: median
sampling_size: 60
My power sensor get updated every 5sec
5 minutes = 300 second
300second/5sec = 60 update time of sensor i will get window of 5minutes
Code above will update every 5sec but need to be once per 5minutes
tom_l
2
The statistics integration updates whenever the source sensor updates. There is nothing you can do about that.
This seems an awful lot like an x-y situation. https://xyproblem.info/
Why do you want a sensor that only updates every five minutes?
I got apexchart and want on graph to show 15min window median from 15min not every 5sec because its very cpu intesive task
tom_l
4
Apexcharts can use long term statistics (5 minute, hour or day). Does this sensor sensor.grid_monitoring_power
have a state_class attribute?
No its just “energy” and unit “W” updating every 5sec its too much data
tom_l
6
Which integration is supplying the sensor?
Worst case, if the integration does not support it, you can add a state class with customize. You can then use the 5 minute LTS average.
Also power is measured in W, not energy (that’s Wh). So there is something wrong there too.
- entity: sensor
class: power
name: Power
dps:
- id: 19
name: sensor
type: integer
class: measurement
unit: W
mapping:
- scale: 100
Yes its power sorry
Tuya Local, Update every 5sec
tom_l
8
Go to Developer Tools → States, what does it list as the attributes of the sensor in the right hand column?
If it has state_class: measurement
then use this in your apexcharts config:
series:
- entity: sensor.grid_monitoring_power
statistics:
type: mean
period: 5minute
align: middle