ESP-01S keeps rebooting when inserted in DHT22 shield

Hi Guys,
i’ve bought some DHT22 shields. The one where you can just insert a ESP-01S.

I use this code

esphome:
  name: garagesensor
  platform: ESP8266
  board: esp01_1m

# WiFi connection, correct these
# with values for your WiFi.
wifi:
  ssid: "MY SSID"
  password: "MY PSWD"

# Enable logging.
logger:
  baud_rate: 0
  level: VERY_VERBOSE
# Enable Home Assistant API.
api:

# Enable over-the-air updates.
ota:

# Enable Web server.
web_server:
  port: 80


# Sync time with Home Assistant.
time:
  - platform: homeassistant
    id: homeassistant_time

# Text sensors with general information.
text_sensor:
  # Expose ESPHome version as sensor.
  - platform: version
    name: Garagesensor ESPHome Version
  # Expose WiFi information as sensors.
  - platform: wifi_info
    ip_address:
      name: Garagesensor IP
    ssid:
      name: Garagesensor SSID
    bssid:
      name: Garagesensor BSSID

# Sensors with general information.
sensor:
  # Uptime sensor.
  - platform: uptime
    name: Garagesensor Uptime

  # WiFi Signal sensor.
  - platform: wifi_signal
    name: Garagesensor WiFi Signal
    update_interval: 60s

  # Luchtvochtigheid en Temperatuur sensor.
  - platform: dht
    pin: GPIO2
    model: DHT22
    update_interval: 60s
    temperature:
      name: "Garage Temperatuur"
      filters:
        - sliding_window_moving_average:
            window_size: 15
            send_every: 15
            send_first_at: 15
    humidity:
      name: "Garage Luchtvochtigheid"
      filters:
        - sliding_window_moving_average:
            window_size: 15
            send_every: 15
            send_first_at: 15

#uart:
#  tx_pin: GPIO1
#  baud_rate: 9600
  
# Exposed switches.
switch:
  # Switch to restart the Garagesensor.
  - platform: restart
    name: Garagesensor Restart


The ESP-01s seems to be rebooting all the time. If i’m lucky i can get a correct reading of temperature and humidity, but then the connection is lost for a while and after a while the ESP-01s seems to be online again (for a few seconds).

If tried some different things. I have found a way to keep the ESP-01s running. The solution is to unplug it from the DHT22 shield and just connect the 3v3 (and chip enable pin) and a GND to a FTDI adapter. Then the ESP-01s powers on and keeps running. You can see the uptime of the ESP-01s keeps getting higher and higher.

But then when i plug in the ESP-01s in the DHT22 shield and power the DHT22 shield with 5v from the FTDI adapter (i have the red one). The ESP-01s keeps rebooting. Also on my router i can see that the connection with the ESP-01s keeps dropping.

Anyone has any ideas why the ESP-01s keeps rebooting when plugged in to the DHT22 shield?

Try to flash Tasmota on it, and see if it reboots too.
-> If it reboots : problem with the esp-01s and/or shield
-> if it does not reboot : problem with your esphome code.

The esphome log? Where is it?

This is some log when running the ESP-01s without DHT22 shield:

