HA automatically configures some things for you when it finds a Roku TV, but a few things need to be added to configuration.yaml for extra features.
Shell Command to Open YouTube to Music:
Note: I tried in vain to find ways to randomize this URL, search by string etc, ended up getting banned via CLI via googler/youtube-dl etc. Best option I looked for was a URL like below which is a "Live" station, so should be changing always.
#Shell Commands shell_command: roku_youtube: "curl -X POST http://192.168.1.47:8060/launch/837?contentId=fexvzp34xzY"
Automation To Run "roku_youtube":
data: {} entity_id: media_player.tvname service: shell_command.roku_youtube
Automation To Turn On/Off:
data: {} entity_id: media_player.tvname service: media_player.turn_on
Automation To Select Source:
data: source: 837 entity_id: media_player.tvname service: media_player.select_source
Note: YouTube is always the same API_ID of "837"
Find Source API_ID via:
curl http://IP_NOT_DNS:8060/query/apps <apps> <app id="12" version="3.1.6014">Netflix</app> <app id="13" version="4.10.13">Amazon Instant Video</app> <app id="2016" version="3.2.7">Crackle</app> <app id="2285" version="2.7.6">Hulu Plus</app> <app id="13842" version="1.3.2">VUDU</app> <app id="28" version="3.1.7">Pandora</app> </apps>
Lovelace YAML:
entities: - entity: media_player.tvname title: TV type: entities