SDS011 fail (unknown state) sensor with ESPHOME

Hello,

I’m beginning on ESPHOME, no on HA :+1: and I would like to use my SDS011 with ESPHOME.

After installed my ESPHOME on docker, I create a new device (based on Nodemcu) and I completed my config file for the SDS011 (as you see below), compile and flash my nodemcu with the bin file. But when I add my esphome on HA, the state through from available to unknow but my nodemcu is correctly connect and I don’t understand why it doesn’t work. Could you help me ?
For information, I listen the SDS011 fan work each 5 minutes and I don’t have more information on my log and I tried to invert my pin (D7 and D8 to try) and it’s the same with D6 and D7 (with change the config file and upload of course)

esphome:
  name: sds011
  platform: ESP8266
  board: nodemcuv2

wifi:
  ssid: "Wifi"
  password: "password"
  manual_ip:
    static_ip: 192.168.1.76
    gateway: 192.168.1.1
    subnet: 255.255.255.0

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:

# Example configuration entry
uart:
  rx_pin: D8
  tx_pin: D7
  baud_rate: 9600

sensor:
  - platform: sds011
    pm_2_5:
      name: "Part. 2.5"
    pm_10_0:
      name: "Part. 10"
    update_interval: 5min

I just tried with an other docker server (arm7 and amd64) but it’s the same thing…

nobody ? :sleepy:

I use an ESP32 for this but should be the same i think.

Don’t know if it helps (maybe you already tried it) but i found that the RX pin of the SDS011 needs to be connected to the RX of my ESP32 (Not the TX, that you would expect). And de TX needs to go to TX.
I use UART0 for that on GPIO1 (ESP32 - TX) and GPIO3 (ESP32 - RX).

uart:
  rx_pin: GPIO3
  tx_pin: GPIO1
  baud_rate: 9600

sensor:
  - platform: sds011
    pm_2_5:
      name: "Particulate Matter <2.5µm Concentration"
    pm_10_0:
      name: "Particulate Matter <10.0µm Concentration"
    update_interval: 5min

It works (perfectly).

[15:49:01][D][sds011:154]: Got PM2.5 Concentration: 11.5 µg/m³, PM10.0 Concentration: 14.9 µg/m³
[15:49:01][D][sensor:092]: 'Particulate Matter <2.5µm Concentration': Sending state 11.50000 µg/m³ with 1 decimals of accuracy
[15:49:01][D][sensor:092]: 'Particulate Matter <10.0µm Concentration': Sending state 14.90000 µg/m³ with 1 decimals of accuracy
[15:49:02][D][sds011:154]: Got PM2.5 Concentration: 11.4 µg/m³, PM10.0 Concentration: 14.6 µg/m³
[15:49:02][D][sensor:092]: 'Particulate Matter <2.5µm Concentration': Sending state 11.40000 µg/m³ with 1 decimals of accuracy
[15:49:02][D][sensor:092]: 'Particulate Matter <10.0µm Concentration': Sending state 14.60000 µg/m³ with 1 decimals of accuracy
[15:49:03][D][sds011:154]: Got PM2.5 Concentration: 11.4 µg/m³, PM10.0 Concentration: 14.6 µg/m³
[15:49:03][D][sensor:092]: 'Particulate Matter <2.5µm Concentration': Sending state 11.40000 µg/m³ with 1 decimals of accuracy
[15:49:03][D][sensor:092]: 'Particulate Matter <10.0µm Concentration': Sending state 14.60000 µg/m³ with 1 decimals of accuracy
[15:49:04][D][sds011:154]: Got PM2.5 Concentration: 11.4 µg/m³, PM10.0 Concentration: 14.4 µg/m³

I only have to find out how the update_interval of 5min is going to work.

After setting the update_interval to 10min it worked…
image image