Function Average (past, single): ERROR - mycodo.function.average_past_single_27d1f495 - Could not find measurement within the set Max Age

Hi all,

I am trying to use Function Average (past, single). The input is a GPIO state with a period of 1 s, no pre-output, floating, no unit conversion.

The function configuration is Average (Past, Single), period 4 s, start offset 0 s, max age 10 s, measurement unit: bool.

By the way, how is implemented an average of booleans? True = 1, and average(True, False, True, True) = 0.75?

I obtain the following error in the logs when I activate it (of course, the primary input was activated): “ERROR - mycodo.function.average_past_single_27d1f495 - Could not find measurement within the set Max Age”.

Possibly related to my other problem here.

Was there a measurement that should have been found within the set Max Age (past 10 seconds)?

Do I assume erroneously that as the primary input is read at 1 s period, the average calculation has at its disposal thse values. So with max age at 10 s, it should have 10 values, at least 9.

I’ve never tested that function with a boolean input. Perhaps it’s treating the measurements as True/False rather than 1/0. Running the Function in debug mode and/or adding some log lines to the Function and reactivating it could shed some light on what’s going on.