The UK Home Automation Archive

Archive Home
Group Home
Search Archive


Advanced Search

The UKHA-ARCHIVE IS CEASING OPERATIONS 31 DEC 2024


[Message Prev][Message Next][Thread Prev][Thread Next][Message Index][Thread Index]

Re: Floorplan Sripting Help



--------------070800000105050401080808
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

ok, nearly there:

Mode: security off, user  1
mode: security off, user 1

if you use =  between two strings then they must be identical, extra
spaces and different cases will cause it not to match. It seems there is
something going on in Floorplan that has lower cased the value which
would of stopped the match. The extra space after the 'user '  would of
stopped the match too.

Sub Main()
x=xap.LogDebug("Starting")
AlarmState=xap.GetText("mi4.homeseer.server.93:comfortplugin.modedesc")
x=xap.LogDebug("AlarmState is -" & AlarmState &
"-")

if lcase(AlarmState) = "mode: security off, user 1" then
x=xap.LogDebug("Matched")
xap.ScriptRun "NightMode"
else
x=xap.LogDebug("Not matched")
end if

End Sub

and you should be there

James

max wrote:
> NightMode script doesn't run. Log returns:
> 02/11/2006 21:30:57 	   	Not matched
> 02/11/2006 21:30:57 	   	AlarmState is -mode: security off, user 1-
> 02/11/2006 21:30:57 	   	Starting
>
>
> max
>
> James Traynor wrote:
>
>> Hi,
>>
>> The debug window shows the last error that has occurred, the only
>> thing that clears it, other than a restart, is a new error
message. It
>> would be very hard to debug things if it did clear everytime a
script
>> ran as there could be quite a lot of scripts running at once a
heavily
>> used Floorplan.
>>
>> Try this script:
>>
>> Sub Main()
>> x=xap.LogDebug("Starting")
>>
AlarmState=xap.GetText("mi4.homeseer.server.93:comfortplugin.modedesc")
>> x=xap.LogDebug("AlarmState is -" & AlarmState &
"-")
>>
>> if AlarmState = "Mode: security off, user  1" then
>> 	x=xap.LogDebug("Matched")
>> 	xap.ScriptRun "NightMode"
>> else
>> 	x=xap.LogDebug("Not matched")
>> end if
>>
>> End Sub
>> noting the space between ScriptRun and "NightMode"
>> Run the script and look at the script debug log especially the
line
>> that says
>> AlarmState is -Mode: security off, user  1-
>> What i am wondering is that there may be a space before or after
the
>> data, hence adding the -- to highlight it.
>> If you mail back with what the log says, as this should at least
>> highlight where the issue is.
>> Thanks
>> James
>>
>> max wrote:
>>
>>> Found a bug I think, the error persisted with and without the
quotes,
>>> didn't clear until I restarted Floorplan. Is the debug not
refreshing,
>>> or holding onto the original, unmodified script?
>>>
>>> Still having a problem with the script, using your corrections
>>>
>>> Sub Main()
>>> '
>>>
AlarmState=xap.GetText("mi4.homeseer.server.93:comfortplugin.modedesc")
>>> if AlarmState = "Mode: security off, user  1" then
>>> xap.ScriptRun"NightMode"
>>> else
>>> end if
>>> '
>>> End Sub
>>> The script runs through debugger with no errors, but doesn't
run the
>>> script when AlarnState is correct. I've tried changing
xap.ScriptRun to
>>>
x=xap.SendBSCState("ersp.x10.server:loungelamp","off")
as a test, and
>>> that runs fine through debugger but doesn't appear to work
either.
>>>
>>> Max
>>>
>>> Using
>>> James Traynor wrote:
>>>
>>>
>>>> Hi,
>>>> Could you check this line
>>>>
>>>>
AlarmState=xap.GetText("mi4.homeseer.server.93:comfortplugin.modedesc")
>>>>
>>>> as the error seems to show it without quotes:
>>>>
>>>>
AlarmState=xap.GetText(mi4.homeseer.server.93:comfortplugin.modedesc)
>>>>
>>>> with quotes being correct
>>>> also
>>>>
>>>> xap.ScriptRun(NightMode)
>>>>
>>>> should be
>>>>
>>>> x=xap.ScriptRun("NightMode")
>>>>
>>>> as it is a function and returns data, also as you are
passing a string
>>>> of text to the function that string needs to be in quotes.
Actually
>>>> since you really dont want the data that it would return
you could just:
>>>>
>>>> xap.ScriptRun "NightMode"
>>>>
>>>> hth
>>>>
>>>> James
>>>>
>>>> max wrote:
>>>>
>>>>
>>>>> I've have being trying to write Raw script to check
the alarm status of
>>>>> Comfort and run an autoscript dependent on the
outcome. The autoscript
>>>>> is working fine, but Scipt Debug gives the following
error:
>>>>>
>>>>> Script error : *AlarmStateChecking* : 01/11/2006
21:11:46
>>>>> Line : 11
>>>>> Error Text :
>>>>>
AlarmState=xap.GetText(mi4.homeseer.server.93:comfortplugin.modedesc)
>>>>> Error Description :Expected ')'
>>>>>
>>>>> Here is my raw script:
>>>>>
>>>>> Sub Main()
>>>>> '
>>>>> ' gets alarm state, runs NightMode script if security
is off
>>>>> '
>>>>> '
>>>>>
AlarmState=xap.GetText("mi4.homeseer.server.93:comfortplugin.modedesc")
>>>>> '
>>>>> if AlarmState = "Mode: security off, user 1"
then
>>>>> '
>>>>> xap.ScriptRun(NightMode)
>>>>> else
>>>>> end if
>>>>> '
>>>>> End Sub
>>>>>
>>>>> My scripting experience is next to none, but I just
can't see where I'm
>>>>> going wrong with this one.
>>>>>
>>>>> Max
>>>>>
>>>>>
>>>>>
>>>>>
>>
>>
>
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>


