IDX in LUA (read)
Posted: Thursday 04 January 2018 11:25
Hi there,
I use zwave TRV valves for my heating and sometimes they fail and need excluding and re-adding. When I write to them I use their IDX, which I store in a variable. If a valve is removed then I put 999 in the variable which stops the code from executing for that valve.
So, i re-add the valve and put the new IDX in the variable.
But, when I look at the current setting of the valve at the moment I use the name. What I'd like to do is look at the IDX for this, then I don't have to add/name the device into the GUI.
At the moment I use valve=tonumber(otherdevices_svalues["Set_"..zoneName])
I'd like to use valve=tonumber(otherdevices_svalues[idx])
The IDX comes from idx=tostring(uservariables["valve_idx_"..zoneName])
I can't work out how to do this.
I use zwave TRV valves for my heating and sometimes they fail and need excluding and re-adding. When I write to them I use their IDX, which I store in a variable. If a valve is removed then I put 999 in the variable which stops the code from executing for that valve.
So, i re-add the valve and put the new IDX in the variable.
But, when I look at the current setting of the valve at the moment I use the name. What I'd like to do is look at the IDX for this, then I don't have to add/name the device into the GUI.
At the moment I use valve=tonumber(otherdevices_svalues["Set_"..zoneName])
I'd like to use valve=tonumber(otherdevices_svalues[idx])
The IDX comes from idx=tostring(uservariables["valve_idx_"..zoneName])
I can't work out how to do this.