Jump to content
C4 Forums | Control4

Programming Tips and tricks


TexasBill

Recommended Posts

I find it interesting to see what others have programmed and why - so I thought that I would start a thread and periodically put things in it that I found helpful when I figured them out and ask others to put in their cool tips as well.

There are two types of "houses" using C4 -

1. those that are "rigid"

2. those that are flexible

I like (generally) having things that are flexible. I have a LOT of "variables" - for party mode or the cleaning lady being here or the alarm state is on etc. One of the things that bit me in an earlier life (X-10 programming on Stargate in my prior house) was the problem of "if you enter the room the lights do this..." I have a rather sophisticated time of day algorithm that sets brightness etc but EVERY time the motion detector is triggered - in a RIGID house - using RIGID programming the house always responds the same way. Meaning that if you try and manually override the lights, as soon as you move they will go back to their settings in the program.

A flexible option is something like the following: (pseudo code)

If motion is detected:

If timer is running - then reset the timer

If timer is NOT running then START the timer and do "this" with the lights.

NOW when you enter a room you get a default setting on your lights and fans etc. BUT - if you wife wants something different - she can MANUALLY adjust them and they will stay that way until the timer expires and you start the process all over again - now you just need to lengthen the timer until she stops fussing about the lights going out when she is actually in the kitchen (or other room).

Obviously you can set other things in this like:

If the temperature in the room is above "x" then turn on the fan

If the temperature is below "x" then turn off the fan.

Link to comment
Share on other sites


Another thing that I think is pretty slick is that (pseudo code)

If door is opened start timer :

If timer expires then announce "The door or window has been left open."

You can repeat this periodically as needed to keep it shut -

UNLESS you are in PARTY MODE obviously OR you have turned off the "NAG" variable.

We have a 12 foot door that is 10 feet high that opens to the loggia - if and when this is opened I turn off the thermostat (after 15 minutes of being opened) so that the air conditioner and heat are not running.

Link to comment
Share on other sites

I'm also a fan of the 'flexible' option.

My walkaround lighting is programmed in a somewhat flexible manner.

Basically, I use a predetermined light level for my walkaround lighting, and the light will only get switched off if the light is still at that same level, so if you ramp the level up or down or manually turn the light on, etc., the light will not get switched off after the 'no motion' timer expires.

I also have a master 'motion lighting' boolean, which I turn on each night and off each morning with the scheduler, but I can also toggle the 'motion lighting' via a button on the 6-button keypad, so if I want to wander around without the lights turning on (front porch at night is my most likely use), I can turn all 'motion lighting' off, and it'll reset to turn it back on the next night.

RyanE

Link to comment
Share on other sites

I'm also a fan of the 'flexible' option.

My walkaround lighting is programmed in a somewhat flexible manner.

Basically, I use a predetermined light level for my walkaround lighting, and the light will only get switched off if the light is still at that same level, so if you ramp the level up or down or manually turn the light on, etc., the light will not get switched off after the 'no motion' timer expires.

I also have a master 'motion lighting' boolean, which I turn on each night and off each morning with the scheduler, but I can also toggle the 'motion lighting' via a button on the 6-button keypad, so if I want to wander around without the lights turning on (front porch at night is my most likely use), I can turn all 'motion lighting' off, and it'll reset to turn it back on the next night.

RyanE

Ohhhh - - - I LIKE the master turn motion off thing - thanks,

Bill

Link to comment
Share on other sites

  • 3 weeks later...

Again - this may bore old timers, but for newbies...

If you think ahead when programming about "events" that you might have that affect your programming - here are some of mine:

1. sunrise

2. sunset

3. party mode

4. cleaning lady arrives or leaves

5. alarm on

6. alarm off

7. guests downstairs

8. turn off announcements

9. doors left open intentionally

10. below freezing

11. manual override for the room (this may require a number of variables)

Once you have all your "events identified" you will usually want to make them be a "variable" that you can flip so that you can have a "status". Meaning that you are in the home away status.

