Jump to content
C4 Forums | Control4

programming with if/then


Recommended Posts

I'm still not 100% clear on how to use if / then programming, and if I'm nesting things properly. Could some check to make sure that I've done this properly? Using the homebridge driver and the Home app, my iPhone flips a virtual switch in C4 so that it can track when my wife and I are home or away. Both of us are very bad at setting the alarm when we leave. So what I want to happen is that anytime I leave home, if my wife is not home, it will arm the alarm and turn off everything in the house (if she's home, it doesn't do anything). When I come home, it will automatically disarm the alarm. The way I've got it set up now makes sense to me, but not sure if I need to insert any stop's in there, if there is another way that would make more sense, or if this looks okay. I already know that the variables, macros, etc. are working properly, just don't know about the order and nesting of things. Thanks!

 

Screen Shot 2018-04-05 at 7.18.44 PM.jpg

 

Link to comment
Share on other sites


The nesting looks fine and I would expect all of this to work.  A few comments for completeness:

1. I would have used an else (only available in recent OSs) or a Nested STOP at the end of the first If statement (but not really needed).

2. I would have checked if the security system was armed before disarming it (but you may do this in the macro anyway?).

I’m not sure that using geo fencing to disarm the security system is wise... but that’s just me.

Link to comment
Share on other sites

You shouldn't DISARM a system programmatically...uness the driver supports a method that is at least hiding the security code. Even then I'm not a big fan at all...

 

Beyond that the nesting in essence is fine - whether the virtual switch trigger happens properly would be the main determination on if this works or not.

Link to comment
Share on other sites

I may remove the disarming based on above recommendations.

Is there a way I could have done the nesting better? Where exactly would the “else” go, and how would that function?

 

The geofencing is through the iPhone using the home app, and it actually works great. I’ve been using it to trigger an entry light when I get home at night and it hasn’t missed yet. I used to have IFTTT and the geofencing was not nearly as reliable.

 

Sent from my iPhone using Tapatalk

 

Link to comment
Share on other sites

Dumb question that I think there’s no good answer to, yet I ask in hopes of someone being smarter than I am...

I’d love to set up some geofencing stuff, but I’m stuck on one thing... what happens when my wife and I are in the car together. How to sort out which macros should be run to personalize arrival, when two people arrive together?


Sent from my iPhone using Tapatalk

Link to comment
Share on other sites

1 minute ago, livitup said:

Dumb question that I think there’s no good answer to, yet I ask in hopes of someone being smarter than I am...

I’d love to set up some geofencing stuff, but I’m stuck on one thing... what happens when my wife and I are in the car together. How to sort out which macros should be run to personalize arrival, when two people arrive together?


Sent from my iPhone using Tapatalk

Wife takes priority. Consequences follow if you don't consider that rule as top priority

Link to comment
Share on other sites

13 hours ago, livitup said:

Dumb question that I think there’s no good answer to, yet I ask in hopes of someone being smarter than I am...

I’d love to set up some geofencing stuff, but I’m stuck on one thing... what happens when my wife and I are in the car together. How to sort out which macros should be run to personalize arrival, when two people arrive together?


Sent from my iPhone using Tapatalk

Best if you can prioritze it within the geo fencing, but in general - set a variable when wife geofencing is triggered, and ignore the husband macro based on that vrialbe

 

ie IF wife is home is true -- stop

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.