--------------070800000105050401080808
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01
Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1"
http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">


ok, nearly there:<br>
<pre wrap="">Mode: security off, user  1
mode: security off, user 1</pre>
if you use =&nbsp; between two strings then they must be identical,
extra
spaces and different cases will cause it not to match. It seems there
is something going on in Floorplan that has lower cased the value which
would of stopped the match. The extra space after the 'user '&nbsp;
would of
stopped the match too.<br>
<pre wrap="">Sub Main()
x=xap.LogDebug("Starting")
AlarmState=xap.GetText("mi4.homeseer.server.93:comfortplugin.modedesc")
x=xap.LogDebug("AlarmState is -" &amp; AlarmState &amp;
"-")

if lcase(AlarmState) = "mode: security off, user 1" then
x=xap.LogDebug("Matched")
xap.ScriptRun "NightMode"
else
x=xap.LogDebug("Not matched")
end if

End Sub</pre>
and you should be there<br>
<br>
James<br>
<br>
max wrote:
<blockquote cite="mid454A64BD.1030208@xxxxxxx"
type="cite">
<pre wrap="">NightMode script doesn't run. Log returns:
02/11/2006 21:30:57 	   	Not matched
02/11/2006 21:30:57 	   	AlarmState is -mode: security off, user 1-
02/11/2006 21:30:57 	   	Starting


max

James Traynor wrote:
</pre>
<blockquote type="cite">
<pre wrap="">Hi,

The debug window shows the last error that has occurred, the only
thing that clears it, other than a restart, is a new error message. It
would be very hard to debug things if it did clear everytime a script
ran as there could be quite a lot of scripts running at once a heavily
used Floorplan.

Try this script:

Sub Main()
x=xap.LogDebug("Starting")
AlarmState=xap.GetText("mi4.homeseer.server.93:comfortplugin.modedesc")
x=xap.LogDebug("AlarmState is -" &amp; AlarmState &amp;
"-")

if AlarmState = "Mode: security off, user  1" then
x=xap.LogDebug("Matched")
xap.ScriptRun "NightMode"
else
x=xap.LogDebug("Not matched")
end if

End Sub
noting the space between ScriptRun and "NightMode"
Run the script and look at the script debug log especially the line
that says
AlarmState is -Mode: security off, user  1-
What i am wondering is that there may be a space before or after the
data, hence adding the -- to highlight it.
If you mail back with what the log says, as this should at least
highlight where the issue is.
Thanks
James

max wrote:
</pre>
<blockquote type="cite">
<pre wrap="">Found a bug I think, the error persisted with
and without the quotes,
didn't clear until I restarted Floorplan. Is the debug not refreshing,
or holding onto the original, unmodified script?

Still having a problem with the script, using your corrections

Sub Main()
'
AlarmState=xap.GetText("mi4.homeseer.server.93:comfortplugin.modedesc")
if AlarmState = "Mode: security off, user  1" then
xap.ScriptRun"NightMode"
else
end if
'
End Sub
The script runs through debugger with no errors, but doesn't run the
script when AlarnState is correct. I've tried changing xap.ScriptRun to
x=xap.SendBSCState("ersp.x10.server:loungelamp","off")
as a test, and
that runs fine through debugger but doesn't appear to work either.

Max

Using
James Traynor wrote:

</pre>
<blockquote type="cite">
<pre wrap="">Hi,
Could you check this line

AlarmState=xap.GetText("mi4.homeseer.server.93:comfortplugin.modedesc")

as the error seems to show it without quotes:

AlarmState=xap.GetText(mi4.homeseer.server.93:comfortplugin.modedesc)

with quotes being correct
also

xap.ScriptRun(NightMode)

should be

x=xap.ScriptRun("NightMode")

as it is a function and returns data, also as you are passing a string
of text to the function that string needs to be in quotes. Actually
since you really dont want the data that it would return you could just:

xap.ScriptRun "NightMode"

hth

James

max wrote:

</pre>
<blockquote type="cite">
<pre wrap="">I've have being trying to write Raw script to
check the alarm status of
Comfort and run an autoscript dependent on the outcome. The autoscript
is working fine, but Scipt Debug gives the following error:

Script error : *AlarmStateChecking* : 01/11/2006 21:11:46
Line : 11
Error Text :
AlarmState=xap.GetText(mi4.homeseer.server.93:comfortplugin.modedesc)
Error Description :Expected ')'

Here is my raw script:

Sub Main()
'
' gets alarm state, runs NightMode script if security is off
'
'
AlarmState=xap.GetText("mi4.homeseer.server.93:comfortplugin.modedesc")
'
if AlarmState = "Mode: security off, user 1" then
'
xap.ScriptRun(NightMode)
else
end if
'
End Sub

My scripting experience is next to none, but I just can't see where I'm
going wrong with this one.

Max



</pre>
</blockquote>
</blockquote>
</blockquote>
<pre wrap="">
</pre>
</blockquote>
<pre wrap=""><!---->



xAP_Automation Main Index | xAP_Automation Thread Index | xAP_Automation Home | Archives Home

Comments to the Webmaster are always welcomed, please use this contact form . Note that as this site is a mailing list archive, the Webmaster has no control over the contents of the messages. Comments about message content should be directed to the relevant mailing list.