Does what go in the yaml?
The input_boolean and automation I wrote: yes
The custom integration: no, and yes.
The custom integration has to be installed. Check out HACS for the easiest way to do this. Then you write a bit of configuration in yaml to configure it. Read the hass-momentary page. It tells you all this.