Jump to content

Question About "Else" Statement


KHouse

Recommended Posts

Posted

In the program below, I have 2 sets of lights turn on at sunset and off and sunrise.

 

Program works fine.

 

However, do I need the else statement as below, or do I leave it blank? What is the else statement for? How does it run in this situation/program, and what would be a good example of having "else" actually do something? Trying to get a deeper understanding of "how" the programming "thinks".

 

 

If

From Sunset

To Sunrise (next day)

 

Then

Set 'Porch Lights' On

Set 'Foyer Hall' On

Send Notification to 'Peter Cell' content 'Lights Came On'

Send Notification to 'Peter Email' content 'Lights Came On'

 

Else

Set 'Porch Lights' Off

Set 'Foyer Hall' Off

Posted

KHouse

 

If the above did not answer the question(s) please post back. Understanding when a Then versus Else will execute is important to understand.

Posted
The Else clause is turning the lights Off. If those statements were not in the Else the lights would remain On. There is no automatic Off in Insteon.

 

With the If that is being used the Then Clause executes at the From time and the Else clause executes at the To time.

 

Assuming you are involved with insides of ISY software.

This may be too technical but...

are the "then" and "else" statements driven by events from a hardware device's job list (hardware timer or device ON/OFF event) or are they triggered by a continuous scan from an iterative real-time engine?

 

Edit: The added link to the Wiki just answered that question, after I started responding. :)

Is the speed of the iterations just as fast as they engine can go and has time, or based on a regular timed cyclic loop?

Posted

Ok, so the FROM is controlled by the THEN, and the TO is controlled by the ELSE. Got it.

 

To confirm my understanding, I ran a test program (below), by having 2 lights come on at 1:37 and having only 1 of them in the ELSE statement to turn off at 1:39. As stated, the 1 light in the ELSE statement turned off, and the other light that wasn't in the ELSE statement stayed on.

 

Great. Except...I received no notifications. :?: I ran this exact same program earlier today, except I changed the time, and removed 1 light from the ELSE. Changed nothing else, and this time I get not notifications (while before I received all 4 of the notifications. *Note: The fire alarm notifications aren't related to the lights, they're just in there to test the notifications).

 

Any ideas?

 

Thanks for the help btw!

 

If

From 1:37:00PM

To 1:39:00PM (same day)

 

Then

Set 'Foyer Hall' On

Set 'Porch Lights' On

Send Notification to 'Peter Cell' content 'Lights Came On'

Send Notification to 'Peter Email' content 'Lights Came On'

Send Notification to 'Peter Cell' content 'Fire Alarm - ON'

Send Notification to 'Peter Email' content 'Fire Alarm - ON'

 

Else

Set 'Foyer Hall' Off

Posted

Hit TEST on the notifications tab, and received a DNS error.

 

Earlier today I didn't get a notification, ran the test, got a DNS. Closed and restarted the ISY page. Ran a test program, got notifications, all good again this morning.

 

Now after running the test program above, I didn't get the notificaitons as stated. So I tested again from the notifications tab, and get the box pop up again that says DNS error.

 

I am NOT running a static IP. (I saw in another thread while reading on the DNS that that could be an issue).

 

Any ideas why randomly it's throwing the DNS?

 

Quick update:

 

To make matters easier to understand...closed down ISY page and restarted, logged in, everything looks good. Ran the same program above (changed the times), and I received 1 email that Fire Alarm is ON, and not the email about the Lights being on, nor texts for either. Super annoyed at this point. Should be straight forward.

Posted

Quick update:

 

To make matters easier to understand...closed down ISY page and restarted, logged in, everything looks good. Ran the same program above (changed the times), and I received 1 email that Fire Alarm is ON, and not the email about the Lights being on, nor texts for either. Super annoyed at this point. Should be straight forward.

 

What happens if the mail daemon reports back an email failure / undeliverable notice?

Posted

Quick update:

 

To make matters easier to understand...closed down ISY page and restarted, logged in, everything looks good. Ran the same program above (changed the times), and I received 1 email that Fire Alarm is ON, and not the email about the Lights being on, nor texts for either. Super annoyed at this point. Should be straight forward.

 

What happens if the mail daemon reports back an email failure / undeliverable notice?

 

I don't think it's undeliverable because I've gotten the emails/texts before. Also, it's not sending both emails or texts.

 

The pop-up error I get is:

 

No Network Connection

DHCP State=RENEW

 

Mail Server DNS

SMTP_ERRORS-mail.universal-devices.com

 

Just to try something, I unplugged my router, waited a bit, and plugged it back in. I get the same error.

Posted

Hello KHouse,

 

There seems to be DNS issues. If you have configured your ISY with a static IP address, may I humbly suggest:

1. Either set the DNS to 8.8.4.4 OR

2. Revert to using DHCP as it seems your router is not allowing for DNS relay

 

With kind regards,

Michel

Posted

Michel,

 

I am not running a static IP. Any idea what else I could try? Again, the notifications worked, and now do not.

 

Thanks for your help here and throughout the board btw!

 

 

 

 

Sent from my iPhone using Tapatalk

Posted

To update:

 

I "borrowed" that water leak sensor program that is very popular. I ran some tests on it, after that, for some reason, control variable 2 keeps running, and last few days I've gotten a notice at 9am of Problem With Leak Sensor, status 1 (which is Heartbeat OK). Other than I can't figure out why the it keeps running and emailing me this everyday....the important part now is that I got an email and text alert about that at 9am this morning.

 

So I just logged on and ran a TEST email from the configurations tab, and it went through no problem.

 

So...sometimes my email/text alerts work, and sometimes they do not....any ideas why that would be?

Posted
To update:

 

I "borrowed" that water leak sensor program that is very popular. I ran some tests on it, after that, for some reason, control variable 2 keeps running, and last few days I've gotten a notice at 9am of Problem With Leak Sensor, status 1 (which is Heartbeat OK). Other than I can't figure out why the it keeps running and emailing me this everyday....the important part now is that I got an email and text alert about that at 9am this morning.

 

So I just logged on and ran a TEST email from the configurations tab, and it went through no problem.

 

So...sometimes my email/text alerts work, and sometimes they do not....any ideas why that would be?

 

I posed a similar question in the Leak Sensor thread. After reading Michel's reply I am still not clear if this program IS supposed to send off two e-mails of the health, condition, state of the Leak Sensors.

 

I actually liked receiving two separate e-mail during the course of the day confirming the state of the leak sensor. :mrgreen: If this is not how its supposed to operate oh well. :P

 

Works for me this way!

 

Teken . . .

Posted

The pop-up error I get is:

 

No Network Connection

DHCP State=RENEW

 

Mail Server DNS

SMTP_ERRORS-mail.universal-devices.com

 

Just to try something, I unplugged my router, waited a bit, and plugged it back in. I get the same error.

 

I'm not familiar with the pop up error you are seeing, but it sure sounds like the ISY is having trouble maintaining a connection with the router. Have you tried a different cable, or a different port on the router?

 

Although if that were the case, I'd expect you'd be seeing issues communicating with the ISY's interface.

Posted

I'm not familiar with the pop up error you are seeing, but it sure sounds like the ISY is having trouble maintaining a connection with the router. Have you tried a different cable, or a different port on the router?

 

Although if that were the case, I'd expect you'd be seeing issues communicating with the ISY's interface.

You could try repetitively pinging the ISY from another computer on your LAN to se if the times change or are very long.

Guest
This topic is now closed to further replies.

×
×
  • Create New...