Jump to content

What am I doing wrong?


Cormacs

Recommended Posts

Posted (edited)

I have a super simple program that is driving me nuts. I have a bunch of lighting related programs that are based off of ambient light. Since I dont have a photocell I amd useing sunrise and sunset times. To simplify this process I made a variable called "Light", if the varible is 1 its dark out or 0 for daylight. I thought this would be simple but for some reason the program runs just fine at sunset and changes the variable to 1, but for some reason it instantly changes it back to 0. Can someone tell me what I'm doing wrong? Here is the program I have...

 

Outside Light - [iD 0008][Parent 0001]

If

From Sunrise

To Sunset (Same day)

 

Then

$Light = 0

 

Else

$Light = 1

Edited by Cormacs
Posted

What does the program status read.. true or false?  (right click on "My Programs" > Status Icons > Detailed)

 

I'm assuming the conditions are for (same day)

 

The only thing I see is that when naming variables it helps to develop a convention that designates State or Integer e.g., $sLight for State and $iLight for Integer.

 

 

 

Jon...

Posted

Right now it shows it as false because it is outside the time window.

 

 

Sent from my iPhone using Tapatalk

Sorry I guess I didn't copy that but yes the conditions are from sunrise to sunset same day

 

 

Sent from my iPhone using Tapatalk

Posted (edited)

The only way for this program to change the variable $Light = 0 is for the program to trigger while true and run the Then clause.  You need to adjust the time from sunset to something where you can watch it change to false (run Else or $Light = 1) and then observe if the program turns true or something else is changing it.

 

 

Jon...

Edited by jerlands
Posted

I can see nothing wrong programmatically.  I expect the variable to be 0 at sunrise to sunset, and 1 from sunset to sunrise.  It is not doing this?  Is it possible that you have other programs that are triggered by this variable and affecting the value? Next sunset, check to see what other programs run besides this one.  Perhaps one of those programs changed the value back to 0?

 

FYI, I find little need for this variable.  I would simply have a program:

 

if

from sunset to sunrise

then

nothing

else

nothing

 

Then, I would simply use program status (TRUE or FALSE) as a program condition to indicate light or darkness.

Posted

I agree the program is not required. I just find it a little simpler when making new programs to use a set value instead of a time.

 

 

Sent from my iPhone using Tapatalk

Posted

I agree the program is not required. I just find it a little simpler when making new programs to use a set value instead of a time.

 

 

Sent from my iPhone using Tapatalk

Yes. Having a common variable for inside darkness has it's advantages, including adjusting sunset for a darker or lighter house construction, tree leaves in the summer vs winter, etc,,

Posted

I was not suggesting elimination of the program. Instead I suggested elimination of the variable, using program status (true/false) in place of the variable (0, 1) as the program condition.

Posted

I don't get it. The program just ran at sunrise and did the opposite it set it to 0 like it should and right back to 1. I even tried a different way to test by having two programs one to set it to 1 at sunset and one to set it to 0 at sunrise. I get the same result. This doesn't make sense to me. It appears there is something flawed with the sunrise/sunset parameter. I'm running the beta operating system, could that have something to do with it?

 

 

Sent from my iPhone using Tapatalk

Posted (edited)

Cormacs

 

4.4.2 Beta or 5.x Beta?

 

I'm not seeing that problem on 4.4.2. 

 

Is that a State variable (as it should be) or Integer"

 

Did the search suggested by jerlands show any other Program changing $Light?

Edited by LeeG
Posted

It is indeed state variable. I don't see any programs that could possibly switching it back.

 

 

Sent from my iPhone using Tapatalk

Posted

It is indeed state variable. I don't see any programs that could possibly switching it back.

 

 

Sent from my iPhone using Tapatalk

 

How do you know the variable is changing back to 0?  Do you have other programs that are reacting to the change?

Also, do you happen to have an Integer variable named the same i.e., Light?

 

 

Jon...

Posted (edited)

There are no duplicates. Yes I have programs that react to the state change that's how I know it changes back. I have dog house lights that turn on when the value changes to 1 and when I checked during the day today they were on. At sunrise when the value goes 0 the lights turn off and that's how I know it changes at night all of the lights I had on outside mysteriously turn off at sunset.

 

 

Sent from my iPhone using Tapatalk

Edited by Cormacs
Posted

Plus I can see the scenes turn on and then back off in the log.

 

 

Sent from my iPhone using Tapatalk

Posted

Run Tools | Diagnostics | Event Viewer at LEVEL 3 before Sunrise.   Post the event trace after the Scenes run.

 

Also post the Programs that are issuing the Scene commands.

Posted

I will run the event viewer at sunrise to see what I get. Here is something else interesting. I changed the timing of the program from "sunrise to sunset" to a time value and watched it. With the time value it works just fine. It just doesn't work using the sunrise to sunset times.

 

 

Sent from my iPhone using Tapatalk

Posted

Do you have other programs that run at Sunrise/Sunset. If so, then you may want to offset the time a minute or two.

Posted

I'd be curious to know what time your admin console shows for your current Sunrise and Sunset (look at the top of the window).  You don't live near the North Pole, do you? :wink:

 

-Randy

Posted

 I changed the timing of the program from "sunrise to sunset" to a time value and watched it. With the time value it works just fine. It just doesn't work using the sunrise to sunset times.

 

 

I'm also running v5.0.2 and created a couple simple programs to see if if sunrise to sunset had any impact and for me it operated as I would expect.

New Program - [ID 00E9][Parent 00CC]

If
        From    Sunrise
        To      Sunset  (same day)
 
Then
        $s.Test  = 1
 
Else
        $s.Test  = 0
 


New Program_B - [ID 00EA][Parent 00CC]

If
        $s.Test is 0
 
Then
        Set 'Light Media Room' On
 
Else
        Set 'Light Media Room' Off

I'm still thinking you have some other program that's changing the variable "Light."  I'd bet if you were to change the variable name it would run properly also.  One of the reasons I think you have conflicting programs is your logic in assigning the variable.  In my way of thinking I see 1=true and 0=false and I'm guessing at sometime you created a different program assigning "Light" values using the same logic.

 

 

Jon...

Posted

I'm sorry guys. After banging my head off the computer screen for hours I decided to go through all 30 programs line by line to read exactly what they did. Little did I know I had a program called "wake-up lights" that's was doing the opposite. I over looked it because the name seemed unrelated. Sorry for wasting your time.

 

 

Sent from my iPhone using Tapatalk

Posted

I'm sorry guys. After banging my head off the computer screen for hours I decided to go through all 30 programs line by line to read exactly what they did. Little did I know I had a program called "wake-up lights" that's was doing the opposite. I over looked it because the name seemed unrelated. Sorry for wasting your time.

 

 

Sent from my iPhone using Tapatalk

Better your head than ours! :)

 

Glad to see you figured it out. We keep learning the hard way sometimes  but we remember better then.

Guest
This topic is now closed to further replies.

×
×
  • Create New...