Jump to content

Time slips past sunrise


oatflake

Recommended Posts

Hi! I'm a new ISY-99i owner and I'm still learning to program the device!

 

In particular, I'm trying to find the most elegant way to do the following:

 

1. Monday-Fridays, I want a particular my "Couch Lights" to turn on at 6:20 am and then shut off 10 minutes after Sunrise.

 

2. 7 days a week I want the same lights to turn on 30 minutes before Sunset and stay on until 10:30 pm at night.

 

I've condition #2 down, that one is straight out of the example in the manual. #1 however, I'm unsure what to do about the case when during the summer, Sunrise is earlier than 6:20 am. How do I make sure this condition doesn't end up turning on my lights at 6:20 am and then leave them on all day because Sunrise already past?

 

If

(

On Mon, Tue, Wed, Thu, Fri

From 6:20:00AM

To Sunrise + 10 minutes (same day)

)

Or (

From Sunset - 30 minutes

To 10:30:00PM (same day)

)

 

Then

Set 'Couch Lights' On

 

Else

Set 'Couch Lights' Off

Link to comment

One approach is to use a variable that indicates Sunrise and use that variable in the first part of the If. Define a Program that sets an Integer variable to a value of 1 Sunrise. Add a check of the Integer variable not equal to 1 in the first part of the If. Define another Program to reset the variable to 0 at Sunset.

 

 

 

If

Time is Sunrise

 

Then

$IVar4 = 1

 

Else

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

 

 

If

(

On Mon, Tue, Wed, Thu, Fri

From 6:20:00AM

To Sunrise + 10 minutes (same day)

And $Ivar4 is not 1

)

 

 

If

Time is Sunset

 

Then

$IVar4 = 0

Link to comment

Interesting. I'm not using version 3 yet (should I be worried about running Beta software if I'm still a beginner?) so I'm wondering if this technique can be used with a separate program, IsBrightOutside:

 

If
       From    Sunrise + 10 minutes
       To      Sunset  - 25 minutes (same day)

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

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

 

Then the main program uses it like this:

 

If
       (
            On Mon, Tue, Wed, Thu, Fri
            From     6:20:00AM
            To      Sunrise + 10 minutes (same day)
        And Program 'IsBrightOutside' is False
       )
    Or (
            From    Sunset  - 30 minutes
            To      10:30:00PM (same day)
       )

Then
       Set 'Couch Lights' On

Else
       Set 'Couch Lights' Off

 

Is this the same thing?

Link to comment

Lee is on the mark.

 

I have a variable I call "Light.outside". It sets to 1 when the sun rises and 0 when the sun sets. So anything that you want to happen while the sun is up includes "if $light.outside is equal to 1" as one of the conditions.

 

so

 

If

$iLight.Outside is equal to 0

and

From 6:20am

To sunrise plus 30

 

Then

Set couch light on

 

Else

else set couch light off

 

One note, the light will get turned off at 6:20 if the variable is equal to 1 (or in other words, if 6:20 is after sunrise). You might not want that and if so you need to split the "off" part into another program.

 

Also please note, you need to use an integer variable. A state variable would trigger the program every time it changes and potentially run the program at unintended times or force an "else" to execute that you didn't want.

Link to comment

TJF1960

 

Single Program for variable control is a much better idea. Thanks.

 

oatflake

 

The V3 images are Betas so there is some exposure. The same thing can be accomplished using a Program True/False state as a binary switch rather than using a variable. There are many examples on the Wiki for using Programs as binary switches. That was the technique before variables coma along in V3.

Link to comment
Guest
This topic is now closed to further replies.

  • Recently Browsing

    • No registered users viewing this page.
  • Who's Online (See full list)

    • There are no registered users currently online
  • Forum Statistics

    • Total Topics
      37k
    • Total Posts
      371k
×
×
  • Create New...