I'm trying to tweak a script to control the lighting using nodes as movement sensors but only after dark.
While playing I have noticed in xFx viewer that sometimes I get a couple of xAPBSC.info messages for the same endpoint with different values without an xAPBSC.event. I thought that an event was sent if an endpoint changed and an info was sent if no change.
Am I mistaken or is this normal?
Member for
16 years 10 monthsEr no that is not normal.
Er no that is not normal. What endpoint was doing this on you?
Brett
Member for
14 years 5 monthsEndpoints
The endpoints are the ones from a roomnode. So the moved, light, and temp endpoints.
I had code that should have worked based on getting events rather than infos. I could post a screengrab from xfx but that won't really help. Is there a debug mode I can enter to give you output from the HAH?
Cheers Brett
Member for
14 years 6 monthsinfo class meltdown
Hi
I'm probably missing something very obvious but....
I'm running this testApplet.lua---------------it's part of a larger project. Anyway in XFX viewer I'm getting multiple info events for these endpoints at 200 ms intervals that seem to drown out all other activity. Any advice?
module(...,package.seeall)
require ('xap')
require('xap.bsc')
info={
version="1.0", description="counter test"
}
function init()
-- Create new xAP Endpoints to show countdown
LivbscBoostCounter = bsc.Endpoint{source="dbzoo.livebox.Plugboard:LivBoostCounter", direction=bsc.OUTPUT, type=bsc.STREAM}
KitbscBoostCounter = bsc.Endpoint{source="dbzoo.livebox.Plugboard:KitBoostCounter", direction=bsc.OUTPUT, type=bsc.STREAM}
BedbscBoostCounter = bsc.Endpoint{source="dbzoo.livebox.Plugboard:BedBoostCounter", direction=bsc.OUTPUT, type=bsc.STREAM}
WaterbscBoostCounter = bsc.Endpoint{source="dbzoo.livebox.Plugboard:WaterBoostCounter", direction=bsc.OUTPUT, type=bsc.STREAM}
LivbscBoostCounter:setText("00:00")
KitbscBoostCounter:setText("00:00")
BedbscBoostCounter:setText("00:00")
WaterbscBoostCounter:setText("00:00")
end
Member for
16 years 10 monthsI never saw this behaviour
I never saw this behaviour with this code which does the same as yours its just more compact.
endpoints={}
function init()
for _,i in pairs{"Liv","Kit","Bed","Water"} do
name = i.."BoostCounter"
endpoints[name] = bsc.Endpoint{source="dbzoo.livebox.Plugboard:"..name, direction=bsc.OUTPUT, type=bsc.STREAM}
endpoints[name]:setText("00:00")
endpoints[name]:sendEvent()
end
end
Member for
14 years 6 monthsBrettThanks for the "tidy
Member for
14 years 6 monthsBrettThanks for the "tidy
Brett
Thanks for the "tidy up"
Strangely without me making any changes the tsunami of info events slowed down to their normal 2 min intervals.
I'm still very confused as to what is going on.
Here is another snippet of the same applet. Even though the timer is supposed to fire at 10 sec intervals I'm seeing a flood of events.
function boost(b)
local zone,plussage = unpack(b)
if zone == "liv" then
if plussage == "0" then --if stop button has been pressed
bsc.sendState("dbzoo.livebox.Controller:relay.2", "off")
LivOffTime = os.time()
else
bsc.sendState("dbzoo.livebox.Controller:relay.2", "on")
bsc.sendState("dbzoo.livebox.Controller:RF.3", "on")
LivOffTime = os.time() + LivRunningTime + 1800 -- increment each time button is pressed
xap.Timer(LivCountLoop, 10):start(true) --start timer fire immediately
end
end
end
function LivCountLoop(timer)
LivRunningTime = os.difftime(LivOffTime,os.time()) -- in seconds
if LivRunningTime <= 0 then
bsc.sendState("dbzoo.livebox.Controller:relay.2", "off")
bsc.sendState("dbzoo.livebox.Controller:RF.3", "off")
LivRunningTime = 0
timer:delete()
end
LivbscBoostCounter:setText(SecondsToClock(LivRunningTime + 59))-- to make the readout look OK
LivbscBoostCounter:sendEvent()
end
function SecondsToClock(nSeconds)
if nSeconds == 0 then
return "00:00"
else
nHours = string.format("%02.f", math.floor(nSeconds/3600))
nMins = string.format("%02.f", math.floor(nSeconds/60 - (nHours*60)))
return nHours..":"..nMins
end
end