Jump to content

Program for late work night needed.


EricK

Recommended Posts

Sometimes I have to work late and come home to a dark driveway. On days when I think I am going to be late I want to be able to turn on a kpl button to keep the landscape lights on until I come home. I'm having trouble formulating the programming for this. I currently have the landscape lights set for the following program:

If

From Sunset - 10 minutes

To 11:58:00PM (same day)

 

Then

Set 'Outside / Landscape Lights' On

 

Else

Set 'Outside / Landscape Lights' Off

 

I think I need to add this condition so if the kpl button is off the program will run as usual. If it on the program will be false and not run:

If

From Sunset - 10 minutes

To 11:58:00PM (same day)

And Status 'Hall and Foyer / Hallway KPL8 - A - Hallway / Hallway KPL8 - F - Work' is Off

 

Then

Set 'Outside / Landscape Lights' On

 

Else

Set 'Outside / Landscape Lights' Off

 

However, if the kpl button is on then I want this "Landscape Work" program to occur:

If

From Sunset - 10 minutes

To Sunrise - 1 hour (next day)

And Status 'Hall and Foyer / Hallway KPL8 - A - Hallway / Hallway KPL8 - F - Work' is not Off

 

Then

Set 'Outside / Landscape Lights' On

 

Else

Set 'Outside / Landscape Lights' Off

 

 

What if I come home at 1am then I will want to turn off the kpl button and have the landscape lights turn off. I chose to use this program, (I just created a scene for the lights even though there is only one device just in case I want to add something else to them). If I turn the work KPL off, then the lights will go off. The "Landscape Work" program will then be false.

If

Control 'Hall and Foyer / Hallway KPL8 - A - Hallway / Hallway KPL8 - F - Work' is switched Off

 

Then

Set Scene 'Outside / Landscape Lights' Off

 

Else

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

 

Is this the best way to do this? Maybe I should just leave the lights on until the morning every day, but what fun would that be.

Thanks,

Eric

Link to comment
Is this the best way to do this?

 

I would probably do it different, but based on concerns that you may not have. For example, is it possible that you don't know whether you are going to be late until after sunset-10? What happens to your programs if you toggle the KPL button ON after the lights are already on (it seems to me that you have some potential issues here)? What do you want to happen to the landscape lights if you toggle ON the KPL button after 1158 pm, but before sunrise (I did not address this concern, but you may want to)?

 

Instead, I would probably allocate things a little differently. First, you always want the lights to come on, regardless of button correct? Start with this:

 

if
time is sunset-10 minutes
and control KPL button is not switched off
then
turn on landscape lights
else
turn off landscape lights

 

The program above will always turn the lights on at sunset-10 (regardless of KPL status) and will always turn them off when the KPL is toggled off

 

These next two programs will automatically turn them off at specific times, based on the status of the KPL button:

 

if
time is 1158pm 
and status KPL is off
then
turn off landscape lights

 

if
time is sunrise - 1 hour
and status KPL button is on
then
turn off landscape lights

 

Hopefully, there are some ideas you can play around with.

Link to comment

oberkc, thanks for helping me with this. You did bring up a good point, Sometimes I have to go at after midnight and want the lights on. With your first program if the KPL button is off will the lights turn on?

Code:

if

time is sunset-10 minutes

and control KPL button is not switched off

then

turn on landscape lights

else

turn off landscape lights

 

Unfortunately, I woke up in the middle of the night and stayed awake for a while thinking about these programs. How does this look.

 

First program, always turn on the lights.

if time is sunset-10 minutes

then Set scene 'Outside / Landscape Lights' On

 

Second program to keep the lights on from MN to Sunrise-1 hour only if the work kpl is on. If I go out at 1230AM and hit the KPL button (which does not directly turn on the lights, although that is an option), the program should be true and turn the lights on.

if time is MN to Sunrise-1 hour

And Status 'Hall and Foyer / Hallway KPL8 - A - Hallway / Hallway KPL8 - F - Work' is on

then Set scene 'Outside / Landscape Lights' On

else Set scene 'Outside / Landscape Lights' Off

 

