Jump to content

quick question on "Else" error


mzn50

Recommended Posts

First of all the best of the season..

 

Below is a rule where I have a switch at the door to set my away condition on a home..Im using a RL2

I would like to use this rule in two ways.. day time and if not daytime.. after sunset..

 

During daylight.. I would like some type of notification that it worked so I have it chirp ..so that works.. the problem is that the ELSE executes at every sunrise.. not when the RL2 is pushed.. is there a way to make the else work only if RL2 is pushed and its after sunset ?.. can we add a condition to an "ELSE"

 

If

Control 'Remote Entrance' is switched Off

And From Sunrise + 1 second

To Sunset - 46 minutes (same day)

 

Then

Set 'Condition' On

Set 'Foyer' 1 (Beep Duration)

Set 'Foyer' 1 (Beep Duration)

Set 'Foyer' 1 (Beep Duration)

Set 'Foyer' 1 (Beep Duration)

 

ElseThis should only work if RL2 is pushed.. instead.. it runs daily ..

Set 'Condition' On

Set Scene 'ALL LIGHTS and PLUGS - CONDIT' Fast Off

Wait 2 seconds

Set Scene 'Sunset OUT OF HOUSE' On

 

 

Thanks for the help.. Matt

Link to comment
This should only work if RL2 is pushed.. instead.. it runs daily ..

 

Keep in mind that this will run ANY time that the program condition is triggered and evaluated as "false". Your program will be triggered upon one of three conditions: sunset, sunrise, and reciept of an "off" command from the "remote entry".

 

At sunrise, the condition is triggered. There was no reciept of an "off" command, which meant that the condition was false>>>run "else". To me, this appears to be normal for ISY.

 

I assume you will have to break this into two programs. The first:

 

If
Control 'Remote Entrance' is switched Off
And From Sunrise + 1 second
To Sunset - 46 minutes (same day)

Then
Set 'Condition' On
Set 'Foyer' 1 (Beep Duration)
Set 'Foyer' 1 (Beep Duration)
Set 'Foyer' 1 (Beep Duration)
Set 'Foyer' 1 (Beep Duration)

else

the second:

 

If
Control 'Remote Entrance' is switched Off
And From Sunset-46 minutes
To sunrise + 1 second (next day)

Then
 Set 'Condition' On
Set Scene 'ALL LIGHTS and PLUGS - CONDIT' Fast Off
Wait 2 seconds
Set Scene 'Sunset OUT OF HOUSE' On

Link to comment
Thanks oberkc.. figured I would need to sets 2 scripts..

I have still to take advantage of an else command... somewhere.. was hoping this would be it !.

 

thanks very much.. will give this a shot..

 

Best !

 

Matt

 

The most common use of "else" command is as follows.

 

If

From x time

to y time

Then

set light on

Else

set light off

 

This program has 2 triggers, the from time, and the else time. At the "from" time, it runs true, at the "to" time it runs false. So the above program would be a simple timer turning the light on at time x and off at time y.

 

 

You can redo your above program as follows

 

If

From Sunrise + 1 second

To Sunset - 46 minutes (same day)

Then

Set Integer variable to 1

Else

Set Integer variable to 0

 

 

If

Control 'Remote Entrance' is switched Off

And Integer variable is 1

 

Then

Set 'Condition' On

Set 'Foyer' 1 (Beep Duration)

Set 'Foyer' 1 (Beep Duration)

Set 'Foyer' 1 (Beep Duration)

Set 'Foyer' 1 (Beep Duration)

 

Else

Set 'Condition' On

Set Scene 'ALL LIGHTS and PLUGS - CONDIT' Fast Off

Wait 2 seconds

Set Scene 'Sunset OUT OF HOUSE' On

 

 

This fixes the problem because an integer variable is not a trigger. So you don't get the extra triggers of the "from" and "to" times running false. This can be a nice solution if you have multiple programs running on that same time schedule since you can use that variable in all those programs.

 

And an additional solution would be to put your original program into a folder with conditions

Link to comment

Most of my programs fail to include an "else" set of program steps. I was going to use the from/to timer as an example, but apostolakisl beat me to it.

 

I like the variable approach for cases where you have multiple programs using a common condition, but probably prefer program folders for this.

 

If

from time x to time y

