PHYSICALLY TESTED · ESP8266

ESP8266 + DHT11

The exact NodeMCU wiring, non-blocking sampling, secure WebSocket transport and failure behavior used in HomeAutoPro hardware regression.

✓ Physically tested

Wiring

DHT11 VCC3.3 V
DHT11 GNDGND
DHT11 DATAD2 board label · GPIO4
Onboard LEDD4 · GPIO2 · active-low
Board labels are not universal. Confirm the selected board variant and use a DATA-to-3.3 V pull-up when the sensor module does not include one.

Validated behavior

Temperature

Reject NaN; never translate a failed read into zero.

Humidity

Sample DHT11 no faster than approximately 2.5 seconds.

Power + PWM

The onboard LED is active-low, so PWM duty is inverted.

Realtime

Keep socket.loop() non-blocking and acknowledge commands with applied state.

{"type":"telemetry","telemetry":{"temperature":28.4,"humidity":56.2}}

Failure handling

  • Publish on meaningful change and at a 60-second maximum heartbeat.
  • Retain the last valid sensor reading through transient checksum/timing failures.
  • Reconnect with a bounded interval and enable WebSocket heartbeat.
  • Keep Wi-Fi and Device Secret values in ignored local configuration.