Your Universal Remote Control Center
RemoteCentral.com
Harmony Remote Controls Forum - View Post
Previous section Next section Up level
Up level
The following page was printed from RemoteCentral.com:

Login:
Pass:
 
 

Topic:
Smart State programming with discrete codes
This thread has 2 replies. Displaying all posts.
Post 1 made on Sunday December 9, 2001 at 21:41
Eric Warnke
Founding Member
Joined:
Posts:
December 2001
45
Here is the rough draft, please give feedback. I do not work for easyzapper, just a programmer by trade.

Smart State Tutorial -- Revision 1
by Eric Warnke

With the light ammount of documentation at the harmony website I decided to sit down and try and explain to other what I have discoverd about programming smart state variables for the Harmony remote.

I would like to thank those at harmony that has fielded many of my bizzare questions so far, and for those that are still comming.

Smart states are a great way of programming the remote to do things the way you want them to. Unlike simple macros they are intelligent enough to know what state they are in and what they need to do to get where they need to be. Once inserted into a device XML you only need to refere to them by name and value, you don't need worry about how it works anymore. I will assume that people have a basic understanding of structured file formats like HTML and XML.

I will use as my example my TV, it's a 16:9 enhanced set. The set has various ways of streching the picture to get it to fill the screen. There are 5 modes in all and each one works slightly diffrently. Each one of these modes can be set by using a combination of IR commands to bring up a menu, pick a mode, and then exit. First things first, I digitized the IR command for the PicSize button on my TV remote. This will come into play later.

The modes are as follows

Normal, TheaterWide1, TheaterWide2, TheaterWide3, and Full.

So first I have to go and define the smart state for this extension for my TV. I will call it PictureSize. Using the documentation that is already on the Harmony site, here is the XML for this feature, please note that this is just and example, it is incomplete as is.

<FEATURE>
<NAME>InternalState</NAME>
<STATEVARIABLE>
<NAME>PictureSize</NAME>
<VALUE>Normal</VALUE>
<VALUE>Theater Wide 1</VALUE>
<VALUE>Theater Wide 2</VALUE>
<VALUE>Theater Wide 3</VALUE>
<VALUE>Full</VALUE>
</STATEVARIABLE>
</FEATURE>

For anyone who has done HTML or XML this is fairly self explanitory. Some things to note. All elements should be capitalized, if you are getting an error inserting XML into a device or activity always check for spelling and capitilization in your XML. This example also assumes that there are no other state variables alreay defined, if that were the case we would just be extending the InternalState that was already defined.

The current documentation only shows how to cycle between states using the NEXTVALUE tag as follows.

<NEXTVALUE>
<IRPRESSACTION>PicSize</IRPRESSACTION>
</NEXTVALUE>

Unfortunatly, in my case pressing the button once brings up the menu, but does not toggle to the next input. What I need was a way to go directly to another state using a set of commands. So using the XML as a guide I figured out how to define Smare States that use descrete menthods to go between. I have confirmed that this is the correct syntax.

<SETVALUE>
<VALUE>Normal</NORMAL>
<IRPRESSACTION>PicSize</IRPRESSACTION>
<IRPRESSACTION>0</IRPRESSACTION>
<IRPRESSACTION>Exit</IRPRESSACTION>
</SETVALUE>

So after I complete that, here is what out state variable looks like now.

<FEATURE>
<NAME>InternalState</NAME>
<STATEVARIABLE>
<NAME>PictureSize</NAME>
<VALUE>Normal</VALUE>
<VALUE>Theater Wide 1</VALUE>
<VALUE>Theater Wide 2</VALUE>
<VALUE>Theater Wide 3</VALUE>
<VALUE>Full</VALUE>
<SETVALUE>
<VALUE>Normal</VALUE>
<IRPRESSACTION>PicSize</IRPRESSACTION>
<IRPRESSACTION>0</IRPRESSACTION>
<IRPRESSACTION>Exit</IRPRESSACTION>
</SETVALUE>
<SETVALUE>
<VALUE>TheaterWide1</VALUE>
<IRPRESSACTION>PicSize</IRPRESSACTION>
<IRPRESSACTION>1</IRPRESSACTION>
<IRPRESSACTION>Exit</IRPRESSACTION>
</SETVALUE>
<SETVALUE>
<VALUE>TheaterWide2</VALUE>
<IRPRESSACTION>PicSize</IRPRESSACTION>
<IRPRESSACTION>2</IRPRESSACTION>
<IRPRESSACTION>Exit</IRPRESSACTION>
</SETVALUE>
<SETVALUE>
<VALUE>TheaterWide3</VALUE>
<IRPRESSACTION>PicSize</IRPRESSACTION>
<IRPRESSACTION>3</IRPRESSACTION>
<IRPRESSACTION>Exit</IRPRESSACTION>
</SETVALUE>
<SETVALUE>
<VALUE>Full</VALUE>
<IRPRESSACTION>PicSize</IRPRESSACTION>
<IRPRESSACTION>4</IRPRESSACTION>
<IRPRESSACTION>Exit</IRPRESSACTION>
</SETVALUE>
</STATEVARIABLE>
</FEATURE>

Ok, now that wasn't too bad. But now that we have the state variable, what can we do with it? From many places in the XML you can now change that state by using the following command

Television::SetState PictureSize Normal

or to cycle through states you can use

Television::IncrementState PictureSize

Those commands just listed can be added to a change button activity on the website if you are using "Advanced" mode.
OP | Post 2 made on Sunday December 9, 2001 at 21:45
Eric Warnke
Founding Member
Joined:
Posts:
December 2001
45
Oh, feel free to copy bit ans peices, just give credit if you are copying most of this.

I have more comming, I just got tired of typing.
Post 3 made on Monday December 10, 2001 at 13:23
Mike Riley
Founding Member
Joined:
Posts:
May 2001
620
Eric: Just read through your tutorial. Nice work. Thanks for contributing, from the rest of us! ... Mike


Jump to


Protected Feature Before you can reply to a message...
You must first register for a Remote Central user account - it's fast and free! Or, if you already have an account, please login now.

Please read the following: Unsolicited commercial advertisements are absolutely not permitted on this forum. Other private buy & sell messages should be posted to our Marketplace. For information on how to advertise your service or product click here. Remote Central reserves the right to remove or modify any post that is deemed inappropriate.

Hosting Services by ipHouse