1.10.0 filters (breaking change)

So I read this in the change logs:

Breaking Changes

Previously, esphomelib would by default only publish every 15th sensor value in order to provide averaged values. However, that often confused users and I now decided to remove it and set the default update interval of all components to 60s instead of the previous 15s. You can get back the old behavior by setting

sensor:
  - platform: ...  # enter platform here
    # other settings
    update_interval: 15s
    filters:
      - sliding_window_moving_average:

So I updated my config accordingly:

sensor:
  - platform: wifi_signal
    name: "Master Bed Sensor WiFi Signal"
    update_interval: 15s
    filters:
      - sliding_window_moving_average:

  - platform: adc
    pin: A0
    name: "Master Bed Sensor"
    update_interval: 15s
    filters:
      - multiply: 3.25
      - sliding_window_moving_average:

Only now the configuration is invalid:

INFO Reading configuration...
Failed config

sensor.wifi_signal: [source /config/esphomeyaml/master_bed.yaml:31]
  platform: wifi_signal
  name: Master Bed Sensor WiFi Signal
  update_interval: 15s
  filters:  [source /config/esphomeyaml/master_bed.yaml:35]
    - [source /config/esphomeyaml/master_bed.yaml:35]
      
      expected a dictionary.
      sliding_window_moving_average: 
sensor.adc: [source /config/esphomeyaml/master_bed.yaml:37]
  platform: adc
  pin: A0
  name: Master Bed Sensor
  update_interval: 15s
  filters:  [source /config/esphomeyaml/master_bed.yaml:42]
    - multiply: 3.25
    - [source /config/esphomeyaml/master_bed.yaml:43]
      
      expected a dictionary.
      sliding_window_moving_average: 

It seems what is actually required to get the original behaviour is this:

sensor:
  - platform: wifi_signal
    name: "Master Bed Sensor WiFi Signal"
    update_interval: 15s
    filters:
      - sliding_window_moving_average:
          window_size: 15
          send_every: 15

  - platform: adc
    pin: A0
    name: "Master Bed Sensor"
    update_interval: 15s
    filters:
      - multiply: 3.25
      - sliding_window_moving_average:
          window_size: 15
          send_every: 15

Not only that but the invalid configuration actually uploaded and made the ESP unresponsive to OTA updates. It was only when I tried a "clean build’ that the error became apparent.

The sensor is connected to a strain gauge glued under one of my bed slats so this is going to be a F%&*ing PITA to get out to connect via USB.

Actually even with this config:

sensor:
  - platform: wifi_signal
    name: "Master Bed Sensor WiFi Signal"
    update_interval: 15s
    filters:
      - sliding_window_moving_average:
          window_size: 15
          send_every: 15

  - platform: adc
    pin: A0
    name: "Master Bed Sensor"
    update_interval: 15s
    filters:
      - multiply: 3.25
      - sliding_window_moving_average:
          window_size: 15
          send_every: 15

The ESP is boot looping:

[18:51:56] ets Jan  8 2013,rst cause:4, boot mode:(3,6)
[18:51:56]
[18:51:56]wdt reset
[18:51:56]load 0x4010f000, len 1384, room 16 
[18:51:56]tail 8
[18:51:56]chksum 0x2d
[18:51:56]csum 0x2d
[18:51:56]vbb28d4a3
[18:51:56]~ld
[18:51:56][I][logger:071]: Log initialized
[18:51:56][C][ota:461]: There have been 3 suspected unsuccessful boot attempts.
[18:51:56][I][application:053]: Running through setup()...
[18:51:56][D][binary_sensor:027]: 'Master Bed Sensor Status': Sending state OFF
[18:51:56][C][sensor.adc:028]: Setting up ADC 'Master Bed Sensor'...
[18:51:56][C][wifi:029]: Setting up WiFi...
[18:51:56][D][wifi:260]: Starting scan...

The only way to get the ESP to boot correctly is to remove the sliding average filter:

sensor:
  - platform: wifi_signal
    name: "Master Bed Sensor WiFi Signal"
    update_interval: 15s

  - platform: adc
    pin: A0
    name: "Master Bed Sensor"
    update_interval: 15s
    filters:
      - multiply: 3.25

It’s not possible to upload an invalid configuration to an ESP. If the configuration is invalid, the C++ source cannot be generated, and so even the firmware cannot be uploaded.

That’s unfortunate. ESPHome however has a feature that should protect from this: OTA safe mode. After 10 unsuccessful boot attempts it will go into a WiFi+OTA only mode which allows you to upload binaries remotely if things go wrong. Since it’s only doing OTA+WiFi, you also won’t see it in HA as being online.

Well somehow it did. As I said, It failed the ‘clean config’ check but did not fail when just pressing ‘upload’.

It was showing as online in the ESPhome addon and on my router but I could not ping it. I tried power cycling it and waiting for at least 15 minutes. No joy. I ended up pulling the whole slat out from under the mattress and re-flashing via serial.

Any comment on the window average filter?

I did open an issue about this on github.