Third program to always keep the lights off from Sunrise to Sunset. I don't think I need this but it is a back up. The landscape lights and moon lights are both plugged into the same appliance linc. If we ever have to work on the lights (next time a light is run over) then I have to plug both timer boxes directly into the wall

From sunrise

To Sunset-5 minutes (same day)

Set Scene 'Outside / Landscape Lights' Off

 

Have a great weekend.

Eric

Link to comment
oberkc, thanks for helping me with this. You did bring up a good point, Sometimes I have to go at after midnight and want the lights on. With your first program if the KPL button is off will the lights turn on?

 

No, I did not include this provision to manually turn landscape lights on. If you want that, you could modify the first program such as:

 

if
time is sunset-10 minutes
and control KPL button is not switched off
or
control KPL button is switch on
then
turn on landscape lights
else
turn off landscape lights

 

First program, always turn on the lights.

if time is sunset-10 minutes

then Set scene 'Outside / Landscape Lights' On

Simple enough. I see no problems here.

 

Second program to keep the lights on from MN to Sunrise-1 hour only if the work kpl is on. If I go out at 1230AM and hit the KPL button (which does not directly turn on the lights, although that is an option), the program should be true and turn the lights on.

if time is MN to Sunrise-1 hour

And Status 'Hall and Foyer / Hallway KPL8 - A - Hallway / Hallway KPL8 - F - Work' is on

then Set scene 'Outside / Landscape Lights' On

else Set scene 'Outside / Landscape Lights' Off

 

If all you want to do is "keep" the lights on at midnight, then you have a little duplication. There is no need to turn on lights that are already on. But I think you may have devised a way to address all your concerns in two programs rather than my three programs. Nice!

 

As I see it, this program would trigger at three distinct events: at midnight, at sunrise-1hour, and any change in status of the KPL button. At midnight, if the KPL button is off, the lights turn off. At midnight, if the KPL button is on, the lights stay (or turn) on. At sunrise-1hour, the lights will turn off regardless of the KPL status.

 

Additionally, between the time of midnight and sunrise-1hour, the KPL button will toggle on/off the landscape lights.

 

The only question I have for you is whether you want anything to happen to the landscape lights when you toggle the KPL at times other than between midnight and sunrise-1hour?

 

Third program to always keep the lights off from Sunrise to Sunset. I don't think I need this but it is a back up. The landscape lights and moon lights are both plugged into the same appliance linc. If we ever have to work on the lights (next time a light is run over) then I have to plug both timer boxes directly into the wall

From sunrise

To Sunset-5 minutes (same day)

Set Scene 'Outside / Landscape Lights'

 

I don't think you need this, and it will not "keep the lights off from sunrise to sunset". Such a program runs at two times only: the FROM time, and the TO time. The only thing this program will do is turn them off at sunrise.

Link to comment

The main problem you are going to have is the line that includes the STATUS of the KPL button. Every time the status of that button changes, it will TRIGGER both of those programs. This will at times cause the "else" to run when you didn't want it.

 

I assume you want to use the KPL as a flag, not as a trigger. A simple solution to this would be to use an integer variable. Integer variables are never triggers, they are checked when the program runs for other reasons but do not cause a program to run.

 

If

time is from sunset to 1am next day

And

$i.worklate = 1

Then

set light on

Else

set light off

 

If

time is from sunset to to 11:58

And

$i.worklate = 0

Then

set light on

Else

set light off

 

If

Status KPL button is on

Then

Set $i.worklate = 1

Else

Set $i.worklate = 0

 

 

The details can be changed. But the point here is that the act of pushing the KPL button does not run the programs that turn the light on/off when you use the variable. Otherwise, all of the programs will run and you will always have each one end up executing a then or else clause and you will get unintended outcomes.

Link to comment

Erick,

 

upon reflection of apostolakisl's comments, I believe he found a problem with your second program that I did not catch. If you were to toggle your KPL button before midnight, it would turn off the landscape lights.

 

I suspect you would find this less than desirable.

Link to comment

Well, I did not think I was ready for the variable class, but I guess I'll have to start studying. I now understand that in the second program that if I toggle on the button, which I do only want to use as an indicator, outside of the the time range that the program will be false and turn off the lights.

I'll see what I can do with this over the weekend. Definitely not a necessity, but fun to do.

