[Solved] Something in the code
Hi Guys
Messing around trying to get my location detection code up and running and I'm getting some weird issues.
When I run this applet:
-- Sets up bsc Endpoints for presence detection
--
-- Auth: Gary, 2014
module(...,package.seeall)
require("xap")
require("xap.bsc")
info={version="0.0.1", description="Locate.Endpoints"}
--function relayInfoEvent(endpoint, clazz)
-- endpoint.state = "off"
-- return false -- Return TRUE if the INFO/EVENT should be emitted / FALSE otherwise
--end
function init()
xap.init{instance="Locate", uid="FF00DF00"}
bsc.Endpoint{name="home.Kit", direction=bsc.OUTPUT, type=bsc.LEVEL}
bsc.Endpoint{name="home.BR", direction=bsc.OUTPUT, type=bsc.LEVEL}
-- bsc.Endpoint{name="home.LR", direction=bsc.OUTPUT, type=bsc.LEVEL}
bsc.Endpoint{name="home.Loft", direction=bsc.OUTPUT, type=bsc.LEVEL}
bsc.Endpoint{name="home.Hall", direction=bsc.OUTPUT, type=bsc.LEVEL}
endI get the following issues:
- No more heartbeats from plugboard
- When restarting the plugboard(while testing other code), my logRFstatesApplet.lua applet fires but all the rf state cmds have the 'Locate' instance as the source(as seen in XfXViewer.
- Plugboard starts showing Serial.Comms messages.
I've checked all the instance settings and all are set to default.
What am I doing wrong?
Gary,
Don't reinitialize XAP inside your applet if integrating with plugboard. That is going to break things.
xap.init{instance="Locate", uid="FF00DF00"}
I think I know why you did this.
There are two way to construct the endpoint name for a BscEndpoint.
bsc.Endpoint{name="home.Hall", direction=bsc.OUTPUT, type=bsc.LEVEL}
That will build this: dbzoo.<hostname>.plugboard:home.Hall
I think what you are trying to do is build this: dbzoo.<hostname>.Locate:home.Hall
** EDIT - we do support instance. Don't mix "instance" and "name" - combine like this **
In which case you should initialize your BSC endpoint like this:
bsc.Endpoint{instance="Locate:home.Hall", direction=bsc.OUTPUT, type=bsc.LEVEL}
Brett