I have a Sony TV and have written a Hubitat driver using httpPost call with Sony REST API. I decided to bring my TV over to this method after writing a similar driver for Sony Audio devices and seeing all the available API's and how much more efficient it was than emulating button clicks.
Most functions here should work with all recent Sony Bravia Smart TV's, but some functions may be specific to certain models or obviously certain TV settings.
Sony did not expose a way to see the current app currently on the TV, so unless TV is on Tuner or one of the HDMI ports, it will always come back with "SmartMode"
Add virtual device
Input IP address and PSK set on TV
If you are in EU, you may need to enable Wake-On-Lan on TV and check box in preferences.
KeyPress This button had a limit to the number of available dropdowns in hubitat, you can change out any of these in Line 59-94 with the available options in line 640-785.
LaunchApp This button will launch an App if it already exist on your TV.
Reboot This will reboot your TV.
SendDebugStringThis will allow you to send a json command to your TV and check the log for response. This is so you can check your TV capability if needed
SendURL This will allow you to send a full url including the http:// to your TV screen. This will be handy for showing remote streams or dashboards, websites. No apps needed on the TV.
Terminate Apps This will close out all smart apps and turn the TV back to tuner mode.