INFO Connecting to garagesensor.local:6053 (192.168.1.249)
INFO Successfully connected to garagesensor.local
[11:01:55][I][app:100]: ESPHome version 1.14.5 compiled on Aug 13 2020, 17:48:20
[11:01:55][C][wifi:415]: WiFi:
[11:01:55][C][wifi:283]:   SSID: [redacted]
[11:01:55][C][wifi:284]:   IP Address: 192.168.1.249
[11:01:55][C][wifi:286]:   BSSID: [redacted]
[11:01:55][C][wifi:287]:   Hostname: 'garagesensor'
[11:01:55][C][wifi:291]:   Signal strength: -72 dB ▂▄▆█
[11:01:55][V][wifi:293]:   Priority: 0.0
[11:01:55][C][wifi:295]:   Channel: 1
[11:01:55][C][wifi:296]:   Subnet: 255.255.255.0
[11:01:55][C][wifi:297]:   Gateway: 192.168.1.1
[11:01:55][C][wifi:298]:   DNS1: 192.168.1.1
[11:01:55][C][wifi:299]:   DNS2: (IP unset)
[11:01:55][C][uptime.sensor:030]: Uptime Sensor 'Garagesensor Uptime'
[11:01:55][C][uptime.sensor:030]:   Unit of Measurement: 's'
[11:01:55][C][uptime.sensor:030]:   Accuracy Decimals: 0
[11:01:55][C][uptime.sensor:030]:   Icon: 'mdi:timer'
[11:01:55][V][uptime.sensor:030]:   Unique ID: 'bcddc27b069a-uptime'
[11:01:55][C][logger:175]: Logger:
[11:01:55][C][logger:176]:   Level: VERY_VERBOSE
[11:01:55][C][logger:177]:   Log Baud Rate: 115200
[11:01:55][C][logger:178]:   Hardware UART: UART0
[11:01:55][C][dht:017]: DHT:
[11:01:55][C][dht:018]:   Pin: GPIO2 (Mode: INPUT)
[11:01:55][C][dht:024]:   Model: DHT22 (or equivalent)
[11:01:55][C][dht:027]:   Update Interval: 60.0s
[11:01:55][C][dht:029]:   Temperature 'Garage Temperatuur'
[11:01:55][C][dht:029]:     Unit of Measurement: '°C'
[11:01:55][C][dht:029]:     Accuracy Decimals: 1
[11:01:55][C][dht:029]:     Icon: 'mdi:thermometer'
[11:01:55][C][dht:030]:   Humidity 'Garage Luchtvochtigheid'
[11:01:55][C][dht:030]:     Unit of Measurement: '%'
[11:01:55][C][dht:030]:     Accuracy Decimals: 0
[11:01:55][C][dht:030]:     Icon: 'mdi:water-percent'
[11:01:55][C][restart:021]: Restart Switch 'Garagesensor Restart'
[11:01:55][C][restart:021]:   Icon: 'mdi:restart'
[11:01:55][C][homeassistant.time:010]: Home Assistant Time:
[11:01:55][C][homeassistant.time:011]:   Timezone: 'CET-1CEST-2,M3.4.0/2,M10.5.0/3'
[11:01:55][C][version.text_sensor:015]: Version Text Sensor 'Garagesensor ESPHome Version'
[11:01:55][C][version.text_sensor:015]:   Icon: 'mdi:new-box'
[11:01:55][V][version.text_sensor:015]:   Unique ID: 'bcddc27b069a-version'
[11:01:55][C][web_server:123]: Web Server:
[11:01:55][C][web_server:124]:   Address: garagesensor.local:80
[11:01:55][C][ota:029]: Over-The-Air Updates:
[11:01:55][C][ota:030]:   Address: garagesensor.local:8266
[11:01:55][C][api:095]: API Server:
[11:01:55][C][api:096]:   Address: garagesensor.local:6053
[11:01:55][C][wifi_info:009]: WifiInfo IPAddress 'Garagesensor IP'
[11:01:55][V][wifi_info:009]:   Unique ID: 'bcddc27b069a-wifiinfo-ip'
[11:01:55][C][wifi_signal.sensor:009]: WiFi Signal 'Garagesensor WiFi Signal'
[11:01:55][C][wifi_signal.sensor:009]:   Unit of Measurement: 'dB'
[11:01:55][C][wifi_signal.sensor:009]:   Accuracy Decimals: 0
[11:01:55][C][wifi_signal.sensor:009]:   Icon: 'mdi:wifi'
[11:01:55][V][wifi_signal.sensor:009]:   Unique ID: 'bcddc27b069a-wifisignal'
[11:01:55][C][wifi_info:010]: WifiInfo SSID 'Garagesensor SSID'
[11:01:55][V][wifi_info:010]:   Unique ID: 'bcddc27b069a-wifiinfo-ssid'
[11:01:55][C][wifi_info:011]: WifiInfo BSSID 'Garagesensor BSSID'
[11:01:55][V][wifi_info:011]:   Unique ID: 'bcddc27b069a-wifiinfo-bssid'
[11:01:56][VV][scheduler:131]: Running interval '' with interval=10000 last_execution=32912 (now=42913)
[11:01:59][VV][api.service:250]: on_ping_request: PingRequest {}
[11:01:59][VV][api.service:035]: send_ping_response: PingResponse {}
[11:02:04][VV][scheduler:131]: Running interval 'update' with interval=60000 last_execution=4294957661 (now=50365)
[11:02:04][W][dht:160]: Requesting data from DHT failed!
[11:02:04][W][dht:060]: Invalid readings! Please check your wiring (pull-up resistor, pin number).
[11:02:04][V][sensor:013]: 'Garage Temperatuur': Received new state nan
[11:02:04][VV][sensor.filter:013]: Filter(0x3fff3774)::input(nan)
[11:02:04][VV][sensor.filter:100]: SlidingWindowMovingAverageFilter(0x3fff3774)::new_value(nan) -> 0.000000
[11:02:04][V][sensor:013]: 'Garage Luchtvochtigheid': Received new state nan
[11:02:04][VV][sensor.filter:013]: Filter(0x3fff3c34)::input(nan)
[11:02:04][VV][sensor.filter:100]: SlidingWindowMovingAverageFilter(0x3fff3c34)::new_value(nan) -> 0.000000
[11:02:04][VV][api.service:250]: on_ping_request: PingRequest {}
[11:02:04][VV][api.service:035]: send_ping_response: PingResponse {}
[11:02:06][VV][scheduler:131]: Running interval '' with interval=10000 last_execution=42912 (now=52912)
[11:02:07][VV][api.service:250]: on_ping_request: PingRequest {}
[11:02:07][VV][api.service:035]: send_ping_response: PingResponse {}
[11:02:09][VV][api.service:250]: on_ping_request: PingRequest {}
[11:02:09][VV][api.service:035]: send_ping_response: PingResponse {}
[11:02:13][VV][scheduler:131]: Running interval 'update' with interval=60000 last_execution=4294966987 (now=59691)
[11:02:13][V][sensor:013]: 'Garagesensor WiFi Signal': Received new state -72.000000
[11:02:13][D][sensor:092]: 'Garagesensor WiFi Signal': Sending state -72.00000 dB with 0 decimals of accuracy
[11:02:13][VV][api.service:120]: send_sensor_state_response: SensorStateResponse {
  key: 1059641767
  state: -72
  missing_state: NO
}
[11:02:15][VV][api.service:250]: on_ping_request: PingRequest {}
[11:02:15][VV][api.service:035]: send_ping_response: PingResponse {}
[11:02:16][VV][scheduler:131]: Running interval '' with interval=10000 last_execution=52912 (now=62912)
[11:02:20][VV][api.service:250]: on_ping_request: PingRequest {}
[11:02:20][VV][api.service:035]: send_ping_response: PingResponse {}
[11:02:22][VV][api.service:250]: on_ping_request: PingRequest {}
[11:02:22][VV][api.service:035]: send_ping_response: PingResponse {}
[11:02:25][VV][api.service:250]: on_ping_request: PingRequest {}
[11:02:25][VV][api.service:035]: send_ping_response: PingResponse {}
[11:02:26][VV][scheduler:131]: Running interval '' with interval=10000 last_execution=62912 (now=72920)
[11:02:30][VV][api.service:250]: on_ping_request: PingRequest {}
[11:02:30][VV][api.service:035]: send_ping_response: PingResponse {}
[11:02:35][VV][api.service:250]: on_ping_request: PingRequest {}
[11:02:35][VV][api.service:035]: send_ping_response: PingResponse {}
[11:02:36][VV][scheduler:131]: Running interval '' with interval=10000 last_execution=72912 (now=82917)
[11:02:37][VV][api.service:250]: on_ping_request: PingRequest {}
[11:02:37][VV][api.service:035]: send_ping_response: PingResponse {}
[11:02:40][VV][api.service:250]: on_ping_request: PingRequest {}
[11:02:40][VV][api.service:035]: send_ping_response: PingResponse {}
[11:02:45][VV][api.service:250]: on_ping_request: PingRequest {}
[11:02:45][VV][api.service:035]: send_ping_response: PingResponse {}

