Active TopicsActive Topics  Display List of Forum MembersMemberlist  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin
PowerHome Programming
 PowerHome Messageboard : PowerHome Programming
Subject Topic: Macro with Wait doesn’t work Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
I_am_entangled
Newbie
Newbie
Avatar

Joined: October 27 2010
Location: United States
Online Status: Offline
Posts: 13
Posted: October 28 2010 at 22:56 | IP Logged Quote I_am_entangled

I'm very new to PH2.

I created a Macro with a number of commands separated by Wait commands. According to the manual, this shouldn't interfere with other events that need execution during the Macro wait period. But this didn't work. A timed event came during one wait period and the Macro was terminated without completing the rest of the commands. I know about timedevents (but haven't tried them) but I thought this was supposed to work. Some clarification please?


__________________
I can't come to grips with a non-local universe let alone the way I thought it was.
Back to Top View I_am_entangled's Profile Search for other posts by I_am_entangled
 
BeachBum
Super User
Super User
Avatar

Joined: April 11 2007
Location: United States
Online Status: Offline
Posts: 1880
Posted: October 28 2010 at 23:38 | IP Logged Quote BeachBum

I don’t use Waits because of what you described. I only use Waits to delay an execution of that macro. My experience is a wait will make the macro wait but it will not allow others to jump in if that makes sense. So in essence it is serial. If you could be a little more specific with what you are trying to accomplish maybe one of us could help.

__________________
Pete - X10 Oldie
Back to Top View BeachBum's Profile Search for other posts by BeachBum
 
I_am_entangled
Newbie
Newbie
Avatar

Joined: October 27 2010
Location: United States
Online Status: Offline
Posts: 13
Posted: October 29 2010 at 10:15 | IP Logged Quote I_am_entangled

Thanks for the reply.
Again - according to the manual, a Wait with a time of, say 600 seconds in the Send Keys area, should suspend the Macro and create a timer that will come back into the Macro and continue. But it is not supposed to prevent other commands from being executed.

What I'm trying to do is a simple irrigation sequence. Start one sprinkler, wait for 10 minutes, stop it and start another, wait again and so on.

Obviously life is not so simple, and I am VERY new to this.

Thanks again for any help.

__________________
I can't come to grips with a non-local universe let alone the way I thought it was.
Back to Top View I_am_entangled's Profile Search for other posts by I_am_entangled
 
dhoward
Admin Group
Admin Group
Avatar

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4447
Posted: October 29 2010 at 10:58 | IP Logged Quote dhoward

A WAIT command should not prevent other events from occurring. A DELAY will hold the queue however. I have a very similar macro that I use for my irrigation and it uses the WAIT command.

Timed Events should not terminate a waiting macro unless the action of the Timed event specifically terminates the macro using a function such as ph_killmacrowait. Waiting macros even have the option to survive PowerHome restarts.

The best way to monitor would be to view the PowerHome Status screen. You should be able to see your waiting macros in the queue. For testing purposes, you may want to shorten your wait time from 10 minutes to a couple of minutes and purposely set a timed event to fire while the macro is waiting. From the PowerHome Status screen, you should be able to watch the macro wait, the Timed Event fire, and then the macro wake up, execute, and go back to waiting (in the case of a macro with more than 1 wait statement).

If you would like us to review your macro logic, you can export the macro by right-clicking it from the PowerHome Explorer in the Macro Header screen. Post the resulting SQL and we can verify something else within the macro is not causing the problem.

Hope this helps,

Dave.
Back to Top View dhoward's Profile Search for other posts by dhoward Visit dhoward's Homepage
 
I_am_entangled
Newbie
Newbie
Avatar

Joined: October 27 2010
Location: United States
Online Status: Offline
Posts: 13
Posted: October 29 2010 at 11:39 | IP Logged Quote I_am_entangled

Here is the sql:

insert into macroheader values ('SPR_10','10 Minue Sprinkler Cycle',0,0,1);
insert into macrodetail values ('SPR_10',1,23,'SPR1',2,'',0,'');
insert into macrodetail values ('SPR_10',2,31,'',NULL,'600',0,'');
insert into macrodetail values ('SPR_10',3,23,'SPR1',3,'',0,'');
insert into macrodetail values ('SPR_10',4,31,'',NULL,'10',0,'');
insert into macrodetail values ('SPR_10',5,23,'SPR2',2,'',0,'');
insert into macrodetail values ('SPR_10',6,31,'',NULL,'600',0,'');
insert into macrodetail values ('SPR_10',7,23,'SPR2',3,'',0,'');
insert into macrodetail values ('SPR_10',8,31,'',NULL,'10',0,'');
insert into macrodetail values ('SPR_10',9,23,'SPR3',2,'',0,'');
insert into macrodetail values ('SPR_10',10,31,'',NULL,'600',0,'');
insert into macrodetail values ('SPR_10',11,23,'SPR3',3,'',0,'');
insert into macrodetail values ('SPR_10',12,31,'',NULL,'10',0,'');
insert into macrodetail values ('SPR_10',13,23,'SPR4',2,'',0,'');
insert into macrodetail values ('SPR_10',14,31,'',NULL,'600',0,'');
insert into macrodetail values ('SPR_10',15,23,'SPR4',3,'',0,'');
insert into macrodetail values ('SPR_10',16,39,'',NULL,'',0,'');

I will have to try what you suggested but will have to do it later. Maybe the above will point out a problem. I notice that Wait doesn't appear - NULL does.

__________________
I can't come to grips with a non-local universe let alone the way I thought it was.
Back to Top View I_am_entangled's Profile Search for other posts by I_am_entangled
 
I_am_entangled
Newbie
Newbie
Avatar

Joined: October 27 2010
Location: United States
Online Status: Offline
Posts: 13
Posted: October 29 2010 at 14:27 | IP Logged Quote I_am_entangled

Dave:

Thanks for your suggestions. I was not aware of the PH Status window - that is nice. Also - as I become more aware of the use of PH2 I am impressed with what you've created..

But the mystery deepens. I did as you suggested and instead of 10 minutes, changed the sequence to 1 minute, all else the same. I ran the Macro once with no other events occuring (except some X10 incoming from a motion sensor). It ran fine. I then ran it again and executed a number of commands during the wait periods. And this time it worked fine and I could see all of the wait states and resumes, etc as well as the message queue showing my commands being executed.

So the mystery is why did it fail last night? No coding changes other than above were made but the Macro did not complete. And this can be serious since it terminated when a sprinkler was on and instead of running for 10 minues ran until I discovered it several hours later (I had gone out to dinner). This is the type of thing that causes one to lose sleep.

Looking at my log for last night, it seems the Macro just stopped after turning on the 2nd sprinkler. I thought a timed event interupted the Macro, but looking at the timing, I see the time for the 2nd sprinkler to be turned off had already come and past before the timed event occurred. So the Macro had already failed. And as I said above - no code was changed except changing from 600 to 60 seconds in my Macro commands.

I'm confused. I'll do more testing.



__________________
I can't come to grips with a non-local universe let alone the way I thought it was.
Back to Top View I_am_entangled's Profile Search for other posts by I_am_entangled
 
grif091
Super User
Super User


Joined: March 26 2008
Location: United States
Online Status: Offline
Posts: 1357
Posted: October 29 2010 at 14:30 | IP Logged Quote grif091

FYI the Wait function is indicated by the numeric 31 before the string. What did the Timed Event do when it fired. That is, what was it trying to complish.

__________________
Lee G
Back to Top View grif091's Profile Search for other posts by grif091
 
I_am_entangled
Newbie
Newbie
Avatar

Joined: October 27 2010
Location: United States
Online Status: Offline
Posts: 13
Posted: October 29 2010 at 14:44 | IP Logged Quote I_am_entangled

Thanks Lee:

The timed event was a sunset determined event that turned on several lights. Actually it was 4 separate lights all set with a sunset timing - i.e. 4 timed events. But as mentioned in my last post - I see that actually the macro had already stopped (an expected command did not occur).

I'm performing another test now in which 2 time events will occur duringthe Macro period. The code posted earlier is the same code that failed last night - nothing had been changed at that point. I hate these unrepeatable errors - like the proverbial TV repairman showing up and everything works fine.

__________________
I can't come to grips with a non-local universe let alone the way I thought it was.
Back to Top View I_am_entangled's Profile Search for other posts by I_am_entangled
 
I_am_entangled
Newbie
Newbie
Avatar

Joined: October 27 2010
Location: United States
Online Status: Offline
Posts: 13
Posted: October 29 2010 at 14:51 | IP Logged Quote I_am_entangled

Well, I'm feeling a little like Chicken Little now; the code seems to be working fine with or without timed events or other commands coming in. I think I will have to wait and see if another problem arises. The only thing i will mention is that this is a new computer system with Windows 7. Is there any issue with Win 7 and PH2??

Thanks to all -

DickG

__________________
I can't come to grips with a non-local universe let alone the way I thought it was.
Back to Top View I_am_entangled's Profile Search for other posts by I_am_entangled
 
grif091
Super User
Super User


Joined: March 26 2008
Location: United States
Online Status: Offline
Posts: 1357
Posted: October 29 2010 at 14:56 | IP Logged Quote grif091

This is certainly not on the issue of what happened to the Macro that night but it does address the bad result.

Simplehomenet carries an EZFlora device for controlling sprinkler zones. Each zone can have a max run time specified so if the automation fails for any reason the zone will turn Off on its own.

EDIT: I was a little out of sync before. When I wrote my last post your post about not failing with additional testing had not appeared yet.

Edited by grif091 - October 29 2010 at 14:59


__________________
Lee G
Back to Top View grif091's Profile Search for other posts by grif091
 
I_am_entangled
Newbie
Newbie
Avatar

Joined: October 27 2010
Location: United States
Online Status: Offline
Posts: 13
Posted: October 29 2010 at 15:10 | IP Logged Quote I_am_entangled

Thanks again.

Your suggestion of the EzFlora device is interesting - I will look into it. I'm often gone for weeks and having a stuck sprinkler or bad code is worrisome. I had remote access and an alert system that texted me if a valve is stuck and I could remotely close a master valve. But I'm changing systems and don't have that working again yet.

Thanks -

__________________
I can't come to grips with a non-local universe let alone the way I thought it was.
Back to Top View I_am_entangled's Profile Search for other posts by I_am_entangled
 
BeachBum
Super User
Super User
Avatar

Joined: April 11 2007
Location: United States
Online Status: Offline
Posts: 1880
Posted: October 29 2010 at 15:27 | IP Logged Quote BeachBum

Your macro looks fine and one would have to assume it will work without interference from other actions. But I have experienced where the macro did complete but the actions within did not. The cause was, in the case of X10, collisions on the powerline from other devices. When you look at the report Event Log do you see the macro completing and the X10 commands issued? To answer your question about Win 7 and PH my answer it depends but not about what you are experiencing.

__________________
Pete - X10 Oldie
Back to Top View BeachBum's Profile Search for other posts by BeachBum
 
I_am_entangled
Newbie
Newbie
Avatar

Joined: October 27 2010
Location: United States
Online Status: Offline
Posts: 13
Posted: October 29 2010 at 16:56 | IP Logged Quote I_am_entangled

As mentioned in my previous posts, the Event Log does not show the expected commands completing for that particular macro being discussed. And I don't think there is an entry for the Macro completing in general, but there is one when it starts. At least for the tests I did today no entry shows up for the Macro ending - just starting.

As for collisions - there is no X10 activity indicated at the moment the missing command(s) was due.

I think I shall just need to chalk this up as another mystery of the universe until it (hopefully not) happens again.

__________________
I can't come to grips with a non-local universe let alone the way I thought it was.
Back to Top View I_am_entangled's Profile Search for other posts by I_am_entangled
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum