Jump to content
C4 Forums | Control4

Programming in HE using an "IF" and "OR" commands?


C4 BEAR

Recommended Posts

post-125941-0-96092700-1440928957_thumb.

 

Hello all.

 

My dealer just added some motion detectors to my project and I can't seem to get them to work using the above programming. I would like the light to turn on if it is nighttime OR if it is within 20 minutes after sunrise. Anyone able to tell me what I am doing wrong?

 

Thank you ahead of time...

Link to comment
Share on other sites


Hm. What exactly isn't working? It isn't turning on at all, turning on regardless of time of day etc?

 

While what you have there isn't how I'd do it - it isn't wsrong either (assuming the timer is to shut the lights off?).

 

Try to remove all IF statements and ONLY have on sensing motion turn on light.

Link to comment
Share on other sites

Agree with Cy. Should work. Although, if the timer is to turn the lights off after, say, 5 minutes then it will turn lights off (should they happen to be on) during the day also as the timer is not inside an if statement.

For an IF / OR statement, I would suggest using a Boolean variable (I will call it trigger for this example) and do the following:

- Set trigger to FALSE

- if condition1 then set trigger to true

- if condition2 then set trigger to true

- if condition3 etc.

- if trigger then do what you want to do (turn the lights on, set the timer etc.)

There are probably better ways to do this, but this gives some versatility and can be adapted for AND (not just or). If you want ELSE then the easiest way is to add a STOP statement nested in the IF.

Link to comment
Share on other sites

As far as what is happening, it is not coming on at all. I know the sensors are in the project, because I can see them and I was able to program them. I am starting to wonder f there is something else I need to do to "turn them on" or something.

 

The timer I made is for 1 minute and is to turn off the light. I figured it would take me less than one minute to go up or down the stairs, and I placed a sensor at the top and bottom of the stairs. I have the same programming for each sensor.

 

I just didn't want the light to come on unless it was dark out, meaning either nighttime, or 20 minutes after sunrise.

Link to comment
Share on other sites

Try some debugging, as CY suggests - remove the if statements.

Walk past the motion sensor and see if the lights come on.

You need to find the root of the issue. It could be the sensors, the lights, or the programming...

 

Another option is if you have the myhome app on your iphone, view the sensor in the app and walk past the physical sensor - the sensor in the app will glow red when it senses motion. This will prove the motion sensor is connected to your system correctly.

Link to comment
Share on other sites

I just didn't want the light to come on unless it was dark out, meaning either nighttime, or 20 minutes after sunrise.

 

:D

As mentioned - the purpose of doing only the trigger is not for a permanent solution, but to check if the sensor is 'working' at all.

As per above post - I suspect the sensor was never tied to C4.

 

From there we can take it further.

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.