esphome / esphome/feature-requests

standard deviation support for sensor component

Open
#2,295 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
450
Forks
29
PR merge metrics
No merged PRs in 30d

Description

**Describe the problem you have/What new integration you would like**

It's was so helpful if sensor component have a running standard deviation output or filter, sometimes when condition in environment is not ideal or internal sensor part damaged, sensor keep starting publish random values so user get notification alert or disable other component rely on specific condition.
```
[18:08:37][D][ultrasonic.sensor:040]: 'Ping Sensor' - Got distance: 0.86 m
[18:08:37][D][ultrasonic.sensor:040]: 'Ping Sensor' - Got distance: 0.82 m
[18:08:37][D][ultrasonic.sensor:040]: 'Ping Sensor' - Got distance: 0.77 m
[18:08:37][D][ultrasonic.sensor:040]: 'Ping Sensor' - Got distance: 0.76 m
[18:08:37][D][ultrasonic.sensor:040]: 'Ping Sensor' - Got distance: 0.89 m
[18:08:37][D][ultrasonic.sensor:040]: 'Ping Sensor' - Got distance: 0.85 m
[18:08:37][D][ultrasonic.sensor:040]: 'Ping Sensor' - Got distance: 0.78 m
[18:08:37][D][ultrasonic.sensor:040]: 'Ping Sensor' - Got distance: 0.78 m
[18:08:37][D][ultrasonic.sensor:040]: 'Ping Sensor' - Got distance: 0.82 m
...
[18:33:06][D][ultrasonic.sensor:040]: 'Ping Sensor' - Got distance: 0.84 m
[18:33:07][D][ultrasonic.sensor:040]: 'Ping Sensor' - Got distance: 0.92 m
[18:33:07][D][ultrasonic.sensor:040]: 'Ping Sensor' - Got distance: 0.74 m
[18:33:07][D][ultrasonic.sensor:040]: 'Ping Sensor' - Got distance: 0.91 m
[18:33:07][D][ultrasonic.sensor:040]: 'Ping Sensor' - Got distance: 0.71 m
[18:33:07][D][ultrasonic.sensor:040]: 'Ping Sensor' - Got distance: 0.92 m
[18:33:07][D][ultrasonic.sensor:040]: 'Ping Sensor' - Got distance: 0.75 m
[18:33:07][D][ultrasonic.sensor:040]: 'Ping Sensor' - Got distance: 0.97 m
[18:33:07][D][ultrasonic.sensor:040]: 'Ping Sensor' - Got distance: 0.90 m
```
**Please describe your use case for this integration and alternatives you've tried:**

Sensor value keep fluctuating in not ideal environment. Before request i already tried many arduino library's which provide std_dev they all sending same state but for unknown reason they keep sending **nan**, the current working library break in last update.
**Additional context**

```
sensor:
- platform: ultrasonic
...
standard_deviation:
above: 14%
then:
- id(fluctuation).publish_state(true);
```
for current situation i implement this work well but look's weird
```
- platform: ultrasonic
filters:
- delta: 0.01
- lambda: |-
id(fluctuation).publish_state(true);
return x;
- debounce: 0.6s
- lambda: |-
id(fluctuation).publish_state(false);
return x;
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.