This is an interesting one. My understanding of this is as follows (I may be wrong):
When you use VariablesSet - this appears to be a one shot. Vera uses the value next time it configs the Z-Wave device(s). It then reports the changes via ConfiguredVariable. VariablesGet just returns the VariablesSet value. If you write an empty string with VariablesSet, VariablesGet will be empty. ConfiguredVariable contains info that probably comes from some file in Vera or down off the net.
If I want to just read all the registers in a Z-Wave device - I can’t. The problem is, if a value is changed accidentally somehow, you have no way of knowing that. If any one knows how all the registers can be read, then please show how.
You can copy the following code into the browser test code box to show all the config info in the log file:
[code]local PLUGIN_NAME = ‘ZWConfigInfo’
local DEBUG_MODE = true
local function debug(textParm, logLevel)
if DEBUG_MODE then
local text = ‘’
local theType = type(textParm)
if (theType == ‘string’) then
text = textParm
else
text = 'type = ‘…theType…’, value = ‘…tostring(textParm)
end
luup.log(PLUGIN_NAME…’ debug: '…text,50)
elseif (logLevel) then
local text = ''
if (type(textParm) == 'string') then text = textParm end
luup.log(PLUGIN_NAME..' debug: '..text, logLevel)
end
end
– Find out which device is the Z-Wave controller. It’s normally
– ‘1’ but we’ll make sure by finding it programmatically. However,
– we “assume” it always exists.
– There may be more than 1 if there are secondary controllers
– attached as UPnP devices. We prefer #1 if it exists.
function getZWInterfacelId()
local DEVICE_CATEGORY_ZWAVE_INT = 19
local zwInt = -1
v = luup.devices[1];
if v ~= nil and v.category_num == DEVICE_CATEGORY_ZWAVE_INT then
return 1
end
for k, v in pairs(luup.devices) do
if (v.category_num == DEVICE_CATEGORY_ZWAVE_INT) then
zwInt = k
end
end
return zwInt
end
– Get the Z-Wave config info
local function getZWConfigInfo()
local zwInt = getZWInterfacelId()
-- extract the info about the Z-Wave devices
for k, v in pairs(luup.devices) do
-- we're only interested in the Z-Wave devices
if (v.device_num_parent == zwInt) then
debug(v.description)
local ZWvars1= luup.variable_get("urn:micasaverde-com:serviceId:ZWaveDevice1", "ConfiguredVariable", k)
if (ZWvars1) then debug('ConfiguredVariable, Device id: '..k..' = '..ZWvars1)
else debug('ConfiguredVariable, Device id: '..k..' = nil') end
local ZWvars2 = luup.variable_get("urn:micasaverde-com:serviceId:ZWaveDevice1", "VariablesSet", k)
if (ZWvars2) then debug('VariablesSet, Device id: '..k..' = '..ZWvars2)
else debug('VariablesSet, Device id: '..k..' = nil') end
local ZWvars3 = luup.variable_get("urn:micasaverde-com:serviceId:ZWaveDevice1", "VariablesGet", k)
if (ZWvars3) then debug('VariablesGet, Device id: '..k..' = '..ZWvars3..'\n')
else debug('VariablesGet, Device id: '..k..' = nil\n') end
end
end
end
getZWConfigInfo()
return true
[/code]
To change the config info using Lua, you typically would:
luup.variable_set("urn:micasaverde-com:serviceId:ZWaveDevice1", "VariablesSet", "a_string_containing_the_config_info_request", SOME_DEVICE_ID)
luup.call_action("urn:micasaverde-com:serviceId:HaDevice1", "Reconfigure", {}, SOME_DEVICE_ID)
luup.call_action("urn:micasaverde-com:serviceId:HomeAutomationGateway1", "Reload", {}, 0)
I’m not sure, if the reload (last line above) is required or not. I’ve not tried it.