Thanks,

Eric

Link to comment
which I do only want to use as an indicator

 

Yes, you got it. Integer variables work perfectly as indicators. Status, unfortunately, does not, especially when you have a program which uses the else clause.

 

Variables are easy. There are other ways to do this besides variables, but I think in this case it will be at least as easy as any other method and probably more directly understandable.

 

A couple tips.

1) No spaces in the name of a variable

2) Don't forget to hit the "save" button

Link to comment

This can be done without variables if you would rather avoid it for now. I agree it best not to try to run before being able to walk. As a reminder, i offered you a proposed solution should you care to try it.

 

I agree with one point about variables, however...they can help make it easier to visualize what is happening. Just remember, your KPL button is more than an indicator. You have also expressed interest in using this button to turn on and off your lights.

 

Another observation I have is that it seems you may be trying to hit a moving target. I am a fan of working through your requirements...understaning what you want....before going too deep into a solution.

Link to comment
Guys, this is great help. Sorry about the moving target. I do not want the kpl to directly control the lights. However, I do want the lights to turn off if I were to come home at 2am and turn off the work kpl.

Eric

 

In that situation you would want to use a program that states

 

If

control kpl is switched off

Then

set light off

Else

- - -

 

You could add time limits in there as well if you only wanted this to happen at certain times. You can not set the KPL as a scene controller since that would cause the light to turn on whenever you turned the KPL on. There are ways around that, like setting the scene on level to 0, but that also cause the light to turn off every time you turned the KPL on or off.

Link to comment

I am not sure if drinking and programming mix well, but this is what I cam up with last night. I did not find a good wiki yet on the proper syntax for variables but will keep reading about them.

Program one, turn lights on at Sunset:

If

Time is Sunset - 11 minutes

 

Then

Set Scene 'Outside / Landscape Lights' On

 

Else

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

 

 

Program Two, turn lights off at midnight if the work kpl is off:

If

Time is 11:59:00PM

And Status 'Hall and Foyer / Hallway KPL8 - A - Hallway / Hallway KPL8 - F - Work' is Off

 

Then

Set Scene 'Outside / Landscape Lights' Off

 

Else

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

 

 

Program 3, lights off at sunrise-1 hour always.

If

Time is Sunrise - 1 hour

 

Then

Set Scene 'Outside / Landscape Lights' Off

 

Else

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

 

Programs 4 and 5 enable the button to turn the lights on and off.

Program 4, turns lights on from midnight to sunset-1 hour if the kpl is on. This should work even if I turn the kpl on at 7AM. Once it is midnight and the button is on the program will be true. I left a short gap between program 2 and 4, but do not see a situation where the lights would go off then on.

If

From 12:00:00AM

To Sunset - 1 hour (same day)

And Control 'Hall and Foyer / Hallway KPL8 - A - Hallway / Hallway KPL8 - F - Work' is switched On

 

Then

Set Scene 'Outside / Landscape Lights' On

 

Else

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

 

Program 5 turns the light off only between MN and sunrise-1hr, so if I come home at 2am and turn off the work kpl, lights off. If I come home at 10pm and turn off the kpl, then by program 2 the lights should turn off at 1159. I think I can combine programs one and 3. I will also need another program to turn off the kpl button in case I forget to.

Let me know what you think.

Eric

Link to comment

EDIT: I noticed a simple "mistake" that lets me take it all down to 2 programs (intead of 3)

 

What you have done works but adds extra programs and makes it a little harder to organize/edit

 

Variable syntax is just what I wrote above, except the word "set" isn't actually there. It is all in the drop down menu in the programming page under the details tab.

 

You can do it all in 2 programs with no time gaps as follows. No need for any variables or anything fancy except parentheses in the one program.

 

Program KPL working late

If 
status KPL working late is off
and
time is 11:59pm
Then
set lights off
Else
- - -

 

Program working late/default on off

If 

time is from sunset-11 minutes       ****this clause is the basic on/off at the 2 times
to sunrise - 1 hour

OR     *** this clause turns the light on during those hours if you switch the kpl on, notice use of parenthesis

(time is from sunset - 11 minutes
to sunrise - 1 hour
and 
control KPL working late is switched on)

