Change average of MotionSensor to geometric mean instead of median To make the MotionSensor.threshold configuration work, the average of the sensor values can't be the median, as the value is always either 0 or 1. For example [0,0,0,1,1] is 0 and [0,0,1,1,1] is 1. Every threshold value larger than 0 will trigger as soon as the median is 1 and there is no granularity. There are two potential fixes: - change the average function of the internal queue from median to geometric mean - remove the threshold configuration entirely and rely on the queue length The first option, i.e. using the geometric mean to calculate the average is chosen in the PR to give more control to the user.
Change average of MotionSensor to geometric mean instead of median
To make the MotionSensor.threshold configuration work, the average of the sensor values can't be the median, as the value is always either 0 or 1.
For example [0,0,0,1,1] is 0 and [0,0,1,1,1] is 1. Every threshold value larger than 0 will trigger as soon as the median is 1 and there is no granularity.
There are two potential fixes:
- change the average function of the internal queue from median to geometric mean
- remove the threshold configuration entirely and rely on the queue length
The first option, i.e. using the geometric mean to calculate the average is chosen in the PR to give more control to the user.

waveform80/gpio-zero