No announcement yet.

Ocelot CMAX Programs

This topic is closed.
  • Filter
  • Time
  • Show
Clear All
new posts

    Ocelot CMAX Programs

    Was wondering if anyone had any neat and useful Ocelot CMAX applications they are using?

    Was just curious to see what others here are doing. And was wondering if perhaps we could have others on here post (perhaps in this forum or in another) useful CMAX programs?

    The program I'm currently running on my Ocelot does the following:

    1. Complete sprinkler control of 8 zones, 2 times per day, overridable by HomeSeer and X10, sends status upon request over X10 (in order to update my KeypadLincs), will soon have a "pause" feature so if I get in the shower while sprinkler is running, I can turn it off temporarily, and when it gets "unpaused" it will pick up where it left off, etc...

    2. Watchdog timer so that it knows my HA computer (running HomeSeer) is up. if it is, certain actions the Ocelot will leave to HS. if the Ocelot determines that HS is not up, it will automatically handle some things such as outdoor lighting (make sure outdoor lights are OFF during daytime (ie: PR511 motion sensor has this problem), turn on outdoor lights at nights), bedtime routines, etc. This way if I reboot the PC I don't loose functionality (or at least not much).

    3. Control of my garage door - so I can X10 OPEN/CLOSE it (which requires some logic), have it automatically shut at night (unless HS tells it not to), etc.

    4. (To come) Automatic filling of my fountain if it gets low (have a small leak in the return pipe, don't feel like pulling up patio block and replacing the pipe...). Ensuring pump goes off when temp is too low, no motion detected on the patio for a while, or for some reason water level is too low (don't want to burn out the pump).

    5. (To come) Security system - watching my doors, etc. Need to do some design work on this.

    All of this the Ocelot will handle by itself (1-3 it already does). Am ensuring that HomeSeer can override any of this if I get a wild hair I want HS to take over, as well as changing parameters (such as times) on the fly.

    Of course, eventually I plan to get into the IR side of things... Have a few more cables to run to the right rooms first.

    Any other ideas would be great. Would love to see what some others have done.

    If this is not the appropriate place to share these, any ideas on where a better place would be?

    If anyone is interested, I can post my source code for the Ocelot as well as my HS scripts.

    I'm trying to figure that out myself - (admitted total newbie).


      The sprinkler thing was cool when I first set it up, but it's way cooler when you can use a touch-screen to turn the sprinkler zones (or the full "run") on and off. Not only can my wife run the sprinklers, any guest can do it.

      Haven't done the "pause"... that's a good idea. Can "stop" easily (Leopard or any touchpad in the house) and "start" from anywhere.

      I use a garage door alarm contact to detect open/close (on SECU16) and have HS send a MS_Client message including a picture of the driveway when it opens. I also have a MS_Client message that goes out when the garage door is open and the motion in the garage sees nothing for ten minutes; that message has a link to close the garage (from any touchpad in the house). I didn't want to do the "automatic close" lest the car be left in the way; with the camera shot, I can make a better decision on closing and simply "tap" if it should be closed.

      I use motions and contacts on a SECU16 to activate simple "follow the action" lights on/off. Fast and reliable - even if I'm loading something new and have HS down.

      Lots more fun stuff to do with a Leopard and/or touchpads... and the WAF is good.

      (see profile for environment)


        I'll try to post the garage door CMAX code by this coming weekend. Had a little buglet in it I discovered regarding the sending of ON/OFF Status codes when the door changes states. Usually right after the door opened or closed, it would send out the wrong status for the two sensors. Don't know why, but suspect it is a timing thing. Believe the "fix" would be to have it send the G1 STATUS_ON or whatever in the NEXT loop of the Ocelot program instead of whenever the module/point actually changes status. Will have to investigate this.

        If I have HomeSeer send a G STATUS_REQUEST, however, it correctly sends back the correct status for both sensors - leading me to believe that this might fix it. Must have something to do with queueing up multiple X10 commands in a single loop through the CMAX code... Once I figure it out I'll email ADI to see if it is an Ocelot bug or something else (it could be in my code).

        Incidently, upon further examination, my sprinkler code had the same issue - though its funny, HS gets it "right" for a split second (ie: if I turn Zone 1 on), but then immediately it updates and shows the wrong status...

        Another though this that this could be a bug with HomeSeer seeing multiple unit codes on a single status request. Perhaps this is also not X10 spec?

        For instance, when I get a E STATUS_REQUEST for my sprinkler for instance, I have the Ocelot looking at all the zones that are on (which should only be one at a time) and then sending all the unit codes for these and then STATUS_ON.

        Same thing for Off. So if Zone 2 is on, and zones 1, 3, and 4 are off, I would have the Ocelot send:

        E2 STATUS_ON
        E1 E3 E4 STATUS_OFF

        Is the above a valid response to a status request (ie: sending multiple unit codes for the same STATUS_OFF)??

        Perhaps this is not spec X10, or perhaps HS gets confused? Anyone know how I should send the status responses? Would it be better for me to send them one at a time, ie:

        E2 STATUS_ON
        E1 STATUS_OFF
        E3 STATUS_OFF
        E4 STATUS_OFF

        Reason I didn't want to do that (slightly easier to code it that way actually, a few less CMAX lines), is that I didn't want to put a lot of extra stuff on the power line - this would be 2 extra X10 transmissions over the first.

        Anyways, once I fix this, I'll gladly post the CMAX code for the garage door and probably the sprinkler as well.

        I'd just hate to have someone leave their garage door open all night just because my code sends the wrong status to HomeSeer, making it think the door is closed... :-)



          I believe that it is only valid for one device to respond to a status request at a time. That is HS would send out A1 Status Request and it would only be valid for A1 to respond. The Status On and Status Off messages only have a house code and not the unit code in them.




            Thanks for the reply.

            For a STATUS_REQUEST, you are correct, you can't specify a Unit code... only the house code, ie:

            E STATUS_REQUEST

            The following does not appear to just check the status for E1:

            E1 E STATUS_REQUEST

            At least not that I can tell (I could be wrong on this). The initial E1 is ignored and everything on E responds to the request (if it supports Status). Please correct me if I'm wrong.

            However, I believe you are incorrect when it comes to STATUS_ON and STATUS_OFF. For a STATUS_ON or STATUS_OFF it is true that you can only send a house code first (ie: E STATUS_ON for instance), however, this is the same as with an ON or OFF command (ie: E ON). You normally precede the commands with a list of unit numbers on the same house code. Ie:

            E1 E ON

            This would be the command actually sent over the power line, If I wanted to turn both E1 and E2 on at the same time, I could send

            E1 E2 E ON

            And it would do it... (E1 E ON E2 E ON would turn E1 on first, then E2).

            Thus, it is technically "Valid" for me also to send

            E1 E2 E STATUS_ON

            This would go out over the power line correctly. Question really comes to how HomeSeer, CM11A and PSC05/TW523, and other devices (like my KeypadLincs) respond to this. They might prefer E1 E STATUS_ON E2 E STATUS_ON instead...

            Anyone know if there is any problem with other devices seeing STATUS commands in the first way (ie: E1 E2 E STATUS_ON)?

            BTW - On further investigation, I found out one thing... It appears that if my CMAX code turns on a Module/point and then sometime after that (in the same loop), i check the status of the Module/Point, it will say it was OFF (assuming it previously was off).

            I guess this is because the status of the relay will only change between loops. I have not fully tested this...

            Thus, if on a condition I do a

            <pre class="ip-ubbcode-code-pre">Then Module# 1/Point# 1 Turns On</pre>

            and later check the status of it:

            <pre class="ip-ubbcode-code-pre">If Module# 1/Point# 1 Is On</pre>

            that the module/point appears to be OFF.

            Will need to test. That would certainly explain part of why HS thinks the status is wrong...

            If this is so, then I'll just need a variable that will only send the status the next time through the loop... (I could just use a variable to ask if I just turned it on, but I would rather ask the module/point itself to be sure something else (programming bug for instance) didn't just turn it off).


              I have a Leopard unit which is basically the same as an Ocelot with a touchscreen display added and I don't see any mention of it in the Homeseer Documentation. Was wondering if there are any threads in these forums that deal with the Leopard unit and if there is anyone working or has developed any working scripts for the Leopard unit and the touchscreen/display portion.

              Thanks Much


                Ok, I finally got back to working on my garage door CMAX scripts (holidays and all threw that off) and hopefully will be able to post them late next week...


                  I am planning on using the Ocelot to directly control mains voltage apliances and lights.

                  Over here in Australia, X10 devices are 3 times the cost (taking into consideration exchange rates etc) of equiv units in the US, because I believe there is only one manufacturer of 240V X10 devices, so they charge what they can get away with. Also, we have very few X10 device models to choose from, and none support 2 way communication.

                  So I came up with the idea of using the Ocelot to do the same job.

                  The switch contacts would be wired to the SECU16 inputs (no voltage) to detect requests for lights/appliances on/off.
                  The SEC16 outputs would be wired to some Clipsal CBUS relays, where the control circuit of the relay does not have any voltage on it.

                  The only thing I cannot do with this setup is dimming, but at least I would have a more responsive, reliable and flexible configuration in comparison to 240V X10.

                  Adelaide, Australia



                    First off there are mods on some of the websites that will show you how to convert 120v X10 modules into 240v modules. Ido Bartana's site has much of this on it Ido Bartana's Automation Site

                    As far as using the SECU to do this, instead of using just one input per switch on the SECU, you can actually wire resistors (of different values) across each switch and then use CMAX to look at the values coming back to determine what switch is on, off, etc...

                    This way you can greatly increase the number of usable devices you can connect to one SECU. I believe Guy Lavoie posted something on this about a week or so ago... Its fairly descriptive.

                    This is what I'm using for my garage door, have two magnetic contacts (right now, probably will put a third in the middle) to determine the door status, if closed, or open. Both contacts are connected to the same input on the SECU. Using a 470 ohm across one, and a 1k ohm across the other. Also have an end of line 1k ohm resistor.

                    This makes it easy for me within CMAX to determine which switch has been tripped on a single input. You can also detect if both are tripped (though this should never happen in my case). I'm also planning on adding a motion sensor (which only uses closed contact) to this mix on the same input (too lazy to run extra wire when its right above the garage door).

                    I'd suspect, you should be able to get around 6 switches or so per input this way if you use high tolerance (5%) resistors. My readings of the states are always within 2 values of the norm (ie: out of the 256 values the Ocelot can show). Other advantage is that with this setup you can detect an open circuit or short circuit in the line with CMAX.

                    Plan on doing this with my doors and windows to use the Ocelot/SECU as a simple security system without using too many inputs.


                      I am running a 420 line C-Max 2.0 .pgm it incorporated the following features.

                      1. Keeps track of changing seasons, to automate sprinkler timings (4 Zones)

                      2. Keeps track of Holidays

                      3. Operates home office lighting and other stuff

                      4. Monitors the alarm settings and provides some safety features if the alarm is tripped.

                      5. Adjusts HVAC controls based on season and exterior temperature.

                      I am currently on my 62nd code revision and am always looking for ways to improve or add functionality. Here is a sample of the Seasons code:

                      <pre class="ip-ubbcode-code-pre">
                      IF Month is = December (12) // Winter
                      AND Day of Month is &gt; 21 //
                      OR Month is &lt; March (3) //
                      THEN Season = Winter //
                      THEN Skip to line 72 //
                      IF Month is = March (3) //
                      AND Day of Month is &lt; 21 //
                      THEN Season = Winter //
                      THEN Skip to line 68 //
                      IF Month is = March (3) // Spring
                      AND Day of Month is &gt; 20 //
                      OR Month is = April (4) //
                      OR Month is = May (5) //
                      THEN Season = Spring //
                      THEN Skip to line 62 //
                      IF Month is = June (6) //
                      AND Day of Month is &lt; 21 //
                      THEN Season = Spring //
                      THEN Skip to line 58 //
                      IF Month is = June (6) // Summer
                      AND Day of Month is &gt; 20 //
                      OR Month is = July (7) //
                      OR Month is = August (8) //
                      THEN Season = Summer //
                      THEN Skip to line 52 //
                      IF Month is = September (9) //
                      AND Day of Month is &lt; 23 //
                      THEN Season = Summer //
                      THEN Skip to line 48 //
                      IF Month is = September (9) // Fall
                      AND Day of Month is &gt; 22 //
                      OR Month is = October (10) //
                      OR Month is = November (11) //
                      THEN Season = Fall //
                      THEN Skip to line 42 //
                      IF Month is = December (12) //
                      AND Day of Month is &lt; 22 //
                      THEN Season = Fall //

                      [This message was edited by Bud on Sunday, 19 January 2003 at 06:40 AM.]

                      [This message was edited by Bud on Sunday, 19 January 2003 at 06:40 AM.]


                        Here is one way to shorten that season routine:

                        <pre class="ip-ubbcode-code-pre">
                        0001 - IF Month is = March (3) // If March
                        0002 - AND Day of Month is &lt; 21 // and before 21st
                        0003 - OR Month is &lt; March (3) // or before March
                        0004 - THEN season = winter // then season = winter
                        0005 - THEN Skip to line 21 // and exit routine
                        0006 - IF Month is = June (6) // If June
                        0007 - AND Day of Month is &lt; 21 // and before 21st
                        0008 - OR Month is &lt; June (6) // or before June
                        0009 - THEN season = spring // then season = spring
                        0010 - THEN Skip to line 21 // and exit routine
                        0011 - IF Month is = September (9) // If September
                        0012 - AND Day of Month is &lt; 21 // and before 21st
                        0013 - OR Month is &lt; September (9) // or before September
                        0014 - THEN season = summer // then season = summer
                        0015 - THEN Skip to line 21 // and exit routine
                        0016 - IF Month is = December (12) // If December
                        0017 - AND Day of Month is &lt; 21 // and before 21st
                        0018 - OR Month is &lt; December (12) // or before December
                        0019 - THEN season = fall // then season = fall
                        0020 - ELSE season = winter // else season = winter
                        0021 .... </pre>

                        If you don't know what you're doing... do it neatly


                          <BLOCKQUOTE class="ip-ubbcode-quote"><font size="-1">quote:</font><HR>Originally posted by Brian Raynor:

                          As far as using the SECU to do this, instead of using just one input per switch on the SECU, you can actually wire resistors (of different values) across each switch and then use CMAX to look at the values coming back to determine what switch is on, off, etc...

                          This way you can greatly increase the number of usable devices you can connect to one SECU. I believe Guy Lavoie posted something on this about a week or so ago... Its fairly descriptive.


                          Where is the Guy Lavoie post you reference. I could not find it. Also tried AppDig site but there may be a problem with that site.

                          I definitely want to try using multiple resistors. Also could use a little help on the CMAX code for such a set up so I hope Guy's explanation includes a reference to CMAX code as well.

                          Jim Doolittle
                          Jim Doolittle

                          My Twitter
                          My Hardware & Software


                            Yes, the routine I outlined using resistors is in the thread on garage door automation. You configure the SECU16 input in analog mode. There are C-Max code fragments in the explanation as well.

                            The site is having problems and will hopefully be back up very soon. It seems the hosting service has experienced a crash of some kind...

                            If you don't know what you're doing... do it neatly.



                              Found you reply in the garage door automation. Actually read it before but didn't realize the power of multiple resistors to utilize a single input until I read this topic. Thanks

                              Jim Doolittle
                              Jim Doolittle

                              My Twitter
                              My Hardware & Software