[Solved] Something in the code

2 replies [Last post]
BodgeIT
Offline
London, United Kingdom
Joined: 10 Jun 2010

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}
end

I get the following issues:

  1. No more heartbeats from plugboard
  2. 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.
  3. Plugboard starts showing Serial.Comms messages.

I've checked all the instance settings and all are set to default.

 

What am I doing wrong?

 

brett
Offline
Providence, United States
Joined: 9 Jan 2010
Gary,Don't reinitialize XAP

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

BodgeIT
Offline
London, United Kingdom
Joined: 10 Jun 2010
I was only trying to set the

I was only trying to set the "instance names" and use my own uid for 'Locate' so the system would auto select the ids for the devices.

Thanks, modified the code and all well.

Hardware Info