"Unable to automatically extract API key" when "filter_out: nan" in code

Hello everybody,

I have build some sensors for my garden and had problems updating the sensors with new ESPHome versions. I found out that the API key can not be transmitted as ESPHome seems to have problems extracting the key from the code when the filter “filter_out: nan” is in it. The error in the thread title appears when I click the three dots in ESPHome sensor and select “Show API Key”.
When I comment the “filter_out”-line out everything goes well.
Is this a bug or do I miss something?
Just to test it I used the following code:

esphome:
  name: test
  friendly_name: test

esp8266:
  board: d1_mini

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "BD7oYgph6lN0iAXuwh22MzvJORVGe+ZGwhR2K6ElwIQ="

ota:
  password: "e0eff7a1da9a07a6c11b4e95f345b8f6"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Test Fallback Hotspot"
    password: "T7DXMzBrqGDK"

captive_portal:

sensor:

 # The actual distance sensor
 - platform: ultrasonic
   trigger_pin: D1
   echo_pin: D2
   name: garden_watertank_distance
   update_interval: 600s
   pulse_time: 50us
   filters:
    - filter_out: nan

This is a simple ultrasonic sensor configuration, nothing else. Tried it also with other sensors, the problem remains as long as “filter_out: nan” is in the code.

Thanks for any help!

Log please.

Ho nickrout,

when I click on “show API key” there isn’t any logging in homeassistant.log, if you mean that. I’m quite a newbie, using HA for some weeks only, maybe you mean another log file?

Thank you very much!

Tried to set

logger:
   logs:
     homeassistant.components.esphome: debug

in configuration.yaml, still no entry.

Same issue for me. @nickrout what logs are you looking for? I’m running HA OS and don’t see any relevant logs there or in the ESPHome add-on.

Assumed you’d see something in the esphome logs.

But is it really an issue? The encryption key is in your yaml code.

Nah nothing in the logs… and it’s not causing me any issues (can’t speak for @undee123 )