then run the programs in this foler

 

if from time y to time x

then run the programs in this folder

 

Either (variable or folder) will work fine, but specific individual needs may make one approach more benificial than another

Link to comment

While I think two programs is cleaner, it doesn't have to be that way... Since your THEN simply beeps, you could adjust your conditions to run the THEN part whenever the times trigger. It would look like this:

If
       (
            Control 'Remote Entrance' is switched Off
         Or From    Sunrise +  1 second
            To      Sunset  - 46 minutes (same day)
       )
    Or Time is Sunset  - 46 minutes
    Or Time is Sunrise +  1 second

Then
       Set 'Condition' On
       Set 'Foyer' 1 (Beep Duration)
       Set 'Foyer' 1 (Beep Duration)
       Set 'Foyer' 1 (Beep Duration)
       Set 'Foyer' 1 (Beep Duration)

Else
       Set 'Condition' On
       Set Scene 'ALL LIGHTS and PLUGS - CONDIT' Fast Off
       Wait  2 seconds
       Set Scene 'Sunset OUT OF HOUSE' On

The beep would happen at the sunrise/sunset times, but that's a small matter I assume.

 

Also, if you did want to split this into two, I think it'd be better to make one for the time and another for the remote to run it...

Program 'Entrance_Time' (DISABLED)

If
    From    Sunrise +  1 second
       To      Sunset  - 46 minutes (same day)

Then
       Set 'Condition' On
       Set 'Foyer' 1 (Beep Duration)
       Set 'Foyer' 1 (Beep Duration)
       Set 'Foyer' 1 (Beep Duration)
       Set 'Foyer' 1 (Beep Duration)

Else
       Set 'Condition' On
       Set Scene 'ALL LIGHTS and PLUGS - CONDIT' Fast Off
       Wait  2 seconds
       Set Scene 'Sunset OUT OF HOUSE' On

 

Program 'Entrance_Remote' (ENABLED)

If
    Control 'Remote Entrance' is switched Off

Then
    Run Program 'Entrance_Time' (If)

Else
    - No Actions - (To add one, press 'Action')

 

So the "Entrance_Remote" runs anytime the RemoteLinc is switched off. The Entrance_Time never runs automatically because it is not enabled. When the Entrance_Remote runs, it runs Entrance_Time (If) so the condition is evaluated and the appropriate action taken.

 

The advantage of this split is that the logic of what is happening is put into only one program. The schedules appear in only one program so they're easier to change. The triggering event (RL2 switched off) appears only once so is easily changed (or another trigger added).

Link to comment

Just fyi - Actually the beep was more of a confirmation during the day time that the rule executed properly..so I know it worked.. I entered if 4-5 times as I could not extend the length of the beep .. ISY offers different variables on beeps but it made no difference..???

 

The idea behind the rule is to set a on off switch at my door to allows me to set a condition to allow an "away" mode so that when not home.. Only certain lights would turn on at sunset., (front door, back door garage.. A light or 2 in the home...when I return home.. I disable the Condition . And normal sunset light turn on.. About 15 of them..

The condition is addressed to a light dimmer that is simply plugged in and used as a dummy ..

 

I went with the simpler 2 rule step as I understood it better for now.. Will venture in the ELSE rules when more comfortable ... :D

Link to comment
The beep would happen at the sunrise/sunset times, but that's a small matter I assume
.

 

Unfortunately, the beep at sunrise WAS a specifically identified problem

 

the problem is that the ELSE executes at every sunrise
..

 

The Beep is in the THEN...his problem, as you pointed out, was the ELSE running at sunrise/sunset.

Link to comment

Personally I like my program using the variable best and these are the reasons (you may disagree).

 

1) It keeps the logic in one program, only separating the time frame apart from the main logic.

2) It avoids disabled programs. I don't like disabled programs because sometimes you want to hit the "disable all" button to run scene tests. When done with that I like to hit "enable all". The more random disabled programs you have, the more you have to annotate and then re-disable after doing the "enable all". When you have as many programs as i do, that gets arduous and sometimes I miss some and then weird stuff happens.

3) It accomplished (I think) exactly what the original poster wanted.

 

However, I think oberkc's program and vyrolan's second program are darn near as good.

Link to comment

Archived

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


×
×
  • Create New...