How to progam esp 32 to ky-038 microphone

How to progam esp 32 to ky-038 microphone
It is usefull to detect smoke alarms

In ESPHome just set it up as a binary sensor. I found slamming doors set it off. In automations you may need to set it so it reads multiple times over several seconds before notifying you with help of input_number. Have another automation to reset the input_number to 0 after few minutes or it will notify you after several door slams over hours/days. I have the code in an old thread.

Ky-38 as a loud noise sensor.