Help would be very much appreciated.
I have been struggling for a while to get the updated corona, suite of apps working.
Every time I compile on my computer’s I get the following/similar error.
Windows simulator build date: Aug 28 2013 @ 17:45:55
Copyright (C) 2009-2013 C o r o n a L a b s I n c .
Version: 2.0.0
Build: 2013.1202
Run
time error
error loading module 'hahlib.interface.bsc' from file 'C:\Users\kema01\AppData\R
oaming\Corona Labs\Corona Simulator\Plugins\hahlib\interface\bsc.lua':
...ta\Roaming\Corona Labs\Corona Simulator\Plugins\hahlib\interface\bsc.
lua:1: unexpected
Please see attached jpg for further details.
I have downloaded all corona files to my computer using SVN
I have the early version of the android app working with out issue.
If you require any further details please let me know.
Many thanks kema...
Attachment | Size |
---|---|
Corona error.jpg | 23.33 KB |
Yup because the code that puts the xAP message on the wire by default is commented out. doh!
https://github.com/dbzoo/hah/blob/master/userapps/HAHCorona/sliderContro...
I must have been testing and forgot switch the comment around on those two lines.
Works just fine for me once I uncommented that line.
Kema,
as you are getting a xap message directed at you end point it would suggest an issue with your endpoint handler.
Can you post your script that handles the thermostat?
Should it not be:
function temperature(m)
local msg = unpack(m)
bsc.sendText("dbzoo.livebox.kema:Heating.thermostat",msg)
end
also, this looks wrong to me:
bsc.sendState("bscmsg -t dbzoo.livebox.jeenode:kema7.relay1 -s on")
os.execute("bscmsg -t dbzoo.livebox.jeenode:kema7.relay1 -s on")
to send command via shell using Brett's bscmsg program or:
bsc.sendState("dbzoo.livebox.jeenode:kema7.relay1","on")
to send via lua.
Garry
Kema, I had to clean up a friends computer from nasties a few days ago I found this useful "windows defender offline"
http://windows.microsoft.com/en-AU/windows/what-is-windows-defender-offline
The state should be there that's a bug in the slider code.
bscSend{target=opt.xapTarget, text=temperature}
should be:
bscSend{target=opt.xapTarget, text=temperature, state="on"}
Also,
in the example above, your target is different:
target=dbzoo.livebox.Plugboard:Thermostat
from corona and
target=dbzoo.livebox.kema:Heating.thermostat
from your bscmsg example.
Also, so, is this really correct? You send this from command line: bscmsg -t dbzoo.livebox.kema:Heating.thermostat -s on -x 19.5
but see this in xfx:
output.state.1
{
state=on
text=00.1
id=*
}
Very odd if you do?!
Garry
What is sending this xAP event? Is that something from the someother piece of code ?
Its not formed correctly and the slider is not handling it (another bug there too).
This is wrong....
output.state
{
state=on
text=6
}
There are several things wrong with the body.
1. output.state should be output.state.1
2. Its missing an id=* attribute
output.state.1
{
id=*
state=on
text=6
}
3. To fix the slider crash you should return if TEMP is nil
local temp = frame:getValue("output.state.1","text")
+ if temp == nil then
+ return
+ end
local sliderlevel = ((temp-opt.states[1]) / #opt.states) * 100
See how its looking for output.state.1 but it does not find it so it gets "nil" consequently that causes a problem.
Brett
WAIT My BAD this is an xapBSC.event not a xAPBSC.cmd - so output.state is correct.
You just need to add that little bit of code then.
ARRGH double bad.... just remove the .1 this call is for an xAPBSC.event - its a coding bug.
local f = xap.Filter()
f:add("xap-header","source",opt.xapTarget)
f:add("xap-header","class","xAPBSC.event")
f:callback(function(frame)
local temp = frame:getValue("output.state","text")
Brett
Lets consult ye specification on BSC shall we.
http://www.xapautomation.org/index.php?title=Basic_Status_and_Control_Sc...
Events should be "ouput.state" or "input.state" removing the .1 is correct.
If its breaking then that is different problem that needs addressing.
You need to post the xap packet that is breaking it.
Brett
Kema,
can you please post your scene4.lua file and the exact error message you are getting.
also cooy the related xfx xap messages that you see, both cmd and events.
garry
Kema,
73 local sliderlevel = ((temp-opt.states[1]) / #opt.states) * 100
74 if sliderLevel < 0 then
75 sliderLevel = 0
76 end
You are getting an error on line 74 as line 73 has defined a different variable.
Variables in LUA are case senstive. Look at these lines carefully.
Brett
As Brett says, your earlier error message was pointing you to the issue.
C:\PROGRA~1\CORONA~1\CORONA~1\Resources\hahlib\xap\init.lua:466: c:\users\kema01\docume~1\corona~2\sandbox\52\scene4.lua:74: attempt to compare nil with number
The scene problem is due to the fact you have not added the slider into the scene's view.
myslider = newHorizSliderWithFeedback { etc ..}
group.add(myslider)
You already had
local group = self.view defined you just forgot, or didn't know, that you must insert displayables into this object.
Brett
Kema,
Its been a while since I've played with this.
Each "project" that is check out of the GIT repository needs to use the hahlib library files.
You need to copy "hahlib" into "C:\Program Files (x86)\Corona Labs\Corona SDK\Resources" so its available to ALL of those sub-projects - I tested this with the latest download 2015.2646 and it seems to do the trick.
Brett