And this is the log when ESP-01s is plugged in the DHT22 shield. You can see some temp and hum readings and then the connection is lost again:

INFO Connecting to garagesensor.local:6053 (192.168.1.249)
INFO Successfully connected to garagesensor.local
[11:05:43][VV][api.service:250]: on_ping_request: PingRequest {}
[11:05:44][VV][api.service:035]: send_ping_response: PingResponse {}
[11:05:44][VV][scheduler:131]: Running interval 'update' with interval=60000 last_execution=30745 (now=90757)
[11:05:44][VV][dht:174]: Data: Hum=0b0000001010001101, Temp=0b0000000100011101, Checksum=0b10101101
[11:05:44][D][dht:048]: Got Temperature=28.5°C Humidity=65.3%
[11:05:44][V][sensor:013]: 'Garage Temperatuur': Received new state 28.500000
[11:05:46][VV][sensor.filter:013]: Filter(0x3fff3774)::input(28.500000)
[11:05:46][VV][sensor.filter:100]: SlidingWindowMovingAverageFilter(0x3fff3774)::new_value(28.500000) -> 28.450001
[11:05:46][V][sensor:013]: 'Garage Luchtvochtigheid': Received new state 65.300003
[11:05:46][VV][sensor.filter:013]: Filter(0x3fff3c34)::input(65.300003)
[11:05:46][VV][sensor.filter:100]: SlidingWindowMovingAverageFilter(0x3fff3c34)::new_value(65.300003) -> 65.550003
[11:05:46](Message skipped because it was too big to fit in TCP buffer - This is only cosmetic)
[11:05:49][VV][api.service:250]: on_ping_request: PingRequest {}
[11:05:50][VV][api.service:035]: send_ping_response: PingResponse {}
[11:05:50][VV][api.service:222]: on_hello_request: HelloRequest {
  client_info: 'Home Assistant 0.113.3'
}
[11:05:50][V][api.connection:567]: Hello from client: 'Home Assistant 0.113.3 (192.168.1.209)'
[11:05:50][VV][api.service:010]: send_hello_response: HelloResponse {
  api_version_major: 1
  api_version_minor: 3
  server_info: 'garagesensor (esphome v1.14.5)'
}
WARNING Disconnected from API: Timeout while waiting for message response!
WARNING Error resolving IP address of garagesensor.local. Is it connected to WiFi?
WARNING (If this error persists, please set a static IP address: https://esphome.io/components/wifi.html#manual-ips)
WARNING Couldn't connect to API (Error resolving IP address: Error resolving address with mDNS: Did not respond. Maybe the device is offline., [Errno -5] No address associated with hostname). Trying to reconnect in 1 seconds
WARNING Error resolving IP address of garagesensor.local. Is it connected to WiFi?
WARNING (If this error persists, please set a static IP address: https://esphome.io/components/wifi.html#manual-ips)
WARNING Couldn't connect to API (Error resolving IP address: Error resolving address with mDNS: Did not respond. Maybe the device is offline., [Errno -5] No address associated with hostname). Trying to reconnect in 1 seconds
WARNING Error resolving IP address of garagesensor.local. Is it connected to WiFi?
WARNING (If this error persists, please set a static IP address: https://esphome.io/components/wifi.html#manual-ips)
WARNING Couldn't connect to API (Error resolving IP address: Error resolving address with mDNS: Did not respond. Maybe the device is offline., [Errno -5] No address associated with hostname). Trying to reconnect in 2 seconds
INFO Connecting to garagesensor.local:6053 (192.168.1.249)
INFO Successfully connected to garagesensor.local
[11:06:32][VV][api.service:342]: on_get_time_response: GetTimeResponse {
  epoch_seconds: 1597395984
}
WARNING Disconnected from API: Timeout while waiting for message response!
WARNING Error resolving IP address of garagesensor.local. Is it connected to WiFi?
WARNING (If this error persists, please set a static IP address: https://esphome.io/components/wifi.html#manual-ips)
WARNING Couldn't connect to API (Error resolving IP address: Error resolving address with mDNS: Did not respond. Maybe the device is offline., [Errno -5] No address associated with hostname). Trying to reconnect in 1 seconds
WARNING Error resolving IP address of garagesensor.local. Is it connected to WiFi?
WARNING (If this error persists, please set a static IP address: https://esphome.io/components/wifi.html#manual-ips)
WARNING Couldn't connect to API (Error resolving IP address: Error resolving address with mDNS: Did not respond. Maybe the device is offline., [Errno -5] No address associated with hostname). Trying to reconnect in 1 seconds
WARNING Error resolving IP address of garagesensor.local. Is it connected to WiFi?
WARNING (If this error persists, please set a static IP address: https://esphome.io/components/wifi.html#manual-ips)
WARNING Couldn't connect to API (Error resolving IP address: Error resolving address with mDNS: Did not respond. Maybe the device is offline., [Errno -5] No address associated with hostname). Trying to reconnect in 2 seconds
WARNING Error resolving IP address of garagesensor.local. Is it connected to WiFi?
WARNING (If this error persists, please set a static IP address: https://esphome.io/components/wifi.html#manual-ips)
WARNING Couldn't connect to API (Error resolving IP address: Error resolving address with mDNS: Did not respond. Maybe the device is offline., [Errno -5] No address associated with hostname). Trying to reconnect in 3 seconds
WARNING Error resolving IP address of garagesensor.local. Is it connected to WiFi?
WARNING (If this error persists, please set a static IP address: https://esphome.io/components/wifi.html#manual-ips)
WARNING Couldn't connect to API (Error resolving IP address: Error resolving address with mDNS: Did not respond. Maybe the device is offline., [Errno -5] No address associated with hostname). Trying to reconnect in 5 seconds
WARNING Error resolving IP address of garagesensor.local. Is it connected to WiFi?
WARNING (If this error persists, please set a static IP address: https://esphome.io/components/wifi.html#manual-ips)
WARNING Couldn't connect to API (Error resolving IP address: Error resolving address with mDNS: Did not respond. Maybe the device is offline., [Errno -5] No address associated with hostname). Trying to reconnect in 7 seconds
WARNING Error resolving IP address of garagesensor.local. Is it connected to WiFi?
WARNING (If this error persists, please set a static IP address: https://esphome.io/components/wifi.html#manual-ips)
WARNING Couldn't connect to API (Error resolving IP address: Error resolving address with mDNS: Did not respond. Maybe the device is offline., [Errno -5] No address associated with hostname). Trying to reconnect in 11 seconds
WARNING Error resolving IP address of garagesensor.local. Is it connected to WiFi?
WARNING (If this error persists, please set a static IP address: https://esphome.io/components/wifi.html#manual-ips)
WARNING Couldn't connect to API (Error resolving IP address: Error resolving address with mDNS: Did not respond. Maybe the device is offline., [Errno -5] No address associated with hostname). Trying to reconnect in 17 seconds
WARNING Error resolving IP address of garagesensor.local. Is it connected to WiFi?
WARNING (If this error persists, please set a static IP address: https://esphome.io/components/wifi.html#manual-ips)
WARNING Couldn't connect to API (Error resolving IP address: Error resolving address with mDNS: Did not respond. Maybe the device is offline., [Errno -5] No address associated with hostname). Trying to reconnect in 25 seconds
WARNING Error resolving IP address of garagesensor.local. Is it connected to WiFi?
WARNING (If this error persists, please set a static IP address: https://esphome.io/components/wifi.html#manual-ips)
WARNING Couldn't connect to API (Error resolving IP address: Error resolving address with mDNS: Did not respond. Maybe the device is offline., [Errno -5] No address associated with hostname). Trying to reconnect in 30 seconds

That is NOT a reboot problem. It’s a connection problem.

Maybe this log helps a bit better. I’ve reflashed the ESP-01s with static IP and power save to none. I thought setting a static IP on the router side (unifi USG) would be enough, but i though maybe this was better.
So with this config:

wifi:
  ssid: "SSID"
  password: "PSWD"
  manual_ip:
    # Set this to the IP of the ESP
    static_ip: 192.168.1.249
    # Set this to the IP address of the router. Often ends with .1
    gateway: 192.168.1.1
    # The subnet of the network. 255.255.255.0 works for most home networks.
    subnet: 255.255.255.0
  power_save_mode: none

i am still getting this log:

INFO Connecting to 192.168.1.249:6053 (192.168.1.249)
INFO Successfully connected to 192.168.1.249
[11:16:38][I][app:100]: ESPHome version 1.14.5 compiled on Aug 14 2020, 11:13:48
[11:16:38][C][wifi:415]: WiFi:
[11:16:38][C][wifi:283]:   SSID: [redacted]
[11:16:38][C][wifi:284]:   IP Address: 192.168.1.249
[11:16:38][C][wifi:286]:   BSSID: [redacted]
[11:16:38][C][wifi:287]:   Hostname: 'garagesensor'
[11:16:38][C][wifi:291]:   Signal strength: -60 dB ▂▄▆█
[11:16:38][V][wifi:293]:   Priority: 0.0
[11:16:38][C][wifi:295]:   Channel: 1
[11:16:38][C][wifi:296]:   Subnet: 255.255.255.0
[11:16:38][C][wifi:297]:   Gateway: 192.168.1.1
[11:16:38][C][wifi:298]:   DNS1: (IP unset)
[11:16:38][C][wifi:299]:   DNS2: (IP unset)
[11:16:38][C][uptime.sensor:030]: Uptime Sensor 'Garagesensor Uptime'
[11:16:38][C][uptime.sensor:030]:   Unit of Measurement: 's'
[11:16:38][C][uptime.sensor:030]:   Accuracy Decimals: 0
[11:16:38][C][uptime.sensor:030]:   Icon: 'mdi:timer'
[11:16:38][V][uptime.sensor:030]:   Unique ID: 'bcddc27b069a-uptime'
[11:16:38][C][logger:175]: Logger:
[11:16:38][C][logger:176]:   Level: VERY_VERBOSE
[11:16:38][C][logger:177]:   Log Baud Rate: 115200
[11:16:38][C][logger:178]:   Hardware UART: UART0
[11:16:38][C][dht:017]: DHT:
[11:16:38][C][dht:018]:   Pin: GPIO2 (Mode: INPUT)
[11:16:38][C][dht:024]:   Model: DHT22 (or equivalent)
[11:16:38][C][dht:027]:   Update Interval: 60.0s
[11:16:41][C][dht:029]:   Temperature 'Garage Temperatuur'
[11:16:41][C][dht:029]:     Unit of Measurement: '°C'
[11:16:41](Message skipped because it was too big to fit in TCP buffer - This is only cosmetic)
[11:16:41](Message skipped because it was too big to fit in TCP buffer - This is only cosmetic)
[11:16:41](Message skipped because it was too big to fit in TCP buffer - This is only cosmetic)
[11:16:41](Message skipped because it was too big to fit in TCP buffer - This is only cosmetic)
[11:16:41](Message skipped because it was too big to fit in TCP buffer - This is only cosmetic)
[11:16:41](Message skipped because it was too big to fit in TCP buffer - This is only cosmetic)
[11:16:41](Message skipped because it was too big to fit in TCP buffer - This is only cosmetic)
[11:16:43][VV][api.service:250]: on_ping_request: PingRequest {}
[11:16:45][VV][api.service:035]: send_ping_response: PingResponse {}
[11:16:48][VV][scheduler:131]: Running interval '' with interval=10000 last_execution=7582 (now=17588)
[11:16:50][VV][api.service:250]: on_ping_request: PingRequest {}
[11:16:55][VV][api.service:035]: send_ping_response: PingResponse {}
[11:16:56][V][api.connection:672]: Error: Disconnecting ESPHome v1.14.5 (192.168.1.209)
WARNING Disconnected from API: Timeout while waiting for message response!
INFO Connecting to 192.168.1.249:6053 (192.168.1.249)
INFO Successfully connected to 192.168.1.249
WARNING Disconnected from API: Timeout while waiting for message response!
INFO Connecting to 192.168.1.249:6053 (192.168.1.249)
WARNING Couldn't connect to API (Error connecting to 192.168.1.249: timed out). Trying to reconnect in 1 seconds
INFO Connecting to 192.168.1.249:6053 (192.168.1.249)
INFO Successfully connected to 192.168.1.249
WARNING Disconnected from API: Timeout while waiting for message response!
INFO Connecting to 192.168.1.249:6053 (192.168.1.249)
INFO Successfully connected to 192.168.1.249
[11:17:44][VV][api.service:250]: on_ping_request: PingRequest {}
[11:17:44][VV][api.service:035]: send_ping_response: PingResponse {}
[11:17:47][VV][scheduler:131]: Running interval '' with interval=10000 last_execution=67582 (now=77583)
[11:17:49][VV][api.service:250]: on_ping_request: PingRequest {}
[11:17:52][VV][api.service:035]: send_ping_response: PingResponse {}
[11:17:54][V][api.connection:672]: Error: Disconnecting ESPHome v1.14.5 (192.168.1.209)
ERROR Error while reading incoming messages: Error while receiving data: [Errno 9] Bad file descriptor
WARNING Disconnected from API: Error while receiving data: [Errno 9] Bad file descriptor
INFO Connecting to 192.168.1.249:6053 (192.168.1.249)
WARNING Disconnected from API: Timeout while waiting for message response!
INFO Connecting to 192.168.1.249:6053 (192.168.1.249)
WARNING Couldn't connect to API (Error connecting to 192.168.1.249: timed out). Trying to reconnect in 1 seconds
WARNING Couldn't connect to API (Error connecting to 192.168.1.249: timed out). Trying to reconnect in 1 seconds
INFO Connecting to 192.168.1.249:6053 (192.168.1.249)
WARNING Couldn't connect to API (Error connecting to 192.168.1.249: timed out). Trying to reconnect in 1 seconds
INFO Connecting to 192.168.1.249:6053 (192.168.1.249)
WARNING Couldn't connect to API (Timeout while waiting for message response!). Trying to reconnect in 2 seconds
INFO Connecting to 192.168.1.249:6053 (192.168.1.249)
INFO Successfully connected to 192.168.1.249
WARNING Disconnected from API: Timeout while waiting for message response!
INFO Connecting to 192.168.1.249:6053 (192.168.1.249)
INFO Successfully connected to 192.168.1.249
[11:18:54][VV][api.service:250]: on_ping_request: PingRequest {}
[11:18:54][VV][api.service:035]: send_ping_response: PingResponse {}
WARNING Disconnected from API: Timeout while waiting for message response!
INFO Connecting to 192.168.1.249:6053 (192.168.1.249)
WARNING Couldn't connect to API (Error connecting to 192.168.1.249: timed out). Trying to reconnect in 1 seconds
INFO Connecting to 192.168.1.249:6053 (192.168.1.249)
WARNING Couldn't connect to API (Timeout while waiting for message response!). Trying to reconnect in 1 seconds
ERROR Error while reading incoming messages: Error while receiving data: [Errno 9] Bad file descriptor
INFO Connecting to 192.168.1.249:6053 (192.168.1.249)
WARNING Couldn't connect to API (Timeout while waiting for message response!). Trying to reconnect in 2 seconds
INFO Connecting to 192.168.1.249:6053 (192.168.1.249)
WARNING Couldn't connect to API (Error connecting to 192.168.1.249: timed out). Trying to reconnect in 3 seconds
INFO Connecting to 192.168.1.249:6053 (192.168.1.249)
INFO Successfully connected to 192.168.1.249
[11:19:53][VV][api.service:222]: on_hello_request: HelloRequest {
  client_info: 'Home Assistant 0.113.3'
}
[11:19:55][V][api.connection:567]: Hello from client: 'Home Assistant 0.113.3 (192.168.1.209)'
[11:19:55][VV][api.service:010]: send_hello_response: HelloResponse {
  api_version_major: 1
  api_version_minor: 3
  server_info: 'garagesensor (esphome v1.14.5)'
}
[11:19:56][VV][api.service:250]: on_ping_request: PingRequest {}
[11:19:56][VV][api.service:035]: send_ping_response: PingResponse {}
[11:19:56][VV][scheduler:131]: Running interval '' with interval=10000 last_execution=197582 (now=207582)
[11:19:56][VV][api.service:229]: on_connect_request: ConnectRequest {
  password: ''
}
[11:19:56][D][api.connection:583]: Client 'Home Assistant 0.113.3 (192.168.1.209)' connected successfully!
[11:20:01][VV][api.service:171]: send_get_time_request: GetTimeRequest {}
[11:20:01][VV][api.service:015]: send_connect_response: ConnectResponse {
  invalid_password: NO
}
[11:20:02][VV][api.service:250]: on_ping_request: PingRequest {}
[11:20:04][VV][api.service:035]: send_ping_response: PingResponse {}
[11:20:04][VV][api.service:342]: on_get_time_response: GetTimeResponse {
  epoch_seconds: 1597396796
}
[11:20:04][D][time:029]: Synchronized time: Fri Aug 14 11:19:56 2020
[11:20:04][VV][api.service:264]: on_device_info_request: DeviceInfoRequest {}
[11:20:04][VV][api.service:040]: send_device_info_response: DeviceInfoResponse {
  uses_password: NO
  name: 'garagesensor'
  mac_address: 'BC:DD:C2:7B:06:9A'
  esphome_version: '1.14.5'
  compilation_time: 'Aug 14 2020, 11:13:48'
  model: 'PLATFORMIO_ESP01_1M'
  has_deep_sleep: NO
}
[11:20:09][VV][scheduler:131]: Running interval '' with interval=10000 last_execution=207582 (now=217582)
[11:20:09][D][api:067]: Disconnecting Home Assistant 0.113.3 (192.168.1.209)
WARNING Disconnected from API: Timeout while waiting for message response!
INFO Connecting to 192.168.1.249:6053 (192.168.1.249)
WARNING Couldn't connect to API (Error connecting to 192.168.1.249: timed out). Trying to reconnect in 1 seconds
INFO Connecting to 192.168.1.249:6053 (192.168.1.249)
INFO Successfully connected to 192.168.1.249
WARNING Disconnected from API: Timeout while waiting for message response!
INFO Connecting to 192.168.1.249:6053 (192.168.1.249)
WARNING Couldn't connect to API (Timeout while waiting for message response!). Trying to reconnect in 1 seconds
INFO Connecting to 192.168.1.249:6053 (192.168.1.249)
WARNING Couldn't connect to API (Error connecting to 192.168.1.249: timed out). Trying to reconnect in 1 seconds
INFO Connecting to 192.168.1.249:6053 (192.168.1.249)
INFO Successfully connected to 192.168.1.249
[11:21:06][VV][api.service:229]: on_connect_request: ConnectRequest {
  password: ''
}
[11:21:06][D][api.connection:583]: Client 'Home Assistant 0.113.3 (192.168.1.209)' connected successfully!
[11:21:06][VV][api.service:171]: send_get_time_request: GetTimeRequest {}
[11:21:06][VV][api.service:015]: send_connect_response: ConnectResponse {
  invalid_password: NO
}
[11:21:06][VV][api.service:342]: on_get_time_response: GetTimeResponse {
  epoch_seconds: 1597396866
}
[11:21:06][D][time:029]: Synchronized time: Fri Aug 14 11:21:06 2020
[11:21:06][VV][scheduler:131]: Running interval '' with interval=10000 last_execution=267582 (now=277582)
[11:21:11][VV][api.service:264]: on_device_info_request: DeviceInfoRequest {}
[11:21:11][VV][api.service:040]: send_device_info_response: DeviceInfoResponse {
  uses_password: NO
  name: 'garagesensor'
  mac_address: 'BC:DD:C2:7B:06:9A'
  esphome_version: '1.14.5'
  compilation_time: 'Aug 14 2020, 11:13:48'
  model: 'PLATFORMIO_ESP01_1M'
  has_deep_sleep: NO
}
[11:21:11][VV][api.service:271]: on_list_entities_request: ListEntitiesRequest {}
[11:21:11][VV][api.service:113]: send_list_entities_sensor_response: ListEntitiesSensorResponse {
  object_id: 'garagesensor_uptime'
  key: 3007548415
  name: 'Garagesensor Uptime'
  unique_id: 'bcddc27b069a-uptime'
  icon: 'mdi:timer'
  unit_of_measurement: 's'
  accuracy_decimals: 0
  force_update: NO
}
[11:21:11](Message skipped because it was too big to fit in TCP buffer - This is only cosmetic)
[11:21:11](Message skipped because it was too big to fit in TCP buffer - This is only cosmetic)
[11:21:11](Message skipped because it was too big to fit in TCP buffer - This is only cosmetic)
[11:21:11][VV][api.service:250]: on_ping_request: PingRequest {}
[11:21:11][VV][api.service:035]: send_ping_response: PingResponse {}
[11:21:11](Message skipped because it was too big to fit in TCP buffer - This is only cosmetic)
[11:21:11](Message skipped because it was too big to fit in TCP buffer - This is only cosmetic)
[11:21:11](Message skipped because it was too big to fit in TCP buffer - This is only cosmetic)
[11:21:11](Message skipped because it was too big to fit in TCP buffer - This is only cosmetic)
[11:21:11](Message skipped because it was too big to fit in TCP buffer - This is only cosmetic)
[11:21:11](Message skipped because it was too big to fit in TCP buffer - This is only cosmetic)
WARNING Disconnected from API: Timeout while waiting for message response!
INFO Connecting to 192.168.1.249:6053 (192.168.1.249)
WARNING Couldn't connect to API (Error connecting to 192.168.1.249: timed out). Trying to reconnect in 1 seconds
INFO Connecting to 192.168.1.249:6053 (192.168.1.249)
WARNING Couldn't connect to API (Timeout while waiting for message response!). Trying to reconnect in 1 seconds
INFO Connecting to 192.168.1.249:6053 (192.168.1.249)
INFO Successfully connected to 192.168.1.249
[11:21:48][VV][scheduler:131]: Running interval '' with interval=10000 last_execution=307582 (now=317582)
[11:21:48][D][api:067]: Disconnecting 192.168.1.209
[11:21:48][VV][api.service:250]: on_ping_request: PingRequest {}
[11:21:48][VV][api.service:035]: send_ping_response: PingResponse {}
WARNING Disconnected from API: Timeout while waiting for message response!
INFO Connecting to 192.168.1.249:6053 (192.168.1.249)
WARNING Couldn't connect to API (Error connecting to 192.168.1.249: timed out). Trying to reconnect in 1 seconds
INFO Connecting to 192.168.1.249:6053 (192.168.1.249)
WARNING Couldn't connect to API (Error connecting to 192.168.1.249: timed out). Trying to reconnect in 1 seconds
INFO Connecting to 192.168.1.249:6053 (192.168.1.249)

Thanks, in that thread there are some usefull tips. Connection seems stable now (after using a different SSID which only has 2.4ghz and still using static ip and power saving to none.
First after this adjustment all readings seems fine, but temp and hum are not updated in HA. After a restart i suddenly get this error

[12:38:28][W][dht:160]: Requesting data from DHT failed!
[12:38:28][W][dht:060]: Invalid readings! Please check your wiring (pull-up resistor, pin number).

Pff, seems to be a never ending story :roll_eyes:

Just a general FYI that might save you a lot of annoyance. I’ve tried to use those exact modules as convenient temperature sensors however, put frankly, they suck.

The board heats up so the DHT22 ends up reading several degrees hotter. You can sort of mitigate this issue by connecting the DHT22 to the board using about 6" of wire. However this exacerbates the second issue.

The second issue is that the DHT22 sensor locks up. It might work for hours, it might work for days, it might even work for weeks. But at some point, you will stop getting readings from the sensor and only a power cycle will fix it. If you add a length of wire to fix the temperature issue, it makes the problem worse. So it appears to be a problem with the 3.3V supply used and/or the pullup resistor value. The DHT22 in my experience is already marginal at 3.3V regardless of what the datasheet says and seems to work best with a 10K pullup (incidentally I use the same pullup at 5V and it is rock solid). Whatever value they have, it is wrong. Possibly they are also missing a bypass capacitor.

I’ve seen this issue with my own firmware, and Tasmota.

I’ve spent WAY too much time messing with these things swapping out sensors, extending wires, changing pullups, adding filter capacitors than I care to admit. Huge time hole for something that was supposed to be convenient. So I’m phasing them out. It’s not worth the headaches of having to “monitor” a temp sensor which so many other things (climate control!) rely on.

But if you just want to see the approximate temperature of something and don’t care about reliability, just fire Tasmota onto it, enable the DHT22 on GPIO2 and go nuts. :slight_smile:

I think i am agreeing with you. I’ve put a lot of time in it already and they just don’t seem to be stable. Weird things happening, for example different behaviour while not changing anything in hardware or code.
I am going to look at sonoff and xiaomi aqara temp and humidity sensors. Both very cheap (7 euro for sonoff) and sonoff also has a 4 euro zigbee stick. If out of the box is this cheap then why bother with DIY.
Another advantage is that they work on a battery.

Interested in knowing what you do use :slight_smile:

I am still mostly using those sucky boards because my house is in a constant state of flux as I gut and rebuild each room. I’ve just worked around the instability by having them plugged into WiFi power bars so Home Assistant can toggle the power after they report “None” for a few minutes. It is stupid, but for a temporary measure, it will work.

My permanent temperature monitoring are either DHT22 or BME280 sensors plugged into my custom control boards in every room. DHT22s seem fine when run at 5V with a 10K pullup on wires out to several meters.