esphome / issues

Issue Tracker for ESPHome
https://esphome.io/
290 stars 36 forks source link

Exponential Moving Average Broken? #1505

Closed karansoi closed 3 years ago

karansoi commented 4 years ago

Operating environment/Installation (Hass.io/Docker/pip/etc.):

System: HassOS 4.13 (armv7 / raspberrypi4) Home Assistant Core: 0.115.2 Home Assistant Supervisor: 245 Hass.io Add-on: ESPHome (dev) Development Version! Manage and program ESP8266/ESP32 microcontrollers through YAML configuration files ESP (ESP32/ESP8266, Board/Sonoff):

WeMos D1R1 board ESPHome version (latest production, beta, dev branch)

Add-on version: dev You are running the latest version of this add-on. Affected component:

https://esphome.io/components/sensor/index.html#sensor-filters

Description of problem: Exponential moving average has stopped working recently. It was working about a fortnight ago

Problem-relevant YAML-configuration entries:

esphome:
  name: playground
  platform: ESP8266
  board: d1

wifi:
  ssid:  !secret ssid_playground
  password: !secret password_playground

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: !secret ssid_playground_fallback_hotspot
    password:  !secret password_playground_fallback_hotspot

captive_portal:

# Enable logging
logger:
  level: DEBUG

# Enable Home Assistant API
api:

ota:

dallas:
   -  pin:  
       number:  5
       inverted:  False

switch:
  -  platform: gpio
     id: builtIn_led
     name: "Built In Led"
     pin:
       number:  GPIO02
       inverted:  True

  -  platform: gpio
     id: ntc_vcc
     name:  VCC For NTC from GPIO13
     internal:  True
     pin:
       number:  GPIO13
       inverted:  True
interval:
  - interval: 60s
    then:
      - switch.turn_off:  ntc_vcc
      - component.update:  source_sensor
      - switch.turn_on:  ntc_vcc

#######
sensor:
  -  platform:  ntc
     sensor:  resistance_sensor
     name:  NTC Temperature Sensor
     accuracy_decimals:  3
     calibration:
      #b_constant: 3950
      #reference_temperature: 25°C
      #reference_resistance: 10.0kOhm
       - 53.202kOhm -> -10°C
       - 10.10kOhm -> 25°C
       - 3.039kOhm -> 55°C

  -  platform:  resistance
     sensor:  source_sensor
     id:  resistance_sensor
     name:  Resistance Sensor
     resistor:  10.0kOhm
     reference_voltage:  3.3V
     configuration:  DOWNSTREAM
     accuracy_decimals:  2

  -  platform:  adc
     id:  source_sensor
     accuracy_decimals:  3
     filters:
       #-  offset:  -0.106
       -  multiply: 3.3
       -  exponential_moving_average:
            alpha: 0.1
            send_every:  4

     pin:  A0
     update_interval:  never

  - platform:  dallas
    address:  0x620004411638FF28
    id:  dallas_sensor
    name:  Dallas Sensor
    accuracy_decimals:  3

    filters:
       -  exponential_moving_average:
            alpha:  0.1
            send_every:  4

Logs (if applicable):

INFO Reading configuration /config/esphome/playground.yaml...
INFO Starting log output from playground.local using esphome API
INFO Connecting to playground.local:6053 (192.168.86.73)
INFO Successfully connected to playground.local
[08:29:47][I][app:105]: ESPHome version 1.16.0-dev compiled on Sep 22 2020, 08:16:34
[08:29:47][C][wifi:443]: WiFi:
[08:29:47][C][wifi:303]:   SSID: 

[redacted]
[08:29:47][C][wifi:304]:   IP Address: 192.168.86.73
[08:29:47][C][wifi:306]:   BSSID: 

