Newbie struggling with sonoff TH16 - 2 of 4 working and lost!

I am in the process of migrating from Domoticz to HA and most has been going well but I have come unstuck with my Sonoff TH16.

using ESPHome I have flashed all devices and have them all showing in HA.

all 4 are using the same code… this one works :

esphome:
  name: downstairs
  platform: ESP8266
  board: esp01_1m

wifi:
  ssid: ###
  password:###

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

captive_portal:

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:

#Outputs
output:


switch:
  - platform: gpio
    pin: GPIO12
    name: "downstairs"
    id: downstairs_relay

binary_sensor:
  - platform: gpio
    pin:
      number: GPIO0
      inverted: True
    id: downstairs_relay_button
    on_press:
      then:
        - switch.toggle: downstairs_relay
sensor:
  - platform: dht
    model: si7021
    pin: GPIO14
    humidity:
      name: "Downstairs Humidity"
      on_value_range:
        - above: 90.0
          then:
            - switch.turn_on: downstairs_relay
        - below: 90.0
          then:
            - switch.turn_off: downstairs_relay
    temperature:
      name: "Downstairs Temperature"
    update_interval: 10s

this one errors out “Invalid readings! Please check your wiring (pull-up resistor, pin number)”

esphome:
  name: bathroom_fan
  platform: ESP8266
  board: esp01_1m

wifi:
  ssid: ###
  password: ###

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

captive_portal:

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:

#Outputs
output:


switch:
  - platform: gpio
    pin: GPIO12
    name: "Bathroom Fan"
    id: bathroom_fan_relay

binary_sensor:
  - platform: gpio
    pin:
      number: GPIO0
      inverted: True
    id: bathroom_fan_relay_button
    on_press:
      then:
        - switch.toggle: bathroom_fan_relay
sensor:
  - platform: dht
    model: si7021
    pin: GPIO14
    humidity:
      name: "Bathroom Humidity"
      on_value_range:
        - above: 90.0
          then:
            - switch.turn_on: bathroom_fan_relay
        - below: 90.0
          then:
            - switch.turn_off: bathroom_fan_relay
    temperature:
      name: "Bathroom Temperature"
    update_interval: 10s

so the devices are configured with a built in 5k pullup to GPIO14

while I am sure it must be something daft I have done I have run out of ideas. can anyone help?

If you’re seeing lots of invalid temperature/humidity warnings in the logs, try manually setting the DHT model with the model: configuration variable. Other problems could be wrong pull-up resistor values on the DATA pin or too long cables.

Where have you configured that? Afaik if you want that to be used you must configure it with

mode: INPUT_PULLUP

Below pin:

sorry poor choice of words by me. the Sonoff TH16 have inbuilt 5k pullup to the GPIO14 connection so no software configuration.

as the sensor is a si7021 the model variable is used as auto detect does not work according to the documentation.

just checked the logs and found :

* Platform esphome does not generate unique IDs. ID bathroom_fansensorbathroom_temperature already exists - ignoring sensor.bathroom_temperature
* Platform esphome does not generate unique IDs. ID bathroom_fansensorbathroom_humidity already exists - ignoring sensor.bathroom_humidity 

I think I know what has happened now. looks like these are being disabled in HA. while I as working on this problem I suspected a hardware fault with bathroom so swapped the code and device with my test unit. and I think I didn’t cleanly remove the entity.

off to have a play at removing the device again and see if I can resolve this problem

looks like the code was fine, I did a bit of houskeeping to tidy up broken entities and re-flashed the not working units and then found the plug and socket connection on the Sonoff is easily interrupted. one wasnt seating fully and the other was being pushed out of line by the case.

a bit of mechanical tweaking solved the issue on both and I have all 4 working

Good :+1: enjoy