Богдан Лошинский Posted November 18, 2015 Share Posted November 18, 2015 Hello! The standart function of Control4 API C4:GetVariable have two parameters, which are Device ID and Variable ID. So, I can see the Device ID in driver information, but do not Variable ID. How can I get value of device variable through the name or how can I get it Variable ID? Thanks for help! Link to comment Share on other sites More sharing options...
RyanE Posted November 18, 2015 Share Posted November 18, 2015 The easiest way in 2.8 (may have been in 2.7.x, but I don't know for certain) is to call C4:GetDeviceVariables(idDevice). That call returns a table, with VariableID referencing another table, which includes name, value, and a host of other things, such as type, readonly, hidden. Execute this Lua: for k,v in pairs(C4:GetDeviceVariables(29)) do print(k, v.name, v.value) end -- Replace 29 with a device id... What are you wanting to do this for, out of curiosity? RyanE Link to comment Share on other sites More sharing options...
Богдан Лошинский Posted November 18, 2015 Author Share Posted November 18, 2015 What are you wanting to do this for, out of curiosity?Thanks for help! I want to show some values of variables in thermostat Link to comment Share on other sites More sharing options...
Богдан Лошинский Posted November 19, 2015 Author Share Posted November 19, 2015 The easiest way in 2.8 (may have been in 2.7.x, but I don't know for certain) is to call C4:GetDeviceVariables(idDevice).I tried it, but it didn't work. There are not API function C4:GetDeviceVariables neither in documentation nor in DriverEditor. The table always is empty, for any device ID Link to comment Share on other sites More sharing options...
jfh Posted November 21, 2015 Share Posted November 21, 2015 The easiest way in 2.8 (may have been in 2.7.x, but I don't know for certain) is to call C4:GetDeviceVariables(idDevice). That call returns a table, with VariableID referencing another table, which includes name, value, and a host of other things, such as type, readonly, hidden. Execute this Lua: for k,v in pairs(C4:GetDeviceVariables(29)) do print(k, v.name, v.value) end -- Replace 29 with a device id... Ryan,Thanks - this is a great time saver! Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.