This is a snapshot of https://github.com/esphome/esphome/pull/6300 that is confirmed to work with our hardware.