[SOLVED] How to iterate through own list of values or hardware
Posted: Friday 13 May 2022 8:10
Hi folks,
I want to set some parameter for few hardware that I have using the openURL method. For this, I need hardware indexes of relevant hardware so i can compile the correct URL.
I've tried two approaches how to iterate thorough those:
1. I've created an own list of values, eg. local list = {1,2,3,4,5} with idx of hardware, but as this are nor devices I am not sure how to use dz.devices().filter(function(device) here to get the respective idx of each hardware. For devices it works but how do I iterate the list to get 1 or 2 or 3 returned, so i can use it to compile a correct URL
2. I've see two methods in the documentation, domoticz.hardware().forEach(..) and for i, j in pairs(domoticz.hardware()) do .. end, but to be honest I am not quite sure how to use it
Any ideas how to accomplish this?
thx,
Zavjah
I want to set some parameter for few hardware that I have using the openURL method. For this, I need hardware indexes of relevant hardware so i can compile the correct URL.
I've tried two approaches how to iterate thorough those:
1. I've created an own list of values, eg. local list = {1,2,3,4,5} with idx of hardware, but as this are nor devices I am not sure how to use dz.devices().filter(function(device) here to get the respective idx of each hardware. For devices it works but how do I iterate the list to get 1 or 2 or 3 returned, so i can use it to compile a correct URL
2. I've see two methods in the documentation, domoticz.hardware().forEach(..) and for i, j in pairs(domoticz.hardware()) do .. end, but to be honest I am not quite sure how to use it
Any ideas how to accomplish this?
thx,
Zavjah