Posts: 185
Threads: 38
Joined: Feb 2017
Reputation:
3
Hi
I would like to have a script that checks the values of several group adresses in KNX at a certain time of day.
How can I set this up in an easy way? I understand I can just do grp.read(), but how can I do this to more than one GA's without having to type in a lot of lines.
BR
Trond
There are 10 kinds of people in the world; those who can read binary and those who don't
Posts: 449
Threads: 94
Joined: Jun 2015
Reputation:
6
17.02.2017, 12:10
(This post was last modified: 17.02.2017, 12:11 by gjniewenhuijse.)
Tag every object you want to read, for example: read_chk1
In scheduler script loop in your tags like:
myobjects = grp.tag('read_chk1')
for index, value in ipairs(myobjects) do
-- here your code
end
Posts: 185
Threads: 38
Joined: Feb 2017
Reputation:
3
Hm...
Did not work. I entered the following:
----------------------------------------------------------
myobjects = grp.tag('Status_value')
for index, value in ipairs(myobjects) do
grp.read(myobjects)
end
grp.read('0/0/3')
-----------------------------------------------
The last grp.read() is just for me to see that the script is running...
I did not get any read requests on the group adresses tagged with 'Status_value'. Maybe the grp.read() is not the correct command to use in my case?
I am rather new to this scripting things, so please bear with me :-)
There are 10 kinds of people in the world; those who can read binary and those who don't
Posts: 7762
Threads: 42
Joined: Jun 2015
Reputation:
447
Also, keep in mind that read sends a KNX read telegram and does not return object value. If you want to get current object value then you should use grp.getvalue instead.
Posts: 1764
Threads: 6
Joined: Jul 2015
Reputation:
117
17.02.2017, 12:28
(This post was last modified: 17.02.2017, 12:31 by Erwin van der Zwart.)
Hi,
myobjects is a table that is read line by line, each line is now set to value and is (in this case) also a table, value.address is the field you need..
use: grp.read(value.address)
BR,
Erwin
Posts: 185
Threads: 38
Joined: Feb 2017
Reputation:
3
...so simple...
Worked perfectly! Thanks!
There are 10 kinds of people in the world; those who can read binary and those who don't