Jump to content

Vacation Program Help...


jmed999

Recommended Posts

Posted (edited)

If the Home folder only works if home.away =0 then once in vacation mode (home.away = 1) the home folder stops working so the else commands in programs in the home folder will not be triggered.  This will cause issues but I'm sure there's a way around it.

 

 

Good point.  Just make a second variable for the folder

 

If

$s.Home.Away=0  (I assume the s means it is a state variable)

Then

Run else for all programs for being on vacation

wait 10 seconds

set folder variable = 0

Run then or if on all programs for being at home (you'll have to decide if the then or if statement is more appropriate depending on the program details)

Else

Run else for all programs for being at home

wait 10 seconds

set folder varialbe = 1

Run then/if on all programs for being on vacation

 

Be aware that it is possible that some more complex programs may need special treatment, especially if they are doing fancy stuff with the else clause.  But this sort of idea will work for the vast majority of typical programs where you use the "then" section to turn something on and the "else" section to turn something off.

 

Alternatively, you could use the above program to disable all of the vacation programs and enable the at home programs when at home, and then flip it around the other way while on vaction instead of using folders.  Disabling a program does not prevent a "run" command from actually running it.  Furthermore, using the disable/enable technique will allow you to organize your programs according to what they do instead of when they do it (vacation vs not on vacation) in the program folder tree.  It will cause you to have a long program above however since you will need to list every program out.

Edited by apostolakisl
Posted

ohhhh ok.  I think I understand.  Still a little confused but tonight I'll see if I can set this up and understand it.  Sorry this is just a little complicated for a non expert like me :)

 

The bad thing is I'm going on vacation Saturday and I really can't have these programs failing.  I won't have much time (if any) to test them.

Posted
Still a little confused but tonight I'll see if I can set this up and understand it.  Sorry this is just a little complicated for a non expert like me

 

It looks to me as if you have gotten good advice from others and several options to consider.

 

The only thing I care to add is to encourage thinking, just as you have been, about the details of WHAT you are trying to accomplish, rather than HOW, rather than jump jumping straight in with coding.  Continue to consider the boundary issues...what do you want to happen when you transition from home>>>vacation>>>home during those from/to times.  I find, often, that fully defining what you want to happen will result in the logic and coding taking care of itself, or at least pointing to an approach.

 

 I definitely like the idea of folders for home and away.  I also tend to like apostolaksl's approach, where one could do something like:

 

if home

then

run away programs (else path)

run home programs (if path)

else

run home programs (else path)

run away program (if path)

Posted

Couple thoughts: As has been noted by several people, if you use folder conditions, you need to plan how to pick up any running programs or devices that are on when the newly active folder takes over. This can be as simple as 'shut it all down and start over', but is more elegant when you take time to really think it through and create a graceful hand-off.

 

Can't agree enough with oberkc about planning before coding. I find it helps to use a pad of paper and a pen first, listing all the requirements out first, then structuring it into logical chunks that readily turn into programs and variables. Also his point about edge cases. Try to break your programs, then find ways to keep the bad stuff from happening. I find it's easy to write successful programs for 95% of what they will react to, but the remaining edge cases will consume vastly more of your time to get right.

 

And finally, if your vacation is coming up soon, you likely won't have time to implement any overly complex setup right now, nor chase down and squash any bugs that come up. Consider keeping it extremely simple for now, and planning an automated away state for your next vacation. No reason to create potential stress when you're supposed to be out enjoying yourself!

Posted

You can take advantage of creating a program with no condition. It won't run--ever--until instructed to do so from another program.

Posted

It doesn't disable the folder until after you run the else clause of the programs in the folder.

 

So the Home folder programs would run if s.home.away =0 and if 2nd variable = 0 and the Vacation folder programs would run if s.home.away = 1 and 2nd variable = 1?  The 2nd variable would also need to be a state variable, correct?

 

Wouldn't the program still run all the programs else commands in the vacation folder even if the folder's "if s.home.away =1" is not true?  If so why have the 2nd variable?

Posted

Another thing...I have lots of programs in the "Home" folder and a few in the "Vacation" Folder.  Anytime I add a program to either folder I would have to remember to add it to the 2nd program above that runs all the elses and thens, right?  I'm kinda afraid I'll forget this.  Thoughts?

Posted

Programming is like that. I have no solution for the memory problem B)

Posted (edited)

So the Home folder programs would run if s.home.away =0 and if 2nd variable = 0 and the Vacation folder programs would run if s.home.away = 1 and 2nd variable = 1?  The 2nd variable would also need to be a state variable, correct?

 

Wouldn't the program still run all the programs else commands in the vacation folder even if the folder's "if s.home.away =1" is not true?  If so why have the 2nd variable?

No and Yes

 

The home folder program is active when the second variable is 0.  The first variable is not a condition of the folder.  Although indirectly it is because the first variable is what triggers the program I wrote above which sets the second variable.

 

The second variable only triggers the folder change if it is a state variable.

Edited by apostolakisl
Posted (edited)

I'm confused now.  Why do I need a 2nd variable?


At this point for the program I have...

 

If
        $s.Home.Away is 0
 
