Temp Senor Showing Negative After Power Up

Have a NodeMCU running ESPHome, and it has an unusual behaviour… after power on, the temperature shows on the screen as a negative number. So after power is applied the temperature will often display -5.4 degrees, but after I initiate the INSTALL in ESPHome the issue is resolved. The NodeMCU will run perfectly until power is lost and the NodeMCU restarts.

Here’s the ESPHome config…

esphome:
  name: housemon
  platform: ESP8266
  board: nodemcuv2

wifi:
  ssid: !secret ...................
  password: !secret ................

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: ...........
    password: .............

captive_portal:

time:
  - platform: homeassistant
    id: esptime

font:
  - file: 'slkscr.ttf'
    id: font1
    size: 9

  - file: 'BebasNeue-Regular.ttf'
    id: font2
    size: 48

  - file: 'arial.ttf'
    id: font3
    size: 14

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:

status_led:
  pin: GPIO2

sensor:
  - platform: dht
    pin: GPIO14
    temperature:
      name: "Family Room Temperature"
    humidity:
      name: "Family Room Humidity"
    update_interval: 60s
  - platform: homeassistant
    id: inside_temperature
    entity_id: sensor.family_room_temperature
    internal: true

i2c:
  sda: GPIO5
  scl: GPIO4
  scan: false

display:
  - platform: ssd1306_i2c
    model: "SH1106 128x64"
    address: 0x3C
    lambda: |-
      // Print "gregoinc" in top center.
      it.printf(64, 0, id(font1), TextAlign::TOP_CENTER, "gregoinc");

      // Print time in HH:MM formatsensor.family_room_temperature
      it.strftime(0, 60, id(font2), TextAlign::BASELINE_LEFT, "%H:%M", id(esptime).now());

      // Print inside temperature (from homeassistant sensor)
      if (id(inside_temperature).has_state()) {
        it.printf(127, 23, id(font3), TextAlign::TOP_RIGHT , "%.1f°", id(inside_temperature).state);
      }

I have tried a number of options but still the same issue upon restart. Any ideas appreciated.

Try supplying the model: option for your DHT sensor. The auto detect is a bit hit and miss.

Thanks Tom, solved the issue. Much appreciated.

1 Like