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
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
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
- iOS / Android / Windows Phone device with the PAID Unified Remote app installed
- 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)
-
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.
-
Get the example remote I made here
-
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
-
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
-
Go into the scripts folder and open chromecast.sh in your favorite text editor
-
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. -
Make all the shell scripts you want for this remote.
-
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
-
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 -
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.
-
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*" />
-
Go to the UR management interface: http://localhost:9510/web/ and tap restart server.
-
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. -
Go tell your SO/family/roommates that controlling the smart home is now simple and convenient!
-
No more sleeping in the dog house