Then
        Run Program 'Downstairs Thermostat' (Else Path)
        Run Program 'Upstairs Stat' (Else Path)
        Run Program 'Vaca Lights' (Else Path)
        Run Program 'Bedroom Rope Lights' (If)
        Run Program 'Foyer Chandilier' (If)
        Run Program 'Front Candles' (If)
        Run Program 'Road and Driveway Candles' (If)
        Run Program 'Under Cabinet Lights1' (If)
        Run Program 'Upstairs Thermostat' (If)
        Run Program 'Fri Evening' (If)
        Run Program 'Fri Morn' (If)
        Run Program 'Mon, Tues, Wed Evenings' (If)
        Run Program 'Mon, Tues, Wed Evenings2' (If)
        Run Program 'Mon, Tues, Wed Mornings' (If)
        Run Program 'Work Driveway Lights' (If)
        Run Program 'Mornings' (If)
        Run Program 'Night' (If)
 
Else
        Run Program 'Bedroom Rope Lights' (Else Path)
        Run Program 'Foyer Chandilier' (Else Path)
        Run Program 'Front Candles' (Else Path)
        Run Program 'Road and Driveway Candles' (Else Path)
        Run Program 'Under Cabinet Lights1' (Else Path)
        Run Program 'Under Cabinet Lights1' (Else Path)
        Run Program 'Upstairs Thermostat' (Else Path)
        Run Program 'Fri Evening' (Else Path)
        Run Program 'Fri Morn' (Else Path)
        Run Program 'Mon, Tues, Wed Evenings' (Else Path)
        Run Program 'Mon, Tues, Wed Evenings2' (Else Path)
        Run Program 'Mon, Tues, Wed Mornings' (Else Path)
        Run Program 'Work Driveway Lights' (Else Path)
        Run Program 'Mornings' (Else Path)
        Run Program 'Night' (Else Path)
        Run Program 'Downstairs Thermostat' (If)
        Run Program 'Upstairs Stat' (If)
        Run Program 'Vaca Lights' (If)
 
The Home folder has an if s.home.away = 0 condition and the Vacation folder has a s.home.away = 1 condition.
Edited by jmed999
Posted (edited)

 

I'm confused now.  Why do I need a 2nd variable?

 

Please see your own post #24

 

Your program above won't work.  Please see the program I wrote.

Edited by apostolakisl
Posted

Couple thoughts: As has been noted by several people, if you use folder conditions, you need to plan how to pick up any running programs or devices that are on when the newly active folder takes over. This can be as simple as 'shut it all down and start over', but is more elegant when you take time to really think it through and create a graceful hand-off.

 

In theory I agree.  But depending on how many programs you are dealing with it, there could be a lot of extra programs to accomplish this.

 

The easiest way I see to do this is to copy the if clause of all the programs that are port of your home/vacation routine, but leave blank then/else sections.  Run all those programs when the variable changes.  Then based on the true/false status comparison between the home vs vacation programs that act on the same devices, you only trigger the else/then clauses that need to be triggered to put all your devices in the current correct state.

Posted

Please see your own post #24

 

Your program above won't work.  Please see the program I wrote.

 

Yes I understand the 2nd variable is trying to solve the issue in post 24....but I don't understand why?  Why is the 2nd variable needed?  I keep asking this.

Posted

Thanks to all those who gave input to this thread and those that gave advice about thinking about how to write programs!

 

With that said, there doesn't seem to be a clear way of doing this...or at least I don't think we have come to a consensus.  To many issues still exist and the level of explaining doesn't meet my lack of understanding, which is my fault.  Since I'm going out of town tomorrow, I'm abandoning this project.

 

I'm going to write a program without a variable to run the lights at sunset and turn them off at 2am everyday.  I'll also make the s.home.away = 1 so the "Home" programs will not run while out of town.  When I return from vacation I will delete the program and change s.home.away = 0.  This should be a simple way to do what I want even though the overall issue will remain the next time I go out of town.

 

Thanks again!

Posted

Rarely is there consensus, because there are usall many ways of solving a given problem. Everybody has personal preferences (mine are to minimize numbers of programs and use variables only as last resort.)

 

Report back when you return and we can continue this discussion. There is a solution, so long that your requirements are fully understood.

Posted (edited)

Yes I understand the 2nd variable is trying to solve the issue in post 24....but I don't understand why?  Why is the 2nd variable needed?  I keep asking this.

Because the second variable turns the folder off AFTER you run the programs.

 

Please see my program.  It runs the programs, waits 10 seconds for good measure then turns the folder off.  Turning the one folder off also simultaneously turns the other folder on, so that the programs in that folder can run.

Edited by apostolakisl
Posted

In theory I agree. But depending on how many programs you are dealing with it, there could be a lot of extra programs to accomplish this.

 

The easiest way I see to do this is to copy the if clause of all the programs that are port of your home/vacation routine, but leave blank then/else sections. Run all those programs when the variable changes. Then based on the true/false status comparison between the home vs vacation programs that act on the same devices, you only trigger the else/then clauses that need to be triggered to put all your devices in the current correct state.

Also true. There are lots of ways to skin this cat, and I'm certainly no expert at any of it. It's just a way that's worked for me before.

Posted

Also true. There are lots of ways to skin this cat, and I'm certainly no expert at any of it. It's just a way that's worked for me before.

 

It really comes down to the details.  If you all have are programs like this

 

If

time is from a to b

Then

set light on

Else

set light off

 

Then the only thing you need to do is shut down the folder with the programs you are transitioning out of, turn on the folder you transition into, and run the if on those programs.  That would be a seamless transition..  

Posted

It really comes down to the details.  If you all have are programs like this

 

If

time is from a to b

Then

set light on

Else

set light off

 

Then the only thing you need to do is shut down the folder with the programs you are transitioning out of, turn on the folder you transition into, and run the if on those programs.  That would be a seamless transition..

 

that is the way I see it, as well

Guest
This topic is now closed to further replies.

×
×
  • Create New...