Thanks, I'm currently using tvheadend via the linuxserver.io docker container, and their docker also allows some custom startup logic. I find this a convenient all-in-one approach.
It requires passing the a few env variables to the container:
TVH_URL - set to http://plex:plex@192.168.20.45:9981 for me (plex user with plex as password is set up separately in tvheadend, also need to enable plain authentication in Configuration->General)
TVH_PROXY_URL - set to http://192.168.20.45:5004
Exposing port 5004 to the container and mapping a host directory to this container path /custom-cont-init.d
In the host directory I've got a script with the commands below, and it all works a nicely.
But I was just hoping the HDHomeRun Emulation directly in tvheadend would be even simpler.
cd /
apk add git py3-pip
git clone https://github.com/jkaberg/tvhProxy
cd tvhProxy
pip install -r requirements.txt --break-system-packages
python tvhProxy.py &