Hi all
I'm trying to compute the average of time (percentage) a condition was TRUE using "long term stats".
I went into the following assumptions:
- LTS only save numbers. => so i first created a helper to convert "False" to 0, and true to 100 ... great it shoudl be saved on LTS
- LTS are aggregated, so the average computed by HA will be usefull in this case ... => One minute reported as "100" via the helper described above, will now add " 100/60" in the corresponging timeslice of 60 minues in LTS => perfect ( it will automatically add 1.6% of the corresponding LTS hour ).
now, it may sound stupid, but i would like to create 3 new sensors/templates.
- average "on" (in %) during last 24h
- average "on" (in %) during last 7 days
- average "on" (in %) last 30 days.
which helper is using LTS ? That's not clear to me.
Can i just use a simple "mean" ?
What will happens if the condition is/was false for 5 hours ? do we have 5 LTS records at zero ? do i need to use "step mean"?
Thank you for any advices/best practices !
regards