I'll attach my CMAX code. If you cannot read Word document then I can convert it for you. The following is just a little extract to show you what I'm doing. The first thing of course is to program the ocelot to recognize the remote. I dont recall if I used any of Jons database for this part but I do know I did some some IR learning with CMAX to complete the set of codes I needed. The next is to write the CMAX program to make the transformations.
The first part recognizes the code that I programmed to be IR location 58. It corresponds to the volume button on the remote. IR 59 is the other volume button (up/down). In my case if the remote is sending IR 58 I remember that in ocelot variable 31 with a value of "1 IR pulse". A pulse is processed each CMAX program cycle.
<pre class="ip-ubbcode-code-pre">IF Transmit IR 58 ‘volume
Then Variable 31 = 1
IF Transmit IR 59
Then Variable 30 = 1
</pre>
Homeseer can also write to variables 31 and 30 should it want to change the volume level. In this case it may want to bump it up 5 notches so it would store a 5 in variable 31.
A little later in the CMAX code is the engine that looks at the "request" set of variables and for this example for volume up control. The IR to send to my amp volume up control is IR 128 so the following keeps sending "volume up" pulses until the requested value (variable 31) has counted down to zero. I use variable 32 to keep track of the absolute volume level with maximum volume, as it turns out, to be at a value of 32. This value of 32 was determined experimentally.
<pre class="ip-ubbcode-code-pre">
IF Variable 31 is not 0 ‘Volume up
Then Variable 31-1
Then Send IR 128
Then Variable 32+1
IF Variable 32 > 32 Then
Then Variable 32 = 32
</pre>
So homeseer can set set variable 31 to change the volume (e.g. cpuxa.SetVar 31,1) or it can see what the current volume level is (cpuxa.GetVar(32))
My CMAX code has some combined logic for other controls such as power on the remote turns on/off multiple components. I also have some video switching logic that was tricky to work since some of my switching is in the TV's video inputs and some is in the AV Receiver's. There is also some sound normalization based upon Stereo vs DSP modes of operation. After I got it all straightened out then I wrote the web page which shows the configuration that homeseer believes that the ocelot set everything to. That made it much easier to see what was happening, but of course after it was all debugged the web page was no longer needed. The only thing that I need to do on occasion is recalibrate the volume. All this means is to keep hitting the remote until the volume goes all the way down and CMAX software will limit out at 0 so it is recalibrated. Dont need to do that very often, however.
The first part recognizes the code that I programmed to be IR location 58. It corresponds to the volume button on the remote. IR 59 is the other volume button (up/down). In my case if the remote is sending IR 58 I remember that in ocelot variable 31 with a value of "1 IR pulse". A pulse is processed each CMAX program cycle.
<pre class="ip-ubbcode-code-pre">IF Transmit IR 58 ‘volume
Then Variable 31 = 1
IF Transmit IR 59
Then Variable 30 = 1
</pre>
Homeseer can also write to variables 31 and 30 should it want to change the volume level. In this case it may want to bump it up 5 notches so it would store a 5 in variable 31.
A little later in the CMAX code is the engine that looks at the "request" set of variables and for this example for volume up control. The IR to send to my amp volume up control is IR 128 so the following keeps sending "volume up" pulses until the requested value (variable 31) has counted down to zero. I use variable 32 to keep track of the absolute volume level with maximum volume, as it turns out, to be at a value of 32. This value of 32 was determined experimentally.
<pre class="ip-ubbcode-code-pre">
IF Variable 31 is not 0 ‘Volume up
Then Variable 31-1
Then Send IR 128
Then Variable 32+1
IF Variable 32 > 32 Then
Then Variable 32 = 32
</pre>
So homeseer can set set variable 31 to change the volume (e.g. cpuxa.SetVar 31,1) or it can see what the current volume level is (cpuxa.GetVar(32))
My CMAX code has some combined logic for other controls such as power on the remote turns on/off multiple components. I also have some video switching logic that was tricky to work since some of my switching is in the TV's video inputs and some is in the AV Receiver's. There is also some sound normalization based upon Stereo vs DSP modes of operation. After I got it all straightened out then I wrote the web page which shows the configuration that homeseer believes that the ocelot set everything to. That made it much easier to see what was happening, but of course after it was all debugged the web page was no longer needed. The only thing that I need to do on occasion is recalibrate the volume. All this means is to keep hitting the remote until the volume goes all the way down and CMAX software will limit out at 0 so it is recalibrated. Dont need to do that very often, however.
Comment