[redacted]
[08:29:47][C][wifi:307]:   Hostname: 'playground'
[08:29:47][C][wifi:311]:   Signal strength: -66 dB ▂▄▆█
[08:29:47][C][wifi:315]:   Channel: 1
[08:29:47][C][wifi:316]:   Subnet: 255.255.255.0
[08:29:47][C][wifi:317]:   Gateway: 192.168.86.1
[08:29:47][C][wifi:318]:   DNS1: 192.168.86.1
[08:29:47][C][wifi:319]:   DNS2: (IP unset)
[08:29:47][C][switch.gpio:042]: GPIO Switch 'Built In Led'
[08:29:47][C][switch.gpio:043]:   Pin: GPIO2 (Mode: OUTPUT, INVERTED)
[08:29:47][C][switch.gpio:059]:   Restore Mode: Restore (Defaults to OFF)
[08:29:47][C][switch.gpio:042]: GPIO Switch 'VCC For NTC from GPIO13'
[08:29:47][C][switch.gpio:043]:   Pin: GPIO13 (Mode: OUTPUT, INVERTED)
[08:29:47][C][switch.gpio:059]:   Restore Mode: Restore (Defaults to OFF)
[08:29:47][C][logger:185]: Logger:
[08:29:47][C][logger:186]:   Level: DEBUG
[08:29:47][C][logger:187]:   Log Baud Rate: 115200
[08:29:47][C][logger:188]:   Hardware UART: UART0
[08:29:47][C][ntc:014]: NTC Sensor 'NTC Temperature Sensor'
[08:29:47][C][ntc:014]:   Unit of Measurement: '°C'
[08:29:47][C][ntc:014]:   Accuracy Decimals: 3
[08:29:47][C][ntc:014]:   Icon: 'mdi:thermometer'
[08:29:47][C][resistance:010]: Resistance Sensor 'Resistance Sensor'
[08:29:47][C][resistance:010]:   Unit of Measurement: 'Ω'
[08:29:47][C][resistance:010]:   Accuracy Decimals: 2
[08:29:47][C][resistance:010]:   Icon: 'mdi:flash'
[08:29:47][C][resistance:011]:   Configuration: DOWNSTREAM
[08:29:47][C][resistance:012]:   Resistor: 10000.00Ω
[08:29:47][C][resistance:013]:   Reference Voltage: 3.3V
[08:29:47][C][adc:026]: ADC Sensor 'source_sensor'
[08:29:47][C][adc:026]:   Unit of Measurement: 'V'
[08:29:47][C][adc:026]:   Accuracy Decimals: 3
[08:29:47][C][adc:026]:   Icon: 'mdi:flash'
[08:29:47][C][adc:031]:   Pin: 17
[08:29:47][C][adc:051]:   Update Interval: 4294967.5s
[08:29:47][C][dallas.sensor:072]: DallasComponent:
[08:29:47][C][dallas.sensor:073]:   Pin: GPIO5 (Mode: INPUT)
[08:29:47][C][dallas.sensor:074]:   Update Interval: 60.0s
[08:29:47][D][dallas.sensor:079]:   Found sensors:
[08:29:47][D][dallas.sensor:082]:     0x620004411638FF28
[08:29:47][C][dallas.sensor:087]:   Device 'Dallas Sensor'
[08:29:47][C][dallas.sensor:087]:     Unit of Measurement: '°C'
[08:29:47][C][dallas.sensor:087]:     Accuracy Decimals: 3
[08:29:47][C][dallas.sensor:087]:     Icon: 'mdi:thermometer'
[08:29:47][C][dallas.sensor:095]:     Address: 0x620004411638FF28
[08:29:47][C][dallas.sensor:096]:     Resolution: 12
[08:29:47][C][captive_portal:169]: Captive Portal:
[08:29:47][C][ota:029]: Over-The-Air Updates:
[08:29:47][C][ota:030]:   Address: playground.local:8266
[08:29:47][C][api:095]: API Server:
[08:29:47][C][api:096]:   Address: playground.local:6053
[08:29:55][D][switch:025]: 'VCC For NTC from GPIO13' Turning OFF.
[08:29:55][D][switch:045]: 'VCC For NTC from GPIO13': Sending state OFF
[08:29:55][D][adc:056]: 'source_sensor': Got voltage=0.47V
[08:29:55][D][switch:021]: 'VCC For NTC from GPIO13' Turning ON.
[08:29:55][D][switch:045]: 'VCC For NTC from GPIO13': Sending state ON
[08:30:43][D][dallas.sensor:153]: 'Dallas Sensor': Got Temperature=29.8°C
[08:30:55][D][switch:025]: 'VCC For NTC from GPIO13' Turning OFF.
[08:30:55][D][switch:045]: 'VCC For NTC from GPIO13': Sending state OFF
[08:30:55][D][adc:056]: 'source_sensor': Got voltage=0.47V
[08:30:55][D][switch:021]: 'VCC For NTC from GPIO13' Turning ON.
[08:30:55][D][switch:045]: 'VCC For NTC from GPIO13': Sending state ON
[08:31:43][D][dallas.sensor:153]: 'Dallas Sensor': Got Temperature=29.8°C
[08:31:55][D][switch:025]: 'VCC For NTC from GPIO13' Turning OFF.
[08:31:55][D][switch:045]: 'VCC For NTC from GPIO13': Sending state OFF
[08:31:55][D][adc:056]: 'source_sensor': Got voltage=0.48V
[08:31:55][D][switch:021]: 'VCC For NTC from GPIO13' Turning ON.
[08:31:55][D][switch:045]: 'VCC For NTC from GPIO13': Sending state ON
[08:32:43][D][dallas.sensor:153]: 'Dallas Sensor': Got Temperature=29.8°C
[08:32:44][D][sensor:092]: 'Dallas Sensor': Sending state 29.80445 °C with 3 decimals of accuracy
[08:32:55][D][switch:025]: 'VCC For NTC from GPIO13' Turning OFF.
[08:32:55][D][switch:045]: 'VCC For NTC from GPIO13': Sending state OFF
[08:32:55][D][adc:056]: 'source_sensor': Got voltage=0.48V
[08:32:55][D][sensor:092]: 'source_sensor': Sending state 1.57158 V with 3 decimals of accuracy
[08:32:55][D][resistance:037]: 'Resistance Sensor' - Resistance 9092.6Ω
[08:32:55][D][sensor:092]: 'Resistance Sensor': Sending state 9092.63379 Ω with 2 decimals of accuracy
[08:32:55][D][ntc:026]: 'NTC Temperature Sensor' - Temperature: 27.4°C
[08:32:55][D][sensor:092]: 'NTC Temperature Sensor': Sending state 27.44871 °C with 3 decimals of accuracy
[08:32:55][D][switch:021]: 'VCC For NTC from GPIO13' Turning ON.
[08:32:55][D][switch:045]: 'VCC For NTC from GPIO13': Sending state ON
[08:33:43][D][dallas.sensor:153]: 'Dallas Sensor': Got Temperature=29.8°C
[08:33:55][D][switch:025]: 'VCC For NTC from GPIO13' Turning OFF.
[08:33:55][D][switch:045]: 'VCC For NTC from GPIO13': Sending state OFF
[08:33:55][D][adc:056]: 'source_sensor': Got voltage=0.47V
[08:33:55][D][switch:021]: 'VCC For NTC from GPIO13' Turning ON.
[08:33:55][D][switch:045]: 'VCC For NTC from GPIO13': Sending state ON
[08:34:43][D][dallas.sensor:153]: 'Dallas Sensor': Got Temperature=29.8°C
[08:34:55][D][switch:025]: 'VCC For NTC from GPIO13' Turning OFF.
[08:34:55][D][switch:045]: 'VCC For NTC from GPIO13': Sending state OFF
[08:34:55][D][adc:056]: 'source_sensor': Got voltage=0.48V
[08:34:55][D][switch:021]: 'VCC For NTC from GPIO13' Turning ON.
[08:34:55][D][switch:045]: 'VCC For NTC from GPIO13': Sending state ON
[08:35:43][D][dallas.sensor:153]: 'Dallas Sensor': Got Temperature=29.8°C
[08:35:55][D][switch:025]: 'VCC For NTC from GPIO13' Turning OFF.
[08:35:55][D][switch:045]: 'VCC For NTC from GPIO13': Sending state OFF
[08:35:55][D][adc:056]: 'source_sensor': Got voltage=0.48V
[08:35:55][D][switch:021]: 'VCC For NTC from GPIO13' Turning ON.
[08:35:55][D][switch:045]: 'VCC For NTC from GPIO13': Sending state ON
[08:36:43][D][dallas.sensor:153]: 'Dallas Sensor': Got Temperature=29.8°C
[08:36:43][D][sensor:092]: 'Dallas Sensor': Sending state 29.79760 °C with 3 decimals of accuracy
[08:36:55][D][switch:025]: 'VCC For NTC from GPIO13' Turning OFF.
[08:36:55][D][switch:045]: 'VCC For NTC from GPIO13': Sending state OFF
[08:36:55][D][adc:056]: 'source_sensor': Got voltage=0.48V
[08:36:55][D][sensor:092]: 'source_sensor': Sending state 1.57064 V with 3 decimals of accuracy
[08:36:55][D][resistance:037]: 'Resistance Sensor' - Resistance 9082.2Ω
[08:36:55][D][sensor:092]: 'Resistance Sensor': Sending state 9082.16016 Ω with 2 decimals of accuracy
[08:36:55][D][ntc:026]: 'NTC Temperature Sensor' - Temperature: 27.5°C
[08:36:55][D][sensor:092]: 'NTC Temperature Sensor': Sending state 27.47575 °C with 3 decimals of accuracy
[08:36:55][D][switch:021]: 'VCC For NTC from GPIO13' Turning ON.
[08:36:55][D][switch:045]: 'VCC For NTC from GPIO13': Sending state ON
[08:37:43][D][dallas.sensor:153]: 'Dallas Sensor': Got Temperature=29.8°C
[08:37:55][D][switch:025]: 'VCC For NTC from GPIO13' Turning OFF.
[08:37:55][D][switch:045]: 'VCC For NTC from GPIO13': Sending state OFF
[08:37:55][D][adc:056]: 'source_sensor': Got voltage=0.47V
[08:37:55][D][switch:021]: 'VCC For NTC from GPIO13' Turning ON.
[08:37:55][D][switch:045]: 'VCC For NTC from GPIO13': Sending state ON
[08:38:43][D][dallas.sensor:153]: 'Dallas Sensor': Got Temperature=29.8°C
[08:38:55][D][switch:025]: 'VCC For NTC from GPIO13' Turning OFF.
[08:38:55][D][switch:045]: 'VCC For NTC from GPIO13': Sending state OFF
[08:38:55][D][adc:056]: 'source_sensor': Got voltage=0.48V
[08:38:55][D][switch:021]: 'VCC For NTC from GPIO13' Turning ON.
[08:38:55][D][switch:045]: 'VCC For NTC from GPIO13': Sending state ON
[08:39:43][D][dallas.sensor:153]: 'Dallas Sensor': Got Temperature=29.8°C
[08:39:55][D][switch:025]: 'VCC For NTC from GPIO13' Turning OFF.
[08:39:55][D][switch:045]: 'VCC For NTC from GPIO13': Sending state OFF
[08:39:55][D][adc:056]: 'source_sensor': Got voltage=0.47V
[08:39:55][D][switch:021]: 'VCC For NTC from GPIO13' Turning ON.
[08:39:55][D][switch:045]: 'VCC For NTC from GPIO13': Sending state ON

Additional information and things you've tried:

probot-esphome[bot] commented 4 years ago

sensor source sensor issues sensor recent changes (message by IssueLinks)

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.