Delaying I2C accesses after power up (AM2320)

The AM2320 temp/humidity sensor looks at the level of SDA SCL during the first 500ms after power up, and if it’s low it goes into 1-wire mode or if it’s high it goes into I2C mode. Mine seems to be going into 1-wire mode about half of the times I power on. I also have a PCA9554A I2C GPIO expander with multiple binary_sensors assigned to different bits. I believe the problem is that it starts polling these binary sensors which toggles SDA and sometimes makes the AM2320 go into 1-wire mode. Is there a simple way to delay I2C accesses for 500ms, given that I have multiple sensors using it? I suspect putting a delay in on_boot priority 1000 could work, but I’m already using on_boot at the regular priority to publish a sensor. I could probably find a different workaround for that if necessary.

Does setting scan: false change the behaviour?

It means you will have to manually set the address in the sensor.

Actually, I misread the datasheet, and it’s SCL held high or low that determines 1-wire vs. I2C. I tried forcing SCL high during boot (although it’s still low for the first 150ms), and it worked. I’m still interested if there are any other solutions so I can still use boot_mode with a different priority.

  on_boot:
    priority: 1000
    then:
      - lambda: |-
                digitalWrite(D1, HIGH);
                pinMode(D1, OUTPUT);
                delay(500);      

2023-11-03_9-50-32