Jump to content
C4 Forums | Control4

Basic question about the ELSE command in Composer HE v3.3.0


byronomo

Recommended Posts

I am not very experienced, so I'm guessing this question is incredibly basic (if not stupid).

What is the difference between the two following approaches:

  1.  When.........turns off

    If XXXX is True AND YYYY is True AND ZZZZ is True
      -->Turn on LIGHT A
    Else
      -->Stop
  2. When........turns off

    If XXXX is True AND YYYY is True AND ZZZZ is True
      -->Turn on LIGHT A

 

Is there any functional or technical difference between these two if you are only looking to initiate an action if ALL of the conditional statements are true?

Thanks in advance.

Link to comment
Share on other sites


Your stop command is completely redundant in your scenario to begin with.

ELSE is used more in the sense of 'if not do this instead'

 

IF light is on
	Turn light off
ELSE
	turn light on

This is an extremely basic example of course.

 

ELSE is relatively new to Control4 as a command, and was put in to replace messy lines of IF statements.

To take the above exmaple

IF light is on
	Turn off light
IF light is off
	Turn on light

does the same thing.

So does:

If light is on
	Turn light off
	stop
Turn light on

Again in the above examples, being as simple as they are, there's no advantage, really, in one method or another. But when you get into much more complex options it becomes a lot cleaner to use

 

WHEN front yard motion senses motion
IF time is night time
	IF security is armed to away
		turn on front hallway light
		turn on garage lights
		send push notification notify someone's at the house
	ELSE
		IF security is armed to stay
		send push notification alert someone's approaching
		activate scene light alert low
	
ELSE
	IF door is unlocked
		send push notification notify someone's here to visit
Turn on porch light

Here three sets of things could happen depending on various IF statements, and one thing always happens (porch lights turn on)

Link to comment
Share on other sites

3 hours ago, Cyknight said:

Your stop command is completely redundant in your scenario to begin with.

ELSE is used more in the sense of 'if not do this instead'

 

Thanks....I was able to follow/understand 98% of your response.  Incredibly helpful!
The one thing that I wanted to clarify in my example:   Is it the "stop" command ONLY that is redundant or the "Else" AND the "Stop" command in my example.

In other words, is my example #2 the functional equivalent of example #1?

 

 

Link to comment
Share on other sites

2 hours ago, byronomo said:

Thanks....I was able to follow/understand 98% of your response.  Incredibly helpful!
The one thing that I wanted to clarify in my example:   Is it the "stop" command ONLY that is redundant or the "Else" AND the "Stop" command in my example.

In other words, is my example #2 the functional equivalent of example #1?

 

 

In your original post, both the ELSE and stop statements are redundant, and yes both your examples would accomplish the same thing.

In your example, ELSE isn't needed simply because there IS no other programming that you want to execute "if not the case"

STOP is only needed to, and functions as, a hard stop - meaning once the systems reads STOP it will stop and not 'read' any further. See the third example I posted about three methods of accomplishing the same thing (toggle a light) Without the stop in there, it would turn the light off if was on ... and proceed to keep 'reading' the lines and turn it right back on.

 

 

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

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