Two AM2302's, one won't work after OTA, but works after power cycle

I’m not even sure where to start, and when that happens I start here. :wink:

Running ESPHome 1.14.3 on HA .107.7 I built a D1 Mini with two AM2302’s, and it works fine except after doing a flash. When it boots after an OTA (and i think direct USB flash also, but I did that only once) I get an error that one sensor is not responding and possibly wired incorrectly.

But after a power off boot it works fine, and continues working fine for days. It is quite consistent.

I tried a different D1, and a NodeMCU, same result.

Here’s working log:

[10:47:19][D][dht:048]: Got Temperature=23.8°C Humidity=61.4%
[10:47:20][D][dht:048]: Got Temperature=23.5°C Humidity=55.8%
[10:47:29][D][dht:048]: Got Temperature=23.8°C Humidity=61.4%
[10:47:30][D][dht:048]: Got Temperature=23.5°C Humidity=55.8%
[10:47:39][D][dht:048]: Got Temperature=23.8°C Humidity=61.3%
[10:47:39][D][sensor:092]: 'AC Split Cold Temp': Sending state 23.79955 °C with 1 decimals of     accuracy
[10:47:39][D][sensor:092]: 'AC Split Cold Humidity': Sending state 61.36577 % with 0 decimals of accuracy
[10:47:40][D][dht:048]: Got Temperature=23.5°C Humidity=55.8%
[10:47:40][D][sensor:092]: 'AC Split Ambient Temp': Sending state 23.49995 °C with 1 decimals of accuracy
[10:47:40][D][sensor:092]: 'AC Split Ambient Humidity': Sending state 55.79984 % with 0 decimals of accuracy
[10:47:49][D][dht:048]: Got Temperature=23.8°C Humidity=61.4%
[10:47:50][D][dht:048]: Got Temperature=23.5°C Humidity=55.8%

Same code with a fresh OTA:

[10:49:09][D][dht:048]: Got Temperature=23.5°C Humidity=55.8%
[10:49:10][W][dht:126]: Requesting data from DHT failed!
[10:49:10][W][dht:060]: Invalid readings! Please check your wiring (pull-up resistor, pin number).
[10:49:19][D][dht:048]: Got Temperature=23.5°C Humidity=55.8%
[10:49:20][W][dht:126]: Requesting data from DHT failed!
[10:49:20][W][dht:060]: Invalid readings! Please check your wiring (pull-up resistor, pin number).
[10:49:29][D][dht:048]: Got Temperature=23.6°C Humidity=55.8%
[10:49:30][W][dht:126]: Requesting data from DHT failed!
[10:49:30][W][dht:060]: Invalid readings! Please check your wiring (pull-up resistor, pin number).
[10:49:39][D][dht:048]: Got Temperature=23.6°C Humidity=55.8%
[10:49:39][D][sensor:092]: 'AC Split Ambient Temp': Sending state 23.56667 °C with 1 decimals of accuracy
[10:49:39][D][sensor:092]: 'AC Split Ambient Humidity': Sending state 55.80000 % with 0 decimals of accuracy

It never seems to fix itself (though I confess here “never” is measured in minutes of waiting). A power cycle immediately fixes it, when it comes up it doesn’t miss a single read.

The code is below.

Any idea what would cause this sort of behavior? While I don’t anticipate doing an OTA frequently it is a bit of a paint to climb up and power cycle it (it’s in the ceiling).

Note I have one with the same basic structure but one sensor and it works fine after an OTA. It’s only the double.

sensor: 
  - platform: dht
    pin: 
      number: D5
      mode: INPUT_PULLUP
    model: AM2302
    update_interval: 10s
    temperature:
      name: "AC Split Ambient Temp"
      filters:
        - sliding_window_moving_average:
            window_size: 3
            send_every: 6
            send_first_at: 6
    humidity:
      name: "AC Split Ambient Humidity"
      filters:
        - sliding_window_moving_average:
            window_size: 3
            send_every: 6
            send_first_at: 6
  - platform: dht
    pin: 
      number: D4
      mode: INPUT_PULLUP
    model: AM2302
    update_interval: 10s
    temperature:
      name: "AC Split Cold Temp"
      filters:
        - sliding_window_moving_average:
            window_size: 3
            send_every: 6
            send_first_at: 6
    humidity:
      name: "AC Split Cold Humidity"
      filters:
        - sliding_window_moving_average:
            window_size: 3
            send_every: 6
            send_first_at: 6