Basic Roku Remote using Floorplan

Nothing in this guide is really relevant anymore as the home assistant Roku platform has remote control buttons and is setup automatically now when Roku is configured.

Additionally, floor-plan was much more cumbersome to setup compared to an easier setup using service-buttons within a picture card in Lovelace.

I created this Floorplan card using scripts, shell commands, and the source services from the roku component to mimic the physical remote.

https://github.com/moistgun/Roku-Remote

The reasons I went with this over using the Roku mobile app are,
- Failing to connect
- Ramping volume to 100%
- No volume control
- No power control

Thought I would share.

For the Shell command yaml:

Note you will need to replace RokuLocalIP with your Roku’s IP address

</s> <s>roku_on: 'curl -X POST http://RokuLocalIP:8060/keypress/PowerOn'</s> <s>roku_off: 'curl -X POST http://RokuLocalIP:8060/keypress/PowerOff'</s> <s>roku_volume_up: 'curl -X POST http://RokuLocalIP:8060/keypress/VolumeUp'</s> <s>roku_volume_down: 'curl -X POST http://RokuLocalIP:8060/keypress/VolumeDown'</s> <s>roku_home: 'curl -X POST http://RokuLocalIP:8060/keypress/Home'</s> <s>roku_reverse: 'curl -X POST http://RokuLocalIP:8060/keypress/Rev'</s> <s>roku_select: 'curl -X POST http://RokuLocalIP:8060/keypress/Select'</s> <s>roku_left: 'curl -X POST http://RokuLocalIP:8060/keypress/Left'</s> <s>roku_right: 'curl -X POST http://RokuLocalIP:8060/keypress/Right'</s> <s>roku_down: 'curl -X POST http://RokuLocalIP:8060/keypress/Down'</s> <s>roku_up: 'curl -X POST http://RokuLocalIP:8060/keypress/Up'</s> <s>roku_back: 'curl -X POST http://RokuLocalIP:8060/keypress/Back'</s> <s>roku_info: 'curl -X POST http://RokuLocalIP:8060/keypress/Info'</s> <s>

Note you could use shell commands for the sources/apps, however it doesnt seem like the App IDs used are standard and would require you to first query the app IDs for your device.
For the top four to work, you need to have setup the roku component within home assistant, and you need to know your roku’s entity ID.

Script Yaml:

```
roku_hulu:
sequence:
- service: media_player.select_source
entity_id: media_player.RokuEntityName
data:
source: Hulu

roku_netflix:
sequence:
- service: media_player.select_source
entity_id: media_player.RokuEntityName
data:
source: Netflix

roku_hbo_now:
sequence:
- service: media_player.select_source
entity_id: media_player.RokuEntityName
data:
source: HBO NOW

roku_plex:
sequence:
- service: media_player.select_source
entity_id: media_player.RokuEntityName
data:
source: Plex

roku_on:
sequence:
- service: shell_command.roku_on
roku_off:
sequence:
- service: shell_command.roku_off
roku_volume_up:
sequence:
- service: shell_command.roku_volume_up
roku_volume_down:
sequence:
- service: shell_command.roku_volume_down
roku_home:
sequence:
- service: shell_command.roku_home
roku_reverse:
sequence:
- service: shell_command.roku_reverse
roku_select:
sequence:
- service: shell_command.roku_select
roku_left:
sequence:
- service: shell_command.roku_left
roku_right:
sequence:
- service: shell_command.roku_right
roku_down:
sequence:
- service: shell_command.roku_down
roku_up:
sequence:
- service: shell_command.roku_up
roku_back:
sequence:
- service: shell_command.roku_back
roku_info:
sequence:
- service: shell_command.roku_info
```

The following is included in the Floorplan Yaml within groups to use the above scripts:

