Esp8266 air sensor project - issues flashing node - yaml never finishes

I am attempting to build an an air quality sensor using 2 websites Home Tech Hacker and Pieter Brinkman as a guide.

I’ve made it to the point where I need to install/flash the software on the ESP8266. When I do, it never finishes. It runs, and runs, and runs…

I’ve waited over an hour before thinking, something is wrong.

That all being said, this is my first time trying this or anything similar I’ve only had a HA server for a week. I managed to get this Shelly garage door switch working so I was feeling good about my odds for this air sensor!

Some info:

I have the ESP8266 plugged directly into a USB3 port on the HA server

HA is installed on a Intel NUK with a 4-Core I-3 and 12G

  • Core 2025.5.1
  • Supervisor 2025.04.1
  • Operating System 15.2
  • Frontend 20250509.0

I’ve tried:

Searching the internet for the same issue. Found similar but not the same.
Deleting and creating a new yaml file
Flashing using wireless

It “appears” the sensor is working as the logs show sensor readings similar to the picture above.

When i look for the sensor data under devices or entities, i dont see anything.

In ESP home, it shows the sensor is offline.

.yaml file

esphome:
  name: basement-air-sen1
  friendly_name: basement-air-sen1

esp8266:
  board: nodemcu

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "runEQWBWuZotyBKo6GwzKsRR3V3rTwd4OMOvF9y1474="

ota:
  - platform: esphome
    password: "3ab4db8da2a3d6ad81feca514f180aa2"

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

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Basement-Air-Sen1"
    password: "xxxxx"

captive_portal:
    
uart:
  tx_pin: D6
  rx_pin: D7
  baud_rate: 9600

sensor:
  - platform: pmsx003
    type: PMSX003
    pm_1_0:
      name: "Particulate Matter <1.0µm Concentration"
    pm_2_5:
      name: "Particulate Matter <2.5µm Concentration"
    pm_10_0:
      name: "Particulate Matter <10.0µm Concentration"
    update_interval: 60s

switch:
  - platform: gpio
    pin:
      number: D3
    id: measure_aq
    name: "Start AQS Sensor 1"

interval:
  - interval: 120s
    then:
      - switch.turn_on: measure_aq
      - delay: 30s
      - switch.turn_off: measure_aq

What have I done wrong?

Has the device been discovered and did you add it to home assistant?

Have you tried adding it manually (add integration on the Devices & Services page)?

Also, it’s a low risk but you should not share your api encryption key publicly. Use the secrets file to prevent this occurring again.

Yes - it’s finished compiling, is installed on your ESP device and is running. The log will just sit there until it sends information or receives info from HA (or via some other means).

As Tom suggested - maybe the issue is that it hasn’t been discovered by the ESPHome integration (which is NOT ESPHome builder, they are different things).

This sounds more like a network issue. Reload the firmware - staying connected to the device, then post the log (as text, not an image) from startup. That will let us see what’s happening on your network connection.

Thanks for the tip on the API key. I saw the wifi was in the secrets file, but I missed the api key. Now i need to figure out how to change it and move it to the secrets file.

Sounds like I missed a step. I flashed the device, but did not add it as a device.

It was not automatically discovered. I see the device in the DHCP table.

When I try to add it manually, it says unable to connect and ensuring an api section is in the config file.

Is this correct?

You are correct. The server has 2 network cards, 1 ethernet and 1 USB wireless.

The Wireless adapter is connected to the IOT subnet where all the IOT devices live. HA shows the wifi as disconnected. This is probably why the device was not discovered automatically, and why I can’t add it manually.

This is actually the second time the wireless has stopped. Is there some power save setting in HA I need to adjust?

Not as far as I am aware.

I have dual networks configured as well, my main issue is that sometimes HA forgets the wireless network on restart (I assume because my router isn’t quick enough responding). I am not sure of the status of dual homed networks support in HA, some say “not at all” - but hey - it lets you configure them. :slight_smile:

I did restart once earlier. maybe that is when it happens…

Rebooted just now since HA wouldn’t access the USB card. Afterwards, I was able to manually add the air sensor.

1 Like