[Message Prev][Message
Next][Thread Prev][Thread Next][Message
Index][Thread Index]
Re: Floorplan Sripting Help
--------------000306050303010406010202
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
There is definitely a issue here with the double space between user and 1
AlarmState is -mode: security off, user 1-
would imply there is no double space but the xAP message
text=Mode: security off, user 1
has a double space. So i'm not exactly sure where the space is coming
and going from. Maybe some events from comfort have the double space and
some don't.
An easy fix would be :
Sub Main()
AlarmState=xap.GetText("mi4.homeseer.server.93:comfortplugin.modedesc")
'makes any double space a single one
AlarmState=replace( AlarmState," "," ")
x=xap.LogDebug("AlarmState is -" & AlarmState &
"-")
'note this string doesn't have a double space
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
James
max wrote:
> No joy.
>
> 03/11/2006 19:03:36 Not matched
> 03/11/2006 19:03:36 AlarmState is -mode: security off, user
1-
> 03/11/2006 19:03:36 Starting
>
>
>
> Here's the original message as sent from homeseer,
>
> xap-header
> {
> v=12
> hop=1
> uid=FF41400E
> class=xAPBSC.info
> source=mi4.homeseer.server.93:ComfortPlugin.ModeDesc
> }
> output.state
> {
> state=ON
> text=Mode: security off, user 1
> }
>
> Max
>
> James Traynor wrote:
>
>> 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
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>
>>
>
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>
--------------000306050303010406010202
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">
</head>
<body bgcolor="#ffffff" text="#000000">
There is definitely a issue here with the double space between user and
1<br>
<pre wrap="">AlarmState is -mode: security off, user
1-</pre>
would imply there is no double space but the xAP message<br>
<pre wrap="">text=Mode: security off, user 1</pre>
has a double space. So i'm not exactly sure where the space is coming
and going from. Maybe some events from comfort have the double space
and some don't.<br>
An easy fix would be :<br>
Sub Main()<br>
<br>
AlarmState=xap.GetText("mi4.homeseer.server.93:comfortplugin.modedesc")<br>
'makes any double space a single one<br>
AlarmState=replace( AlarmState," ","
")<br>
x=xap.LogDebug("AlarmState is -" & AlarmState
& "-")<br>
<br>
'note this string doesn't have a double space<br>
if lcase(AlarmState) = "mode: security off, user 1"
then<br>
x=xap.LogDebug("Matched")<br>
xap.ScriptRun
"NightMode"<br>
else<br>
x=xap.LogDebug("Not
matched")<br>
end if<br>
<br>
End Sub<br>
<br>
James<br>
<br>
<br>
max wrote:
<blockquote cite="mid454B93E8.9020702@xxxxxxx"
type="cite">
<pre wrap="">No joy.
03/11/2006 19:03:36 Not matched
03/11/2006 19:03:36 AlarmState is -mode: security off, user 1-
03/11/2006 19:03:36 Starting
Here's the original message as sent from homeseer,
xap-header
{
v=12
hop=1
uid=FF41400E
class=xAPBSC.info
source=mi4.homeseer.server.93:ComfortPlugin.ModeDesc
}
output.state
{
state=ON
text=Mode: security off, user 1
}
Max
James Traynor wrote:
</pre>
<blockquote type="cite">
<pre wrap="">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:
</pre>
<blockquote 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 -" & 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:
</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
|