PDA

View Full Version : dm / netremote issue


mhwlng
December 31st, 2006, 09:52 AM
I have a bunch of x10 switches

at girder startup, the switch status is whatever it was when girder was stopped (apparently the dm stores the state)

if I now start NetRemote, I see dm variables (in NRD) for all the switches

e.g. SERVER\X10\A8\Switch, but the value is empty.

suppose the lights were ON when I stopped Girder.

1) start girder (device manager says the lights are on)
2) start netremote, the variables exist, but are empty
3) tell DM to switch the lights ON again. it sends the correct X10 commands to the (already on) lights
4) nothing happens in NR
5) ONLY when I send the opposite state (i.e. OFF) then NR gets updated...

how do I get the correct initial state to NR after starting girder.

once it's working ok, then starting/stopping NR only, works fine...

p.s. I use this code in girder, I hope that's the right way to do it ?

require 'DeviceManager.Devices'
require 'DeviceManager.Controls'
local ActionSource = 'Action'
for _,Device in ipairs(DeviceManager:GetDevices ('','','Light\\Switch','') ) do
for _, Control in ipairs(Device:GetControls()) do
if Control:GetName () == 'Switch' then
Control:SetValue ('Off',ActionSource)
elseif Control:GetName () == 'Level' then
Control:SetValue (0,ActionSource)
end
end
end


Marcel

Rob H
December 31st, 2006, 10:04 AM
Try using control:NotifyDevice(), or, to make life easier just use

DeviceManager:NotifyAll(function(...) DeviceManager.ConnectionManager:HandleEvent(unpack (arg)) end)

Rob H
December 31st, 2006, 10:06 AM
Alternatively, if you add

require 'DMSupport'

to your CCF's lua file then this should be handled for you

mhwlng
December 31st, 2006, 10:11 AM
the first tip works

for the second tip, I see :

...ram Files\Promixis\Girder5\\luascript\compat-5.1.lua:169: module `DMSupport' not found


Marcel

Rob H
December 31st, 2006, 10:13 AM
Should be in the CCF's .lua file, not in Girder

mhwlng
December 31st, 2006, 10:21 AM
ah yes, learning to read is not easy :-)

I start girder without calling any x10 functions yet :
then I start NR
I then see in the girder log DM.Query

and then NR dies..
it freezes and I have to kill it in task manager...

Marcel

Rob H
December 31st, 2006, 10:38 AM
That's unexpected (to say the least!), is that when using DMSupport?

mhwlng
December 31st, 2006, 10:56 AM
yes, If I comment the require bit out, no more hang...

note that the Flatstyle Music and DM.ccf loads ok
and it also contains the same require ... line...

Marcel

Rob H
December 31st, 2006, 11:09 AM
Hmm... there must be some sort of conflict with your Lua code somewhere I guess?

Is NR running on the same PC as Girder or another PC on the network?

Anything useful shown in the NRD log?

mhwlng
December 31st, 2006, 11:16 AM
NR and girder are on different pc's

what do you mean by NRD log ?
NRD isn't running.

you mean dbgview ?

attached is in dbgview when it is hung (at 50% cpu utilization)

I see

Got 0 security devices

But, I have one motion detector (A9)


Marcel

Rob H
December 31st, 2006, 11:30 AM
0 security devices is normal - it's looking for a Security\Area device

It all looks pretty normal to me :(

What happens if you only have the require 'DMSupport' in your .lua file?

mhwlng
December 31st, 2006, 12:00 PM
in that case, NR also hangs

Marcel

mhwlng
December 31st, 2006, 12:32 PM
If I comment out the line

--DM.SelectedDeviceWatch = NetRemote.RegisterVariableWatch('DM.SelectedDevice ', function(varname, value) SetCurrentLightingDevice(value) end)

in the Lighting.lua file, NR no longer hangs...

Marcel

Rob H
December 31st, 2006, 12:36 PM
Interesting, good catch. I'll take a look.

mhwlng
January 7th, 2007, 02:18 PM
Try using control:NotifyDevice(), or, to make life easier just use
DeviceManager:NotifyAll(function(...) DeviceManager.ConnectionManager:HandleEvent(unpack (arg)) end)


Alternatively, if you add
require 'DMSupport'
to your CCF's lua file then this should be handled for you


just f.y.i

using the latest NR 2.0.0.86

NR no longer hangs when I add require 'DMSupport'...

I've now remove the DeviceManager:NotifyAll bit, from girder (507!!) and tested either

require 'DMSupport'
or
require 'DMCore'

in NR

and in both instances everything seems to be ok in NR....

Marcel

Rob H
January 7th, 2007, 03:18 PM
Great, thanks for that.