How to Know Which Optocoupler to Buy

I’m connecting wired door and window sensors to ESPHome and based on all of my reading am going to add optocouplers. I understand why I need one, but most of the details of how they work is a bit of a mystery to me.

When shopping for them, there are different “sizes.” How do I know which to buy? Is the first number the power supply voltage and the second number ESPXXXX voltage?

Thanks.

Doesnt matter very much which one you chose. What’s important that it runs on 3.3/5v and that it can handle the current that goes through it. Digi Key or Farnell have great websites for this