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