How is your TV connected to the network, WiFi or a network cable? My experience is WOL doesn’t normally work when using wifi. If you’re doing testing and you turn your TV off and then try WOL, it may work as a lot of TVs wait a while before they really turn off. I actually used a separate device to send the IR command in one location on my network. I saw that’s not what you want to do but it might be your only option if you’re on WiFi. In my case the device was also working as a squeezelight media server to play music through the TV. The esp option recommended previously is a reasonable option if WOL will not work.