Interesting, thank you, I cannot see why your code is not working.
However there have been releases of esphome (and changes in the underlying libraries) since that thread. Perhaps something in an underlying library has changed?
Perhaps post an issue on gitgub, it’ll get the developer’s attention quicker than here. Post back your issue link back here so others can find it.