Hi guys, I have some scripting questions...
Following the examples, I have created a script to shutdown a PC running an ap to support shut down:
-- Registers ShutdownPC service
function init()
register_target("dbzoo.livebox.ShutdownPC", "shutdown")
end
-- Sends http request to remote PC
function shutdown()
os.execute("curl http://172.16.10.30:8000/?action=System.Shutdown")
xap_send("xap-header\
{\
target=dbzoo.livebox.Twitter\
class=xAPBSC.cmd\
}\
output.state.1\
{\
id=*\
text='PC Shutdown!'\
}\
")
end
I have also set up a google cal event to activate this script:
This is the xAP header in the google cal entry:
xAP-header
{
target=dbzoo.livebox.ShutdownPC
source=GoogleCalendar
class=unknown
}
Now as you know I'm trying to integrate the xAP Flash app into my home automation and I'd like to be able to activate this script from my Joggler.
Now I notice when the google cal event fires, I get this xAP message:
The following message caused an error during its processing.
The xAP message value is malformed. The block name contains one or more invalid characters
The message was received from 172.16.10.100:3078
------------
xAP-header
{
v=12
hop=1
uid=FF00DA00
class=unknown
source=dbzoo.livebox.GoogleCal
target=dbzoo.livebox.ShutdownPC
}
}
------------
The error that was generated is as follows:
The xAP message value is malformed
The block name contains one or more invalid characters
Source: xFx
The xAP message value is malformed
The block name contains one or more invalid characters
KCS.xAP.Framework.xAPException: The xAP message value is malformed
The block name contains one or more invalid characters
at KCS.xAP.Framework.Message.xAPPairValue.ValidateValue()
at KCS.xAP.Framework.Message.xAPMultiComponentValue..ctor(String value, Char seperator_char)
at KCS.xAP.Framework.Message.xAPMessageBlock..ctor(String keyword)
at KCS.xAP.Framework.Message.xAPMessageReader.ReadMessageBlockKeyword(xAPMessage message, String line)
at KCS.xAP.Framework.Message.xAPMessageReader.ReadMessage()
But the script seems to fire.
My code for the xAPFlash config file stipulates that I need to include a little more in the header, so looks like this:
<button NAME="Turn PC OFF">
<gridX>2</gridX>
<gridY>3</gridY>
<posY>-10</posY>
<posX>+10</posX>
<visible>true</visible>
<style>button60_off_.png</style>
<textPrefix>PC_Off</textPrefix>
<label>
<fontsize>11</fontsize>
<offset>-8</offset>
<text>Shutdown PC</text>
</label>
<xAP>
<schema>xAPBSC</schema>
<uid>*</uid>
<source>dbzoo.livebox.shutdownPC</source>
</xAP>
<mode>toggle</mode>
<xapon>
xap-header
{
v=13
hop=1
uid=FF.0738:00
source=UKUSA.Joggler.Controller
target=dbzoo.livebox.shutdownPC
class=unknown
}
output.state
{
}
</xapon>
<xapoff>
</xapoff>
</button>
However this doesn't activate the script, so I was wondering if we could setup xAP on HAH for it to include plugboard scripts as xAP endpoints that follow the xAP schema?
Also I was also trying to figure out how to activate WOL entries via xAP, is this even possible? I assume it is through some command entry but have spent some hours trying to suss it and have come up short.
Hoping you can nudge me in the right direction..
Cheers
Gary