AND   **** this clause will always run the else (and turn the light off) when kpl is turned off, no matter what time it is

control KPL working late is not switched off

Then
set lights on
Else
set lights off

 

 

The only "weird" thing this set of programs would do is: if you turned the KPL on, and the outside lights were on, and it was not inside those time constraints, the outside lights would turn off. If I understand how you are using these lights, I don't think this is going to be an issue.

Link to comment

I'll have to study your program a bit more to figure out all of the parentheses. The lights should not be on outside of the sunset to sunrise time, so hitting the KPL button outside of those times should not be a problem.

I am completely lost on the variable issue. I do not know what to enter on this screen, or how to attach the kpl to the variable name. There is nothing in the users guide, and the wiki doesn't start with the basics. I am looking thru the variable threads. If you have a suggestion for a place to about learn variables from the beginning (entry level step by step) I would appreciate it.Thanks.

Eric

post-5422-140474162198_thumb.jpg

Link to comment

Erick,

 

You are done. That is all you do. Now when you write programs you will use the drop down menu to pick variable, then the next drop down menu over picks which variable. Since you only have 1 so far, it won't be a long list. :lol:

 

Just a quick helpful hint.

 

I suggest naming your variables that are integer with an "i" and the state ones with an "s". So you will know right away what it is when it shows up on the drop down since all variables, integer and state, show up in the same drop down menu.

 

 

IE $i.work.late

 

Integer variables do not act as triggers. In other words, they will not cause a program to run when they change, they will only be checked when the program runs for some other reason.

 

State variables will act as triggers. So if its value changes for any reason, any program that has it referenced in the "if" section will be triggered.

 

 

Check out this video:

 

 

And this wiki page

 

http://wiki.universal-devices.com/index ... le_Details

 

 

RE: parenthesis

 

You will see that there are 2 conditions connected together inside of those parenthesis. The parenthesis simply puts those 2 things together as a single entity when they are compared to the other conditions.

 

for example:

 

(a and B) or c

 

is not the same as

 

a and (b or c)

Link to comment

Here are my the two programs just as you described. Sorry for not pasting properly previously (say that three times fast) with code. I'll let you know as soon as I have an opportunity to see if it works, ideally I'll be sleeping during those times.

If
       Status  'Hall and Foyer / Hallway KPL8 - A - Hallway / Hallway KPL8 - F - Work' is Off
   And Time is 11:59:00PM

Then
       Set Scene 'Outside / Landscape Lights' Off

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

And the second:

If
       From    Sunset  -  2 minutes
       To      Sunrise -  1 hour  (next day)
    Or (
            From    Sunset  -  2 minutes
            To      Sunrise -  1 hour  (next day)
        And Control 'Hall and Foyer / Hallway KPL8 - A - Hallway / Hallway KPL8 - F - Work' is switched On
       )
   And Control 'Hall and Foyer / Hallway KPL8 - A - Hallway / Hallway KPL8 - F - Work' is not switched Off

Then
       Set Scene 'Outside / Landscape Lights' On

Else
       Set Scene 'Outside / Landscape Lights' Off

 

I watched the video for the variables and now have a good basic understanding. Ill have to change the value to zero. Create a program if work kpl status/control is on, set value =1. Second program if off set value =0. Then use the programming as you described.

I was thinking about using variables for my 30 minute shower fan timer. The problem can be that if the fan is already on and someone gets in, the fan may turn off on them. Same thing with the light. However, both devices are controlled by kpl buttons, with the switchlincs in the attic above. So there would be no way to click on to add to the timer. Now I have it set up where I can turn the fan or light off and the timer program stops. Then turn the device back on to re-initiate the timer.

Thank you for the great help.

Eric

Link to comment

Your programs look exactly as I had suggested. Hopefully I didn't flub it up!

 

It is very easy to have the fan timer reset by clicking the KPL button again.

 

You can set the KPL button to always send an "on" command, and the on command can reset the timer. Of course this will mean you can't shut the fan off manually if you want. You can also utilize the "fast on" function to create an alternate outcome.

Link to comment

