www.homeseer.com

Go Back   HomeSeer Message Board > HomeSeer > General Discussion Area

General Discussion Area General discussion about HomeSeer that does not fall into any other category or are not specific to 1.x or 2.x versions of HomeSeer.

Reply
 
Thread Tools Display Modes
  #1  
Old November 23rd, 2009, 12:35 AM
manxam manxam is offline
Seer
 
Join Date: Oct 2009
Location: Canada
Posts: 20
Default Event Action Delayed but should be immediate

Hey! I'm wondering if someone can help shed some light on something for me.

I have a Sonos ZP90 connected to an amplifier and am using the Sonos Real Time Script to update the "Transport State" (play/stop/pause) in HSPRO to power up/down and adjust inputs on my amplifier as required.

I have an event that is triggered when the Sonos Real Time Script changes this particular's zone to "Changed", it then executes, and changes the status back to "Unchanged". When the Sonos changes songs, stops, or pauses, it then again changes the status to "Changed" and the cycle begins again.

I use this logic to check if the Sonos has started playing or has been stopped/paused for a given amount of time (at which point the receiver should turn off)

My issue is that there is a good 40+ second delay between the HSPRO log showing the status change to "Changed" and the event being run. There are no delays setup in the event or script so I'm not certain what's causing it.

I've included a small sample of the log to show this effect. The first time the event takes 48 seconds to run, the second 52.

Any help would be greatly appreciated!

Thanks

Code:
11/22/2009 9:17:12 PM  Sonos HS virtual device "Sonos Bonus Room Status Change" has been updated.
11/22/2009 9:18:00 PM  Event Event Trigger "Sonos Power State"
11/22/2009 9:18:00 PM  Event Running script in background: SonosPower.vb   
11/22/2009 9:18:08 PM  Sonos Updating virtual device status of Bonus Room
11/22/2009 9:18:08 PM  Sonos All virtual device property monitors for Bonus Room have been updated.
11/22/2009 9:18:08 PM  Sonos HS virtual device "Sonos Bonus Room Status Change" has been updated.
11/22/2009 9:19:00 PM  Event Event Trigger "Sonos Power State"   
11/22/2009 9:19:00 PM  Event Running script in background: SonosPower.vb
Reply With Quote
  #2  
Old November 23rd, 2009, 08:02 AM
dschoppe dschoppe is offline
Seer Master
 
Join Date: Aug 2004
Location: NC
Posts: 768
Default

Manxam,

I don't use Sonos, so I can't answer for certain, but what does your "Sonos Power State" event look like? You don't have any "do not retrigger for xx seconds" options configured do you? Also, are you using a device status change trigger or conditional trigger for this event?

Thanks,
Don
Reply With Quote
  #3  
Old November 23rd, 2009, 01:22 PM
manxam manxam is offline
Seer
 
Join Date: Oct 2009
Location: Canada
Posts: 20
Default

Thanks for your response Don. I do not have any 'do not trigger..." options set (often times there is 4-5 minutes between status changes (avg length of song)).

I have used both device status change and conditional with Status Change is Changed and both are delayed.

Is it possible that while the Sonos script is changing the status to changed/unchanged, the script is not exiting at this time? That HS is waiting for for the script to complete before starting the event?

Call me confused.

Thanks!
Reply With Quote
  #4  
Old November 23rd, 2009, 04:05 PM
dschoppe dschoppe is offline
Seer Master
 
Join Date: Aug 2004
Location: NC
Posts: 768
Default

Quote:
Originally Posted by manxam View Post
Is it possible that while the Sonos script is changing the status to changed/unchanged, the script is not exiting at this time? That HS is waiting for for the script to complete before starting the event?
Hmmm. How many scripts are involved in this? Are you possibly making multiple calls into the same script from different events and do you possibly have the option enabled to allow only one instance of the script to run?
Just grasping here...
Reply With Quote
  #5  
Old November 23rd, 2009, 06:16 PM
manxam manxam is offline
Seer
 
Join Date: Oct 2009
Location: Canada
Posts: 20
Default

