Custom component that extends Home Assistant Roku integration allowing to use the media player with deep links.
NOTICE:
This repository is now archived as the official integration added the features I proposed here, please refer to the HA official documentation page for details on how to use it, as their implementations is different from mine. https://www.home-assistant.io/integrations/roku/
This component will set up the following platforms.
Platform | Description |
---|---|
media_player |
Allows stream cameras and media content to Roku. |
remote |
Allows you to send remote control buttons to a Roku device. |
- Using the tool of choice open the directory (folder) for your HA configuration (where you find
configuration.yaml
). - If you do not have a
custom_components
directory (folder) there, you need to create it. - In the
custom_components
directory (folder) create a new folder calledroku
. - Download all the files from the
custom_components/roku/
directory (folder) in this repository. - Place the files you downloaded in the HA
config/custom_components
directory (folder). - Restart Home Assistant
- In the HA UI go to "Configuration" -> "Integrations" click "+" and search for "Roku"
Using your HA configuration directory (folder) as a starting point you should now also have this:
custom_components/roku/translations/*.json
custom_components/roku/__init__.py
custom_components/roku/browse_media.py
custom_components/roku/config_flow.py
custom_components/roku/const.py
custom_components/roku/coordinator.py
custom_components/roku/entity.py
custom_components/roku/manifest.json
custom_components/roku/media_player.py
custom_components/roku/remote.py
custom_components/roku/services.yaml
custom_components/roku/strings.json
The configuration of you Roku devices is exactly as the native HA core component, you can find the details on the component documentation page: https://www.home-assistant.io/integrations/roku/
The changes introduced by this custom component are focused on improving the media_player
platform support for Roku. In addition to the usage described on the documentation linked above this component supports two new ways of interacting with Roku.
Using the appID
for the channel and a contentId
you can tell Roku to start an app running a specific video. In order to get the appID
of the channel you can just open the URL http://ROKU_IP:8060/query/apps
in your web browser of choice. The Roku will return an XML-formatted list of available channels, including their full name and appID.
More details can be found on the Roku dev pages
Check some Examples below of how to automate the startup of different Roku apps with content:
To start this YouTube Fireplace video (https://www.youtube.com/watch?v=6VB4bgiB0yA
) automatically on your Roku, you just need use the following action:
- Replace the
entity_id
with your device - YouTube
appId
is837
and thecontentId
(YouTube video code) separated by a comma - The
media_content_type
set asapp
action:
- service: media_player.play_media
target:
entity_id: media_player.roku_express_4k
data:
media_content_id: 837,6VB4bgiB0yA
media_content_type: app
action:
- service: media_player.play_media
target:
entity_id: media_player.roku_express_4k
data:
media_content_id: 2285,american-dad-977c8e25-cde0-41b7-80ce-e746f2d2093f
media_content_type: app
action:
- service: media_player.play_media
target:
entity_id: media_player.roku_express_4k
data:
media_content_id: 22297,spotify:playlist:5xddIVAtLrZKtt4YGLM1SQ
media_content_type: app
action:
- service: media_player.play_media
target:
entity_id: media_player.roku_express_4k
data:
media_content_id: 22297,spotify:track:67awxiNHNyjMXhVgsHuIrs
media_content_type: app
With this custom component and its Roku companion app you now can stream a camera to your Roku device, just like is done using Google Cast
integration.
First you need to make sure you have the Roku Home Assistant Cast App side loaded to your Roku device (see the instructions on the app repository, then you can add the action below to any of your automations (make sure you replace the entities id with the ones from your HA instance).
action:
- service: camera.play_stream
target:
entity_id:
- camera.floodlight_camera
data:
media_player: media_player.roku_express_4k
format: hls
If you want to contribute to this please read the Contribution guidelines
Copyright (C) 2022 Marcelo Lv Cabral. All rights reserved.
Licensed under MIT License.