Wifi Connectivity Sensors "Unknown" in HA but visible on ESP's web page

I am developing a monitor for my water softener that for now is only monitoring salt level, more maybe later. The issue I am having is that the Wifi connection diagnostic sensors are showing up as Unknown in HA but visible in the esp32’s webpage.

Unknown here:

Visible here:

I suspect it might be the board/platform definition that I have yet to fully understand. I tried many different options with some erroring out at compile time, and others just working with exception to the wifi sensors.

The board is an ESP32-WROOM-32D. It looks very similar, if not the same, as the NodeMCU ESP32

YAML:

substitutions:
  devicename: water-softener-monitor
  devicename_no_dashes: water_softener_monitor
  friendly_devicename: "Water Softener Monitor"
  #Distance between bottom of tank and sensor in meters (m)
  distance_sensor_to_bottom: "0.90"

  
esphome:
  name: ${devicename}

esp32:
  board: esp32dev
  

wifi:
  ssid: !secret iot_wifi_ssid
  password: !secret iot_wifi_password
  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "${devicename} Hotspot"
    password: !secret iot_wifi_password
  
logger:
    baud_rate: 0 # (UART logging interferes with cse7766)
    
  # Remove this line if you're not using Home Assistsant or your switch will restart every now and again
api:
  
ota:
  
web_server:
  port: 80
  include_internal: true

text_sensor:
  - platform: wifi_info
    ip_address:
      name: "${friendly_devicename}: IP"
      icon: "mdi:ip-outline"
    ssid:
      name: "${friendly_devicename}: SSID"
      icon: "mdi:wifi-settings"
    bssid:
      name: "${friendly_devicename}: BSSID"
      icon: "mdi:wifi-settings"
    mac_address:
      name: "${friendly_devicename}: MAC"
      icon: "mdi:network-outline"
    scan_results:
      name: "${friendly_devicename}: Wifi Scan"
      icon: "mdi:wifi-refresh"
      disabled_by_default: true
  
  # Device Specific Config
sensor:
  - platform: ultrasonic
    trigger_pin: 23
    echo_pin: 22
    timeout: 4.0m     #This value should be close to actual limit of sensor
    update_interval: 2s
    name: "Sensor to salt"
    unit_of_measurement : "cm"
    filters:
    - lambda: return (x*100); #subtract distance measured to salt from total and convert from m to cm
    - filter_out: nan
    accuracy_decimals: 1
  - platform: ultrasonic
    trigger_pin: 23
    echo_pin: 22
    timeout: 4.0m     #This value should be close to actual limit of sensor
    update_interval: 2s
    name: "Salt Level"
    unit_of_measurement : "cm"
    filters:
    - lambda: return ((${distance_sensor_to_bottom} - x)*100); #subtract distance measured to salt from total and convert from m to cm
    - filter_out: nan
    accuracy_decimals: 1
  - platform: ultrasonic
    trigger_pin: 23
    echo_pin: 22
    timeout: 4.0m     #This value should be close to actual limit of sensor
    update_interval: 2s
    name: "Salt Level (%)"
    unit_of_measurement : "%"
    filters:
    - calibrate_linear:
        # Map 0.0 (from sensor) to 0.0 (true value)
        - 0.20 -> 100.0
        - 0.55 -> 50.0
        - 0.90 -> 0.0
    - lambda: return x;
    - filter_out: nan
    accuracy_decimals: 0
    

deep_sleep:
  id: deep_sleep_1
  sleep_duration: 30min

Are you using VLANS in your wifi configuration?

Are your laptop/pc, ESPHome device and Home Assistant on the same wifi SSID?

@Johanf I am using VLANs and my ESPs all live on the IoT VLAN and SSID, while my computer is on the main one as is Home Assistant. Either way, all devices see each other. The ESP was sending measurements back which HA was displaying but for some reason the wifi_info sensors were not working. I have 5 x S31 (ESP8266) outlets with the same code (wifi part) and networking setup that work.

Okay. Did you try running the same code on a different ESP device? For instance the ESP8266 in which you experience no problems?

What about this part?

deep_sleep:
  id: deep_sleep_1
  sleep_duration: 30min

Maybe a run_duration should be set, see: Deep Sleep Component — ESPHome

Although I would think that if in deep_sleep the webserver function would be down too.

1 Like

Oh wait I didn’t understand your questions fully until now. I see only the diagnostics aren’t showing up. I thought no sensor at all.

@Johanf I found at least a couple of old issues in github where this happened before so I am starting to think it is a bug - some regression. Unless someone running the latest software on an ESP32 can chime in with their wifi_info sensors working fine, I am afraid I’ll have to wait for the github ticket to be reviewed.

2 Likes

Allright. I suppose your already tried board: nodemcu-32s as part of the troubleshooting proces you mentioned, right?

Yes, along with a number of other boards and frameworks. I am not certain but in my research I found that the boards are only for pin assignments and most esp32 point back to esp32dev (which I tried). I then found references to the arduino framework related to wifi_info so that may be related but with or without, nothing changes.

However, I keep forgetting that the desired information does appear on the web interface for the device… it is just not making it into HA.

oh yeah, I see the arduino reference in the github issue. Maybe it will lead to an answer there then, just like you said.