“Unified Remote” as remote control for Home-Assistant

I was asked to post this here too. It’s cross-posted from r/homeassistant:

Disclaimer: This requires buying the full version of Unified Remote. I am not affiliated with them in any way what so ever.

Intro:
I’ve been searching for a streamlined solution to controlling my home for a while. I have an Android phone+watch so that was never a problem (Tasker, Power Toggles, Autowear, etc). My partner on the other hand has an iPhone and she is not fanatic enough to switch to android or want to go through some cumbersome/slow interface to control the home. A problem I’m sure a lot of us get to deal with :slight_smile:

Solution:
I’ve been using an iOS/Android/Windows Phone app called Unified Remote, to control Plex, for ages and recently discovered it has an option to create custom remotes. The idea is: you configure the layout and commands for a remote, add it, and any device that you use unified remote on, will grab the new remote from the server and be able to use it without any client side configuration.

The client-side app is well made, REALLY FAST, offers widgets, and even has awesome tasker integration (on Android), so in practice it is much better to use than for example the 1st party Phillips Hue app.

I’ll try to explain how to, in detail. My apologies in advance as English is not my first language and I am not good at writing tutorials :smiley:
Unified Remote is an over-complete app with very good documentation for the default features. I’ll only cover how to create custom remotes to control Home-Assistant.

Tutorial:

Prerequisites:

  • Home-Assistant
  • Windows/Mac/Linux(Pi!) PC for you to install the server app. I run this on the same PC that runs my HA instance and serves as home theater (the default remotes in UR are great too)
  1. Install the server app on your PC and start it.

    there’s a management interface on http://localhost:9510/web/, we don’t need this yet.

  2. Get the example remote I made here

  3. Find the UR server custom remotes folder and extract the zip from step 2 into it.

    Windows: C:\ProgramData\Unified Remote\Remotes\Custom

    Mac: ~/Library/Application Support/Unified Remote/Remotes/Custom

    Linux: ~/opt/urserver/remotes/custom

  4. The folder has the following:

    Icon.png - This will be the logo of your custom remote in the client-app

    Meta.prop – in-app name, description and author of the remote

    Layout.xml – remote layout configuration

    Remote.lua – remote action configuration, refers to scripts from the scripts subfolder

    /Scripts – holds a few shell scripts that run HTTP POST commands to Home-Assistant

  5. Go into the scripts folder and open chromecast.sh in your favorite text editor

  6. The curl command is an example which will toggle on/off a switch through HA. The Home-Assistant API is documented in great detail here.
    the other example shell scripts contain curl commands to control lighting.

  7. Make all the shell scripts you want for this remote.

  8. In the main folder, open meta.prop with your text editor, edit it, save.

    meta.name is what your remote will be called in-app (the main folder and meta.name should be the same)

    meta.author, that’s you baby!

    meta.description is the in-app ‘sub-title’. Keep it short, otherwise it’ll run off the screen

  9. Open remote.lua with your text editor. Any lines starting with - - are comments and don’t do anything. The first line includes the ‘script’ component in this remote. You need this to call shell scripts. Every ‘action’ in the remote is 3 lines. simply edit the unique name and script and you’re done. example:

    actions.UNIQUE NAME = function ()
    script.shell(“sh scripts/SCRIPT HERE.sh”);
    end

  10. Add an action for every shell script. I found that having more than 15 actions makes a remote really messy but there’s no actual limit.

  11. Open layout.xml in your text editor and go to town! Every button is one line. give each button a name and tie an action (defined in step 9) to it. Grouping buttons together between tags will create a horizontal row, from right to left. <button text="*BUTTON NAME*" ontap="*ACTION NAME*" />

  12. Go to the UR management interface: http://localhost:9510/web/ and tap restart server.

  13. Once the server is back up, the client app on your phone should already have the new remote!
    If it didn’t show up go check the LOG tab in the management interface for any red lines which will tell you where there are syntax errors in your custom remote config.

  14. Go tell your SO/family/roommates that controlling the smart home is now simple and convenient!

  15. No more sleeping in the dog house :smiley:

8 Likes

As the guy who requested this; thanks very much!! I definitely have put this on my to do list for HA projects. Awesome that you responded so quickly; I think a lot folks are going to like this.

In case it didn’t occur to anyone, this could be used to easily create a tablet based “control panel” for HA.

1 Like

The link for the remote is not working?

Good idea! I wish i could try it out. Also thanks for sharing your work.

Which link specifically? I tried the ones linking to the website for UR and the play store entry and both worked fine for me.

Hi! Thanks for post your great idea here! Eventhough yo mentioned English is not your first language the tutorial goes great. Actually I want to implement it as I alredy have UR Full but the link of the GoogleDribe on ste number 2 is broken, so could you please help us with that?
Thanks again!!!

Do you happen to have the UR remote available? The Google Docs link no longer works to download it.

I just used the link in the original post and it linked me to their site:

link in number 2 is for the example remote and is not available anymore

You’ll have to PM the OP then.

Oops. I deleted it off my drive because I didn’t remember what it was there for. Here is a new example. It’s not the same one but should do fine as a template either way :slight_smile:

3 Likes

Many thanks :slight_smile:

Thanks for supporting my laziness :wink:

Hey! Thank you so much! I have had the same problem so many times haha

Hi, me again :frowning:
Sorry for this but if possible can you please help me?

I have HA intalled through AIO secured with DuckDNS and Let’s Encrypt so I have my router port fowarded from 443 to 8123, the problem after check the logs is with the “sh” files when i attemp to run the sh file from the command line to test it, like this

sh /opt/urserver/remotes/custom/Cocina/Scripts/CocinaLed.sh

it returns me this
curl: (51) SSL: certificate subject name ‘nameofmyserver.duckdns.org’ does not match target host name ‘192.168.1.240’

And actualy since the time I installed HA with Let’s Encrypt I can only access HA from my lan typing my local addres https://192.168.1.240:8121 and I only can use https://nameofmyserver.duckdns.org from the outside

Best

I don’t use DuckDNS and/or Let’s Encrypt myself.
I did choose to keep my unified remote server only accessible locally so I use local IP’s in the curls and it works fine.

When you press a button in your remote, does it appear on your log in UR?
I finished my remote, but the remote doesn’t work. I try to turn on a switch, but when I press the button in my remote, it doesn’t react in HA. Neither in the log of UR or the log of HA show any attempts for this to work?

This is a good thing for heavy users of Unified Remote - but I came here after it occurred to me that a Unified Remote server running on a PC could form the basis of a Home Assistant component, providing staple controls like such components as media_player. Maybe it would deserve to be a new component like ‘windows_computer’. The simple web APIs of Unified Remote are the perfect middleware for HA to integrate with, and control, a Windows PC. I have been using EventGhost for various per-function integrations, but I think Unified Remote is more fitting to the task.

I think the moment is begging for someone to make a Home Assistant component. I would if I knew how :):thinking: