I have four LG webOS TVs, all of which require WOL separately to turn on:
one 49UM7300PUA, two 70UM7370PUA, and one OLED55C8PUA. I’m a bit embarrassed to admit I have another 3 LGTVs in another home.
I’m happy to help however you want, just say the word!
May I humbling add a request: adding the “device notification” command to the driver. It allows the TV to be used like any other “send message” destination.
By chance have you seen the earlier LGTV device driver by @ekimmagrann which I believe was later picked up by @asj? Later @mo.hesham picked up the driver here. While none of these drivers work for me any more, they do have all or almost all of your to-do’s in the code. Maybe there is inspiration for you in there?