My Home Theater Remote Control

As a noob, I’ve been so grateful for the support of this Community over the last 4 months. I’m offering two versions of my recently-stable plain-old-vanilla home theater remote controller if anyone is interested. The first version [Home_Theater_Behavior.hrp] is a “behavioral” model divorced from actual devices, that I used to choreograph page transitions, button functions, and logical flows. It doesn’t need to find (or control) actual IP hardware, so I can work on it without disturbing my actual operational home theater system. The second version [Home_Theater.hrp] is same as the first, but with actual devices and full IP control of live IP hardware.

Fair warning: The radio tuner function is still a work in progress - it will be my first dip into the plugin pool, but for now is simply a blank stub.

I know this controller is not the most elegant or efficient implementation, but with all its warts and defects it currently works very well for me.

Dropbox locations (~10 Meg files):

  1. Home_Theater_Behavior.hrp Dropbox - Home_Theater_Behavior.hrp - Simplify your life

  2. Home_Theater.hrp
    Dropbox - Home_Theater.hrp - Simplify your life

Terry

1 Like

Thank You for sharing. A nice clean design. That,s what I like.

Soon after I completed my first HR home theater remote controller design, I found that making changes to add or delete functionality was a monstrous pain. I had shoveled so much “functionality” into individual buttons that every change I made rippled through nearly the entire layout. After a little experimentation with Scenes, I decided to redesign the remote controller as a state machine. With this state machine approach, I designed my first plugin as the state machine controller, and constructed Scenes as the elements of the state machine executive. Now, each button only performs 2 operations when pressed: 1) Load a new page into the page browser and 2) Update a plugin attribute with the ID of the pressed button.

My first pass at the remote controller redesign (Auto_Lock_OFF.hrp) followed the conventional wisdom that once started, the HR app would run 24/7 without interruption. My host is an iPad Mini (Gen 5 with a HOME button), so I set Auto Lock to “Never”. On the HR MainPage.xaml settings, I set IdleDim to True and IdleTimeout to 120 (arbitrary, but I just followed the iPad 2-minute minimum). I initialized all my plugin attributes within the onConnect() function and everything worked well. Until it didn’t. When the iPad mini screen dims, everyone in my household reflexively hits the HOME button - which suspends the app and returns the iPad to the home page. When I tap the app to restart, onConnect() executes, re-initializing all my attributes. I lose the state of my system. Newer-generation iPads that don’t use a HOME button probably wouldn’t be affected, and could probably use this version just fine.

I took a second pass at the redesign, assuming Auto Lock was ON. I needed to find a mechanism to save my plugin attribute information through a sleep/wakeup cycle. I’ve known for some time that Device Variables persist through a sleep/wakeup cycle, so I took an ugly approach and duplicated my plugin attributes as Device Variables. This accomplishes two things. First, whether the app comes up initially or through the HOME reflex response, I use onConnect() to trigger a special RestoreState Scene. RestoreState copies the contents of specific Device Variables into their corresponding plugin Attributes. Second, whenever a button press occurs, I force the plugin to trigger another special SaveState Scene. SaveState copies the newly-changed plugin Attributes into their corresponding Device Variables. SaveState ensures the latest state machine state variables persist through a sleep/wake cycle, and RestoreState ensures the plugin state machine controller is always working with the freshest information.

Both controller versions, their respective plugins, and additional details on the state machine can be found in the following Dropbox link: Dropbox - Home_Theater_State_Machine.zip - Simplify your life

Terry