agittins / agittins/bermuda

Data Smoothing is probably not working as intended

オープン
#376 コメント 7 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Python
スター
2k
フォーク
70
PR マージ指標
30日以内にマージされた PR はありません

説明

## Describe the bug

I am getting fast and erratic area changes, sometimes each second. To optimize this, I increased the "Smoothing Samples" value, which did not really change the behavior, which I found strange. I even tried values up to 60 and higher, which in my understanding should make the Area changes slow but more stable. This was not the case.

If I look at the "distance to *bt_proxy*" entities (not the unfiltered values), the distance sometimes jumps by a lot in each direction. So e.g. in one second the distance of a device to a scanner is like 3m while next second it is 9m and it jumps back to like 4. Looking at the logic of how the averaging is carried out, I can't understand how this behavior is possible. As I'm not a programmer, my interpretation may be flawed. But when I look at this code block, it should only be possible to spontaneously jump to a lower distance value and not to a higher value, as the logic of the iteration loop gives lower distance values "more weight":

```
dist_total: float = 0
dist_count: int = 0
local_min: float = self.rssi_distance_raw or DISTANCE_INFINITE
for distance in self.hist_distance_by_interval:
if distance <= local_min:
dist_total += distance
local_min = distance
else:
dist_total += local_min
dist_count += 1
if dist_count > 0:
movavg = dist_total / dist_count
else:
movavg = local_min
```

As soon as the new raw distance values keep filling the list of historic data with higher distances, the average should go up slowly, right?

Would it be possible to check the logic and make it more robust so that erratic area changes are throttled?

Nevertheless, thank you for this awesome integration!

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。