```
- name: roku_volume_up
entities:
- script.roku_volume_up
action:
domain: script
service: roku_volume_up

- name: roku_volume_down
entities:
- script.roku_volume_down
action:
domain: script
service: roku_volume_down

- name: roku_back
entities:
- script.roku_back
action:
domain: script
service: roku_back

- name: roku_home
entities:
- script.roku_home
action:
domain: script
service: roku_home

- name: roku_up
entities:
- script.roku_up
action:
domain: script
service: roku_up

- name: roku_right
entities:
- script.roku_right
action:
domain: script
service: roku_right

- name: roku_down
entities:
- script.roku_down
action:
domain: script
service: roku_down

- name: roku_left
entities:
- script.roku_left
action:
domain: script
service: roku_left

- name: roku_reverse
entities:
- script.roku_reverse
action:
domain: script
service: roku_reverse

- name: roku_select
entities:
- script.roku_select
action:
domain: script
service: roku_select

- name: roku_info
entities:
- script.roku_info
action:
domain: script
service: roku_info

- name: roku_on
entities:
- script.roku_on
action:
domain: script
service: roku_on

- name: roku_off
entities:
- script.roku_off
action:
domain: script
service: roku_off

- name: roku_netflix
entities:
- script.roku_netflix
action:
domain: script
service: roku_netflix

- name: roku_hbo_now
entities:
- script.roku_hbo_now
action:
domain: script
service: roku_hbo_now

- name: roku_hulu
entities:
- script.roku_hulu
action:
domain: script
service: roku_hulu

- name: roku_plex
entities:
- script.roku_plex
action:
domain: script
service: roku_plex
```

2 Likes

This is so cool, thank you for sharing! Would you be willing to share the SVG?

Thanks alot :slight_smile:

Updated the posting with a link to the project in Github
Enjoy!

How do you make this work. I have tried 5 ways to Sunday and nothing works. Other examples on github are pretty much the same. None are working. I have been searching for a few days and trying many things but to no avail. Like to just get one button working and then go from there but can’t seem to get that going either.

Whats not working for you? Floorplan? This specific SVG?

What do you see in homeassistant after you followed the above and the formal floorplan documentation?

To answer your question. I don’t see anything in home assistant other than what was detected by default on the main screen. Just a single device (my roku) that just shows what is playing. The “media_player.living_room” and “remote.living_room”. Not the pic shown above.

“For the Shell command yaml:” I added these web service calls to configuration.yaml since I was not 100% where to add these or if I could create a file to hold these.

“Script Yaml:” I added those entries into scripts.yaml, edited the entity_id with my roku’s ID (remote.living_room is my name for it).

“Floorplan.yaml” I created a www folder in /config to hold the floorplan. I think this may be where I have gone wrong or even other things were done wrong as well.

In the mean time I am trying to make a button that does a single web service call like " ```
roku_home: ‘curl -X POST http://RokuLocalIP:8060/keypress/Home’
". While I try to figure this solution out as well.
Thinking I could understand it better if I could just get one thing working first. Feel free to ignore this last part.

Just to try to test out the curl commands you could use terminal, but with home assistant, give this a shot but replace the X with your roku’s IP address.
This test would put something on your main page.

switch:
  - platform: command_line
    switches:
      tv_power:
        command_on: 'curl -X POST http://192.168.1.x:8060/keypress/PowerOn'
        command_off: 'curl -X POST http://192.168.1.x:8060/keypress/PowerOff'

If you setup all the shell commands and scripts, you could just go to your list of entities in the states tab under dev options in home assistant.
Then find one of the scripts, and click the name, then click execute.

As for not seeing anything in home assistant, you’ll probably have to refer to the Floorplan docs.
If you dont see the image

If you want to manage the added components a little tidier, you could put this in your configuration yaml
shell_command: !include shell_commands.yaml

then in your configuration directory, create a file named shell_commands.yaml to reference the shell commands.

This is the case for really any thing with home assistant.

Thank you for taking the time to reply. I understand what you are saying about the shell_commands. That should work and help keep things cleaner.

You are correct I don’t know about floorplans at all so I guess I need to go read that first.

To be honest I am giving up. I have tried this and several other solutions, examples, and configs. Do not think it should be this hard to add a remote for up, down, left, right, and a OK button. Seems you need to be a developer or coder to use this product. Thanks for trying to help.

Absolutely brilliant! How did you figure out the shell commands? I’d REALLY like to figure out shell commands for my Yamaha receiver. It has a web interface, and I’ve looked at the HTML and the linked javascript, but so far, I haven’t figured anything out.

Basically was searching for Remote external control Roku, and came across their docs

This covers all the remote commands which are just curl commands.

not sure about yamaha :frowning:

I have floorplan installed and I have all of these files added and the ROKU ip addresses changed correctly.

When I click on the floorplan shortcut in the sidebar i’m still taken to the default floor plan SVG.

Where / what do I need to change to point to the new ROKU svg file included in the git?

The floorplan yaml file second line should specify the image you want for the floorplan.
Point that to the Roku svg

Ok I figured out how to get the svg to show up, but now nothing happens when I push any of the buttons.