(sunrise and sunset and alarm on and alarm off are notable exceptions.

When the cleaning lady arrives you flip the variable and in yur programming you can make sure tha tthe fans (that would ordinarily be on) are turned off so that cleaning can occur, the temperatures (downstairs) can be set normally and lights can come on and go off downstairs.

Party mode can leave the lights on longer duration than normal and turn on more lights at dusk, and turn off some announcements. For example - my schedule that turns on lights outside for the evening has three levels - normal, low and party mode lighting scene. If party mode is set then party scene is turned on.

I like having a variable for the alarm on and off as well - here is why - if my schedule ordinarily raises or lowers the blinds at a particular time I DO NOT want them done while the alarm is on as it may trigger the alarm. However - if they are supposed to go up at 8 AM and the alarm was on until 8:10 then they will not go up all day long. The variable allows me to easily upon reversal of several options to flip the bit so to speak and then at a later time raise or lower them appropriately.

When ever a door is opened I start a timer and after two minutes announce that the door has been left open. Sometimes you want the house to just shut up - so turning of announcements for an hour will let you leave the house at 6 AM without waking your wife up.

When you double tap up on the left most switch in any room in my house it turns on manual mode for that room. Manual mode allows the user to set any combination of lights or fans and control it manually - manual mode is reset at 9 AM every morning to off and in some cases it is set back to auto on a timer.

Unoccupied floors or rooms in the house are not heated and air conditioned to the same comfortable level as normally occupied areas. Guest arrived variable set the thermostats to normal.

I hope that this gives you some cool ideas to improve your house automation - if you have done something cool or found something that you would like to share please do....

Link to comment
Share on other sites

TexasBill:

This is exactly what I was talking about. I am not afraid to admit that I am new to Control4 programming. At this point, my system is not even installed! Nonetheless, your excellent descriptions will definitely help as I begin programming in the near future.

Anyone else have any programming suggestions, favorite macros/variables/agents/events that you use in your project? The more information, the better. No need to be shy... I will take all information!!!!!

Link to comment
Share on other sites

TexasBill:

This is exactly what I was talking about. I am not afraid to admit that I am new to Control4 programming. At this point, my system is not even installed! Nonetheless, your excellent descriptions will definitely help as I begin programming in the near future.

Anyone else have any programming suggestions, favorite macros/variables/agents/events that you use in your project? The more information, the better. No need to be shy... I will take all information!!!!!

You are welcome - I have found that going "back" and trying to add these in was less fun - what you want to get in the mindset of is "state" - what "state" is my house in - and this variable allows you to change "state" more easily with event driven systems - for example:

My problem was that if you trigger something at a particular time CONDITIONALLY - then once the time has passed and the condition becomes true that it will not execute.

So - I can say that when I set the alarm my actual code looks like:

If schedule time is 30 minutes after sunrise and the solar sensor is receiving sun then lower the solar shades. The problem is that if the alarm is on this could set off the alarm when I am on vacation - so it becomes:

If the variable alarm away = FALSE then:

If schedule time is 30 minutes after sunrise and the solar sensor is receiving sun then lower the solar shades.

Now - the issue (because you can do the above without a variable - you can do the above by testing the alarm system itself) is that when you come home and turn off the alarm - the solar shades never came down and the next time they will be touched by the schedule is at sunset - so you NOW want them to come down.

So - I say -

If Variable Alarm Status changes to HOME and ....

Now no matter when the variable changes I can trigger "missed" events to happen.

HTH.

Bill

Link to comment
Share on other sites

My next one that my wife likes the most is this -

She is very sensitive to light - we have a large number of "blue LED" switches in our bedroom. She wanted those to go off - so -

At 9:30 at night they all go off when you walk in the room. At 7 AM they come back on.

If you get up at night to go to the bathroom they all come on for 15 seconds and then go back off.

It requires code for each switch (unless someone knows how to do this better) but my wife absolutely loves it.

Let me know if you need to see code...

Bill

Link to comment
Share on other sites

You'd have to have your dealer add this, but I recently created a driver to programmatically let you set LED colors on a bunch of devices:

LED Wizard...

RyanE

Ryan - I will contact my dealer - but could you give me a little nudge in the right direction? If he installs this what does it "do"? What can I do with it?

What will it show and where?

Just a little information would help me greatly?

Thanks,

Bill

Link to comment
Share on other sites

bill,

what are you using for motion sensors?

i have concord sensors but haven't really started to use them yet.

My dealer put motion sensors in every single room - some rooms have multiple motion sensors - most (not all) are associated with my alarm system as well.

I have lights and fans (conditionally) and other things that operate based on room occupancy.

Bill

Link to comment
Share on other sites

It is just a 'utility' driver. It won't show up anywhere except in ComposerPro.

It can be used to do programming like:

Set top LED ON to Black on dimmers: 21, 44, 65, 98, 223, 1024.

You can get the DeviceIDs from a 'device chooser' property (so there's some cheesy cut-and-paste for the command).

It just keeps you from having to put in lines and lines of Composer programming to set the LED colors for a set of dimmers / switches / 2/3/6-button keypads.

RyanE

Link to comment
Share on other sites

You can also use an RGB color, instead of the names the driver provides.

RyanE

I called my dealer and he installed it - he looked at it and it (the COLOR pull down) does not point to "colors" - instead it shows you switches?

See example - I would have thought that it would show a color palette? See attached.

See LED WIZ1 picture below.

Link to comment
Share on other sites

Every string parameter in DriverWorks drivers shows you all string variables in the project in the dropdown.

You have to type in the name of the color, and/or the RGB value.

i.e. PURPLE, GREEN, BLUE, BLACK, etc.

They're all listed on the Properties page of the driver.

RyanE

Link to comment
Share on other sites

I suppose you *could* set your LEDs to 'Current Audio Path', but I really don't know what color that'll be.

:)

RyanE

Grin - so when my dealer is off my system and I am in composer HE I will not be able to use this in my programming?

Bill

Link to comment
Share on other sites

Any chance you can post the code? I have the same problem with the LED lights bothering my wife. I use a variable "Night time LED" and "Day time LED" but I have some problems with the LED not going back to it original state on some of the 6 buttons.

Link to comment
Share on other sites

Any chance you can post the code? I have the same problem with the LED lights bothering my wife. I use a variable "Night time LED" and "Day time LED" but I have some problems with the LED not going back to it original state on some of the 6 buttons.

Sure - It will require a little explanation - at a scheduled time I no longer let the fans turn off when the room timer expires at night - this keeps the fans on if they were on already. (so you don't get too hot during the night) So if i have the FANS TURN OFF variable set to NO at 10 PM when that switches and I walk into the bedroom the bedroom light timer expires in ten seconds and "turns all the LED's to BLACK".

During the night if you get up the motion turns them all blue again (providing night lights and lets you see where they are for orientation) for ten seconds and then they turn to black again.

At 7 AM when the fans again respond to the motion detector (room timer expiring) I set them all back to blue - you will notice that I truncated the screen because I have many more switches than would fit easily - but you will get the gist of what I am doing from the three pictures.

My dealer logged on and captured them for me.

Bill

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.