Only two scripts involved. One being the Sonons Real Time Script in question, and the second run by the event that is getting delayed. This "script" has a small case statement looking for STOP, PLAY, PAUSE and then triggers a the appropriate device.

It's written in VB.net and is only a couple of lines. It shouldn't delay anything. Also, as the event that runs this script is getting delayed, I doubt that this is it.

Thanks again for your help.
Reply With Quote
  #6  
Old November 23rd, 2009, 07:06 PM
Rupp's Avatar
Rupp Rupp is online now
OverSeer
 
Join Date: Jan 2001
Location: Huntsville, Al. USA
Posts: 33,803
Default

What's your CPU level when the "real time" script is running? I wonder if it could be CPU blocking causing delays.
__________________
-Rupp
Reply With Quote
  #7  
Old November 24th, 2009, 01:54 PM
manxam manxam is offline
Seer
 
Join Date: Oct 2009
Location: Canada
Posts: 20
Default

Rupp, it barely registers. This is an intel quad core 2.4ghz, 4 gigs of ram, and running Vista, Homeseer Pro, and nothing else.

Keep 'em coming

Thanks!
Reply With Quote
  #8  
Old November 24th, 2009, 05:03 PM
Rupp's Avatar
Rupp Rupp is online now
OverSeer
 
Join Date: Jan 2001
Location: Huntsville, Al. USA
Posts: 33,803
Default

Hum... Which of the event trigger types are only evaluated on the minute? Hopefully someone else can remember this. I'll bet this is the issue. Why not move the control logic to the script so it handles the device changes and triggers?
__________________
-Rupp
Reply With Quote
  #9  
Old November 24th, 2009, 06:07 PM
ArbWare's Avatar
ArbWare ArbWare is offline
Seer Deluxe
 
Join Date: Apr 2006
Location: Columbus, Ohio
Posts: 446
Default

Rupp,

It used to be that conditional events type was only evaluated 1 time per minute..

I think that is still true.. i know i have conditioal events that delay between 15-45 seconds between when the condition becomes true and event fires....
__________________
Regards,

Andrew B.
Reply With Quote
  #10  
Old November 24th, 2009, 09:06 PM
dschoppe dschoppe is offline
Seer Master
 
Join Date: Aug 2004
Location: NC
Posts: 768
Default

In post #2 I asked if a status change or conditional event trigger was being used, and manxam indicated he actually tried both:

I have used both device status change and conditional with Status Change is Changed and both are delayed.

manxam, maybe you could post related parts of the script(s) and screen shots of the events?

Don
Reply With Quote
  #11  
Old November 24th, 2009, 09:33 PM
manxam manxam is offline
Seer
 
Join Date: Oct 2009
Location: Canada
Posts: 20
Default

Well, son of a ... Looking back through my logs, the event is only triggered on the minute. 7:27:00, 7:31:00, 7:37:00. So, regardless of what time the status changes, the event is only run on the next full minute.

The weird thing is that regardless of using "conditional with status change" or "device ... status changed to status *any*" this occurs.

Do both of these events only get evaluated one per minute?

Thanks for all of your help and suggestions guys and thanks especially to Don and Rupp for continually checking out this thread!

Cheers!
Reply With Quote
  #12  
Old November 24th, 2009, 10:03 PM
manxam manxam is offline
Seer
 
Join Date: Oct 2009
Location: Canada
Posts: 20
Default

Here is a copy of my script if anyone has an idea on how to make it more efficient. I don't like creating a manual event that is called from the script, nor do I like adding and deleting the delayed event.

What I'm doing is: checking if the Sonos Real Time Script has changed the status of the specific zone. If so, then check the transportstate (play/pause/stop) and if it's currently playing then turn on the amplifier and set the appropriate input. If it's stop/pause then create a delayed event that turns off the amp in 5 minutes IF the status doesn't change again (the reason for the removedelayedevent) and the amplifier's input doesn't move away from CD (if it does then I'm probably watching a movie or tv so don't do a thing).

