DSC832 Script Problem

General HouseBot discussion. Any issues that don't fit into any of the other topics belong here.
Post Reply
bjlamarca
Member
Posts: 83
Joined: Wed Apr 13, 2005 1:09 am
Location: White Plains, NY

DSC832 Script Problem

Post by bjlamarca »

I just changed over to a newer PC for HB, running Windows 2003 Server. Now, when the alarm system sends a series of commands in a short period of time, the script does not processes every command. The log is below. Scott, any suggestions on how to troubleshoot this?

"6/15/2009","9:27:39 pm","Scr-DS832ControlScript","Audit","[Scr-DS832ControlScript.State] has changed to [Running]"
"6/15/2009","9:27:39 pm","Scr-DS832ControlScript","Audit","[Scr-DS832ControlScript.State] has changed to [Stopped]"
"6/15/2009","9:27:39 pm","Scr-DS832ControlScript","Warning","Script is already running. Ignoring request to run script."
"6/15/2009","9:27:39 pm","Scr-DS832ControlScript","Audit","[Scr-DS832ControlScript.State] has changed to [Running]"
"6/15/2009","9:27:39 pm","Scr-DS832ControlScript","Audit","[Scr-DS832ControlScript.State] has changed to [Stopped]"
"6/15/2009","9:27:39 pm","Scr-DS832ControlScript","Warning","Script is already running. Ignoring request to run script."
"6/15/2009","9:27:39 pm","Scr-DS832ControlScript","Audit","[Scr-DS832ControlScript.State] has changed to [Running]"
"6/15/2009","9:27:39 pm","Scr-DS832ControlScript","Audit","[Scr-DS832ControlScript.State] has changed to [Stopped]"
"6/15/2009","9:27:39 pm","Scr-DS832ControlScript","Warning","Script is already running. Ignoring request to run script."
"6/15/2009","9:27:40 pm","Scr-DS832ControlScript","Audit","[Scr-DS832ControlScript.State] has changed to [Running]"
"6/15/2009","9:27:40 pm","Scr-DS832ControlScript","Audit","[Scr-DS832ControlScript.State] has changed to [Stopped]"
ScottBot
Site Admin
Posts: 2790
Joined: Thu Feb 13, 2003 6:46 pm
Location: Georgia (USA)
Contact:

Re: DSC832 Script Problem

Post by ScottBot »

I'm not really familiar with your script, but I'm guessing that the warning about not running the script because it is already running is causing the problem for you. There's probably some timing differences on the new machine, but it's hard to say exactly what would be causing this.

Again, I don't really know the script, but what you might want to try is to re-check and process the input data at the end of the script (actually have a loop that continues to check for new data until there is none). That way if new data is received while the script is running and the task won't run the script again, the running script will pick up the new data after it has processed existing data.

Make sense?
Scott
bjlamarca
Member
Posts: 83
Joined: Wed Apr 13, 2005 1:09 am
Location: White Plains, NY

Re: DSC832 Script Problem

Post by bjlamarca »

Thanks for the response.

First I tried to loop the script continuously. I have the script check if that data is different then the last loop. If so, it processes it. When I started the script, the CPU jumped to 100% and stayed there. So I went back to having a task fire the script, which then loops 1000 times to catch any data that comes quickly. Seems to be working.
Last edited by bjlamarca on Wed Jul 08, 2009 2:59 am, edited 1 time in total.
Richard Naninck
HouseBot Guru Extraordinaire
Posts: 1121
Joined: Tue Sep 28, 2004 7:49 am
Location: The Netherlands

Re: DSC832 Script Problem

Post by Richard Naninck »

If you create a continuous running script, implement a "Sleep 1" in the loop and the cpu will go back to zero again.

A simple main loop could like somthing like this:

Code: Select all

Do
	Sleep 1
	'ActionReceive gets set by a task that triggers on a change in ReceivedData
	'This is done to accept duplicates in ReceivedData for being able to get multiple of the i.e. same Power State updates
	ActionReceive = GetPropertyValue("Receiver Status.Action Receive")
	If ActionReceive = "GetReceivedData" Then
		SetpropertyValue "Receiver Status.Action Receive", "Waiting"
		ReceivedData = GetPropertyValue("Receiver.Received Data")
		Call Handle_ReceivedData(ReceivedData)
		Sleep 200
	End If
	
	Action = GetPropertyValue("Receiver Status.Action")
	If Action <> "Waiting" Then
		If Action <> "" Then	
			Call Handle_SendData(Action)
		End If
		SetPropertyValue "Receiver Status.Action", "Waiting"
		Sleep 100
	End If
Loop
Post Reply