TV Status and Control with a Roku TV and Home Assistant

For today’s article, we’re tackling the problem of knowing whether a TV is on or off. We also want to be able to turn it on or off remotely. 

Hardware:

To make our live easier we’re using TVs with Roku built-in. Keep in mind this is different than connecting a standalone Roku to a TV. No other special hardware is needed, but we are assuming you have a decent router and you’re using Home Assistant as your hub. We’ll address how to do this with a dumb TV in a separate article.

Software:

No special software is needed, other than Home Assistant.

Step 1: Give your Roku TV a static IP

 
Technically, this step isn’t required. However, if the TV’s IP address ever changes you’ll have to reconfigure Home Assistant. Let’s just make our lives easier and assign a static IP to the TV so we can “set it and forget it”. Fortunately this is easy with most routers.

Step 2: Set up the Roku TV

If the TV goes to sleep completely, Home Assistant will lose contact with it. To prevent this, go into the TV’s settings and enable “Fast Start”. While you’re in the settings double check the internet settings to make sure the TV is using the static IP that you assigned to it. You might have to reboot the TV or reset its network to get the new IP address.

 

Step 3: Add the switch to Home Assistant

We’ll be using a command line switch to add the TV to Home Assistant. Add these lines to your configuration.yaml:

You’ll need to replace “rokutv_ip” with the static IP that you assigned to the TV. You can also change the name from “familyroom_tv_power” to whatever fits your situation.

Step 4: Add the new switch to your UI

Now that you have a functioning switch that also shows the TV’s status, customize the icon by adding:

Then add it to your lovelace ui

Reboot and you’re done!

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *