Ubuntu 20.04 external monitor only detected if on at start-up

I have a TV connected to my laptop via HDMI. Most of the time I have it switched off and only use it some of the time. I have found that the only way to make sure it is detected is to have it switched on at the time I start up Ubuntu. How can I get Ubuntu to recognise it even if it was not switched at start-up time?

Note that this was already a problem when I had 18.04 installed and I have already tried most of the suggestions listed here: External monitor not detected on Ubuntu 18.04

My set-up is:

MSi Prestige P65 Laptop

GeForce GTX 1060 with Max-Q Design/PCIe/SSE2

Ubuntu 20.04.1

Gnome 3.36.3

Nvidia driver 450 (problem also occured with 440 and 435)

I attach two bug reports in case it is helpful to compare them: one for when it is working and one for when it isn’t.
nvidia-bug-report-notworking23-11-20.log.gz (411.5 KB) nvidia-bug-report-working23-11-20.log.gz (500.2 KB)