Code:
Public Sub Main(ByVal parm As Object)

        Dim bonusroom_transportstate

        bonusroom_transportstate = hs.RunEx("Sonos.vbh", "GetProperty", "Bonus Room|transportstate")
        
        hs.SetDeviceString("S99", bonusroom_transportstate)
        hs.SetDeviceLastChange("S99", Now())

        Select Case bonusroom_transportstate

            Case "Play"
                hs.TriggerEvent("Onkyo Sonos Input")
                hs.RemoveDelayedEvent("", "Sonos Power Off")
            Case "Pause"
                hs.DelayTrigger(300, "Sonos Power Off")
            Case "Stop"
                hs.DelayTrigger(300, "Sonos Power Off")

        End Select
    End Sub
Attached Images
 
Reply With Quote
  #13  
Old November 24th, 2009, 11:25 PM
lazy_bums lazy_bums is offline
Seer
 
Join Date: Apr 2009
Location: chicago
Posts: 30
Default

i m an amateur, but this kind of simple event works flawlessly for me

sonos power off for stopped Device 1st Family Room Family Room Transportstate has been Stopped for exactly 2:00 WHEN Everyday
Device Command: 1st Family Room Music system power Off
SONOS FAMILY ROOM POWER ON Device 1st Family Room Family Room Transportstate value becomes equal to Playing WHEN Everyday
Device Command: 1st Family Room Music system power On
Reply With Quote
  #14  
Old November 25th, 2009, 12:49 AM
manxam manxam is offline
Seer
 
Join Date: Oct 2009
Location: Canada
Posts: 20
Default

Haha, well that sure is simple and would appear to work How do you handle stopping sonos and then someone changing the stereo's source to that of say..a dvd player? Will your script still turn off the stereo or do you have logic checking for input?

Thanks!
Reply With Quote
  #15  
Old November 25th, 2009, 06:57 AM
dschoppe dschoppe is offline
Seer Master
 
Join Date: Aug 2004
Location: NC
Posts: 768
Default

Quote:
Originally Posted by manxam View Post
The weird thing is that regardless of using "conditional with status change" or "device ... status changed to status *any*" this occurs.

Do both of these events only get evaluated one per minute?
No, device status (and device value) change triggers should be evaluated immediately. Conditional events are evaluated at least once per minute. See: About events from online help


Quote:
Originally Posted by manxam View Post
Thanks for all of your help and suggestions guys and thanks especially to Don and Rupp for continually checking out this thread!
Cheers!
Rupp is one of the biggest "helpers" on this forum. Most times, I'm the guy asking questions, but thanks

Don
Reply With Quote
  #16  
Old January 1st, 2010, 05:28 PM
manxam manxam is offline
Seer
 
Join Date: Oct 2009
Location: Canada
Posts: 20
Default Addendum

Further to my original post, I've taken the action as suggested by lazy_bum and, while it SHOULD work, it does not.

If you see the attached screenshot, you'll see that the Sonos transport state has become "Stopped" @ 1:55. The Onkyo's input is still on CD (don't pay attention to the Onkyo being off as I did this manually after realizing the conditions weren't working) and more than 5 minutes has passed. All of the conditions have been met but it did not act.

Now, I can manually RUN the event and it does what it's supposed to do. (read: it turned off the amp at 2:17 according to the screenshot because the conditions had been met)

What I can't understand is why it won't run automatically. As far as the above information states, a condition should be checked at LEAST once a minute so I would expect no more than 6 minutes to pass before the event is run. Unfortunately it's not being run at all.

Any ideas would be greatly appreciated once again!

Thanks!
Attached Images
 
Reply With Quote
  #17  
Old January 4th, 2010, 09:31 PM
manxam manxam is offline
Seer
 
Join Date: Oct 2009
Location: Canada
Posts: 20
Default

Great, I stumped everyone

I tried hitting my Homeseer computer with a stick. Unfortunately, it did not fix the problem...
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 11:42 AM.


Copyright 1998-2008 HomeSeer Technologies, LLC