What type of TV do you have?
Just stumbled upon my Samsung has an option to automatically turn of connected devices.
Go in to settings and see if TV has cec settings. Disable them.
And go into stb and disable as well.
On stb, do menu settings audio/video video TV input control.
Set to disabled.