sdigrego Posted March 16, 2013 Share Posted March 16, 2013 I tried to find this in previous posts and haven't been successful.Does anyone have a sugggestion on the best way to set an LED color based on the state (ON/OFF) of the lights in a project?Currently, I have set a single LED color on a three button near my garage door so that if any light in the house is on, it is lime, and if all lights in the house are off, it is navy. This way I can see when walking out the door if any lights have been left on in the house and then push the button to shut them off. I have come to the conclusion that kids are untrainable when it comes to shutting off lights ..I have a boolean variable that is set to True if any light is on, and false if all lights are off. A Macro is triggered any time a light state changes on any of the lights I want monitored. The macro first sets the variable to False, then checks the status of each light state after a short delay, and sets the variable back to True if it finds any light state ON. Whenever the variable changes, if the variable is True, the LED is set to Lime, and if it is False is set to Navy. The problem is I have to add the Macro trigger to each light so that when the light state changes the macro is triggered, and then I have to add a check of each light state to the Macro to set the variable correctly. This becomes a long string of programming when there are a lot of lights and I am wondering if there is a simpler way that anyone else has used. Another thought, does this type of long, string of if-then statements in a macro bog down the system? I don't want to introduce programming that will slow my controllers performance. I am running an 800 on 2.3.Any thoughts or should I leave this one alone? Link to comment Share on other sites More sharing options...
TexasBill Posted March 16, 2013 Share Posted March 16, 2013 I tried to find this in previous posts and haven't been successful.Does anyone have a sugggestion on the best way to set an LED color based on the state (ON/OFF) of the lights in a project?Currently, I have set a single LED color on a three button near my garage door so that if any light in the house is on, it is lime, and if all lights in the house are off, it is navy. This way I can see when walking out the door if any lights have been left on in the house and then push the button to shut them off. I have come to the conclusion that kids are untrainable when it comes to shutting off lights ..I have a boolean variable that is set to True if any light is on, and false if all lights are off. A Macro is triggered any time a light state changes on any of the lights I want monitored. The macro first sets the variable to False, then checks the status of each light state after a short delay, and sets the variable back to True if it finds any light state ON. Whenever the variable changes, if the variable is True, the LED is set to Lime, and if it is False is set to Navy. The problem is I have to add the Macro trigger to each light so that when the light state changes the macro is triggered, and then I have to add a check of each light state to the Macro to set the variable correctly. This becomes a long string of programming when there are a lot of lights and I am wondering if there is a simpler way that anyone else has used. Another thought, does this type of long, string of if-then statements in a macro bog down the system? I don't want to introduce programming that will slow my controllers performance. I am running an 800 on 2.3.Any thoughts or should I leave this one alone?Interested in your boulean variable - I can see that any light going on should trip it on. HOWEVER - how do you know to trip it off when you turn off a specific light/I have solved your issue by simply have every light have a timer - motion turns the timer on again and when the timer expires then the light goes off.The other thing is that when I set the alarm, all lights that are left on go off as do fans etc.Bill Link to comment Share on other sites More sharing options...
sdigrego Posted March 16, 2013 Author Share Posted March 16, 2013 Thanks for the idea on the timer.As far as my boolean variable, currently; any light state change triggers the macro which in turn sets the variable based on the current lights ON vs. lights OFF state.Example;1. On every light I have this; {This executes a macro every time the light level of the lights I want monitored changes}When XYZ Bedroom ->Bedroom Lights level changes -Execute Macro 'Home Lights Status'2. Macro looks like this; {First the variable is set to false, then each monitored light is checked to see if a light is on, and if so it sets the variable back to true}When Home Lights Status is executed -delay 6 seconds {I have this delay because some of my lights ramp down over a 5 second period: I don't want the Macro to execute until the lights are completely on or off} -Variables->Lights Status = False -If Family Room->Fireplace Accent is on -Variables->Lights Status = True -If Family Room->Fireplace Cans is on -Variables->Lights Status = True -If North Bedroom->Bedroom Lights is on Variables->Lights Status = True{repeat this query for every light I want monitored}3. Boolean Variable; {every time this variable changes, it's value is checked and then the LED is set according to the value condition (TRUE or FALSE)}When the variable->Lights Status changes -delay 1 second -If Variables->Lights Status is True -Set LED: 3 current color to Lime on Mud Room->Mud Rm 3 Button -Stop -If Variables->Lights Status is False -Set LED: 3 current color to Navy on Mud Room->Mud Rm 3 Button Link to comment Share on other sites More sharing options...
RyanE Posted March 16, 2013 Share Posted March 16, 2013 I created a 'Light Usage Agent' that, among other things, does what you're asking.You'll have to have a dealer install it for you.Details here: http://untestedhacks.comRyanE Link to comment Share on other sites More sharing options...
sdigrego Posted March 16, 2013 Author Share Posted March 16, 2013 ^ Nice options on the driver, once I finish adding the rest of my switches I will have to try it. Thanks. Link to comment Share on other sites More sharing options...
turls Posted March 17, 2013 Share Posted March 17, 2013 I created a 'Light Usage Agent' that, among other things, does what you're asking.You'll have to have a dealer install it for you.Details here: http://untestedhacks.comRyanEI was wondering why that wasn't on your hacks page because I found reference to it when I went through the ENTIRE programming forum a couple weeks ago. Thanks for putting that out there. I didn't bother you about it because its just one of many things on my list...that will probably take 2 years to get through. Link to comment Share on other sites More sharing options...
RyanE Posted March 17, 2013 Share Posted March 17, 2013 Sorry.I probably have a few other things to put on there as well.RyanE Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.