My approach (just started setting up) is a bit different.
I am using the insight trends app to calculate the avarage of the P1 signal over 15 min.
Recalculating that (just like you) to a current.
Based on the trend (also from insight trends) of the expectedsun script (changed to 1hr iso 3hr)
I decide if I actually want to update the current