I do want to be able to turn the fan off manually, especially in the morning when I leave for work early. I don't want the noise to wake up my wife when I open the door. I can get out of the bathroom thru our sitting room but have to open the door to the bedroom so our 15 year old geriatric chihuahua can get into the bathroom to a wee wee pad. If there is a program to keep her from missing it let me know.

Eric

Link to comment
I do want to be able to turn the fan off manually, especially in the morning when I leave for work early. I don't want the noise to wake up my wife when I open the door. I can get out of the bathroom thru our sitting room but have to open the door to the bedroom so our 15 year old geriatric chihuahua can get into the bathroom to a wee wee pad. If there is a program to keep her from missing it let me know.

Eric

 

You can use "fast on" and "on" to control it. Set the KPL as a "non-toggle on" only by going to the KPL in the main tab and clicking on the KPL master on the left tree. Then in the right pane at the bottom it will have a button to click "toggle mode". Set the button you want to control the fan as non-toggle on.

 

Create a scene and put the KPL button and fan switchlinc into the scene with the KPL button as a controller. Now turning the KPl button on turns the fan on without a program. You can make the switchlinc a controller also but if it is in the attic I am guessing that means you will never actually touch it so it won't make any difference.

 

Program turn fan off after 15 minutes

If

control kpl is switched on

Then

wait 15 minutes

set fan scene off

Else

. . .

 

This is the normal program that shuts the fan off and KPL light off after a routine turning of the fan on by pushing the KPL. If you hit the KPL button while the fan is already running, the KPL light stays on and the program starts the 15 minutes over.

 

Program turn fan off immediately

If

control kpl is switched fast on

Then

set fan scene off

 

This will let you double click the KPL button when it and the fan are already on and it will turn the fan and KPL off.

Link to comment

I do something very similar to this with my fanlinc's. I have one KPL or RL2 button that cycles through low, med, high and off with each press. A FastOn will always turn the fan off.

 

-Xathros

Link to comment

Hello,

I am going to hold off on doing anything with the shower devices for now.

When I came home last night after sunset and the work late kpl button was off my landscape lights were not on. I had created a scene for them, (only the appliance linc that they are plugged in to is a memeber). Not sure if this was from my programming or other problem. Before we created these new work programs I used a simple on/off program with the action to turn on/off the appliance linc directly, not a scene. This weekend I'll rework the programs to just include the device rather than the scene.

I did start having some communication problems a few weeks ago, including flickering of my breakfast lights when they were at 70% with insteon traffic or when some electrical devices such as the refrigerator or AC kicked on. Now things things seem better, but maybe I am biased since just after the problem started I began to migrate to the ISY. However, I tried to use my outlet tracer this weekend and found out that I am getting a strong signal (not generated by my tracer) on one circuit, the outlets in my son's room. I unplugged his baby camera, but that did not resolve things. Otherwise he just has an alarm clock plugged in. Interesting, when I turned off that breaker, the signal moved to another breaker, and I was not able to trace from the tone generator. I may try to work back around the house to see if I can ID the source of the noise.

Thanks,

Eric.

THis is the outlet tracer I have, plus a socket and outlet adapter to trace from a fixture:

images?q=tbn:ANd9GcRBh9M1h5fyWGuXQ5VjHRdMDsMryq2oBYQzBZKEVYjQmF0XQJC-fg

Link to comment

And the second:

If
       From    Sunset  -  2 minutes
       To      Sunrise -  1 hour  (next day)
    Or (
            From    Sunset  -  2 minutes
            To      Sunrise -  1 hour  (next day)
        And Control 'Hall and Foyer / Hallway KPL8 - A - Hallway / Hallway KPL8 - F - Work' is switched On
       )
   And Control 'Hall and Foyer / Hallway KPL8 - A - Hallway / Hallway KPL8 - F - Work' is not switched Off

Then
       Set Scene 'Outside / Landscape Lights' On

Else
       Set Scene 'Outside / Landscape Lights' Off

 

I think there is a problem with this program. It was sunset-2 minutes. And the KPL button was not 'not switched off'. (Edit: it was OFF). So the prgram was false, so it went to the else.

Eric

Edit: typo on my part, the kpl was off.

Link to comment

Archived

This topic is now archived and is 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
      36.9k
    • Total Posts
      370.3k
×
×
  • Create New...