This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Logic Machine wishlist
#25
Hi,

Use the filters before changing tags on objects that already has tags.

Question : Why don't you want to use script for adding tags to objects? The only extra handling is creating a temp script container. There are very powerfull script commands to do this, do you know them?

Code:
grp.gettags(alias)
grp.addtags(alias, tags)
grp.removetags(alias, tags)
grp.removealltags(alias)
grp.settags(alias, tags) -- methode mass update uses, overwrite all existing tags
 
Some simple samples:
1) Add tags based on name (partial), existing tags will be untouched
Code:
-- Start address of objects
start_objectaddress = '1/1/1'

-- End address of objects
end_objectaddress = '15/7/255'

-- Set Tag(s)
tags = {'Tag 1' , 'Tag 2' , 'Tag 3'} -- Multiple tags

-- Calculate start address to numeric format
start_objectaddress = knxlib.encodega(start_objectaddress)

-- Calculate end address to numeric format
end_objectaddress = knxlib.encodega(end_objectaddress)

-- Get all objects
result = grp.all()

-- Loop through all objects
for _, object in ipairs(result) do
 
 -- Only update objects within the start - end range
 if object.id >= start_objectaddress and object.id <= end_objectaddress then
 
   -- Only add tags when object name partial matches
   partial = 'Test'
   
   if string.match(object.name, partial) then
      grp.addtags(knxlib.decodega(object.id), tags)
   end
   
 end
end

-- Self disable script
script.disable(_SCRIPTNAME)

2) Add tags based on DPT, existing tags will be untouched
Code:
-- Start address of objects
start_objectaddress = '1/1/1'

-- End address of objects
end_objectaddress = '15/7/255'

-- Set Tag(s)
tags = 'Tag 1'  -- Single tag

-- Calculate start address to numeric format
start_objectaddress = knxlib.encodega(start_objectaddress)

-- Calculate end address to numeric format
end_objectaddress = knxlib.encodega(end_objectaddress)

-- Get objects by dtp type
result = grp.dpt(dt.float16, false) -- set to true for only exact dpt, now all 2 byte objects matches

-- Loop through all objects
for _, object in ipairs(result) do

 -- Only update objects within the start - end range
 if object.id >= start_objectaddress and object.id <= end_objectaddress then
    grp.addtags(knxlib.decodega(object.id), tags)
 end

end

-- Self disable script
script.disable(_SCRIPTNAME)

BR,

Erwin
Reply


Messages In This Thread
Logic Machine wishlist - by buuuudzik - 10.03.2016, 13:25
RE: Logic Machine wishlist - by admin - 11.03.2016, 08:51
RE: Logic Machine wishlist - by buuuudzik - 11.03.2016, 12:30
RE: Logic Machine wishlist - by JiriF - 18.04.2016, 08:24
RE: Logic Machine wishlist - by JiriF - 23.04.2016, 16:44
RE: Logic Machine wishlist - by JiriF - 25.04.2016, 13:32
RE: Logic Machine wishlist - by JiriF - 02.05.2016, 14:17
RE: Logic Machine wishlist - by admin - 03.05.2016, 06:09
RE: Logic Machine wishlist - by admin - 04.05.2016, 09:03
RE: Logic Machine wishlist - by Vesel - 05.05.2016, 17:32
RE: Logic Machine wishlist - by buuuudzik - 16.06.2016, 07:01
RE: Logic Machine wishlist - by jetsetter - 20.07.2016, 07:35
RE: Logic Machine wishlist - by baggins - 13.11.2017, 18:03
RE: Logic Machine wishlist - by baggins - 22.11.2017, 16:21
RE: Logic Machine wishlist - by baggins - 22.11.2017, 18:56
RE: Logic Machine wishlist - by bmodeco - 22.11.2017, 19:12
RE: Logic Machine wishlist - by baggins - 23.11.2017, 09:03
RE: Logic Machine wishlist - by edgars - 20.07.2016, 10:19
RE: Logic Machine wishlist - by jetsetter - 20.07.2016, 11:31
RE: Logic Machine wishlist - by edgars - 20.07.2016, 13:07
RE: Logic Machine wishlist - by forsterm - 30.11.2017, 20:05
RE: Logic Machine wishlist - by Thomas - 30.11.2016, 15:40
RE: Logic Machine wishlist - by admin - 01.12.2016, 07:17
RE: Logic Machine wishlist - by Thomas - 02.03.2017, 19:20
RE: Logic Machine wishlist - by Thomas - 03.03.2017, 09:35
RE: Logic Machine wishlist - by Erwin van der Zwart - 04.03.2017, 23:15
RE: Logic Machine wishlist - by Thomas - 06.03.2017, 11:59
RE: Logic Machine wishlist - by Thomas - 06.03.2017, 15:22
RE: Logic Machine wishlist - by Thomas - 06.03.2017, 17:52
RE: Logic Machine wishlist - by Thomas - 12.03.2017, 13:05
RE: Logic Machine wishlist - by admin - 13.03.2017, 07:36
RE: Logic Machine wishlist - by Thomas - 13.03.2017, 15:03
RE: Logic Machine wishlist - by admin - 13.03.2017, 16:59
RE: Logic Machine wishlist - by Thomas - 13.03.2017, 19:15
RE: Logic Machine wishlist - by Thomas - 16.03.2017, 15:57
RE: Logic Machine wishlist - by buuuudzik - 20.06.2017, 20:26
RE: Logic Machine wishlist - by leonidas - 20.07.2017, 06:34
RE: Logic Machine wishlist - by admin - 20.07.2017, 06:55
RE: Logic Machine wishlist - by rocfusion - 20.07.2017, 16:34
RE: Logic Machine wishlist - by admin - 21.07.2017, 15:39
RE: Logic Machine wishlist - by Thomas - 20.11.2017, 18:17
RE: Logic Machine wishlist - by JMM - 01.12.2017, 07:03
RE: Logic Machine wishlist - by bmodeco - 01.12.2017, 07:50
RE: Logic Machine wishlist - by admin - 01.12.2017, 07:28
RE: Logic Machine wishlist - by forsterm - 01.12.2017, 10:31
RE: Logic Machine wishlist - by forsterm - 01.12.2017, 18:14
RE: Logic Machine wishlist - by baggins - 01.12.2017, 18:20
RE: Logic Machine wishlist - by JMM - 02.12.2017, 07:28
RE: Logic Machine wishlist - by baggins - 02.12.2017, 09:12
RE: Logic Machine wishlist - by adiaz - 17.01.2018, 09:24
RE: Logic Machine wishlist - by forsterm - 21.01.2018, 10:55
RE: Logic Machine wishlist - by admin - 22.01.2018, 09:31
RE: Logic Machine wishlist - by forsterm - 08.02.2018, 08:52
RE: Logic Machine wishlist - by forsterm - 09.02.2018, 17:48
RE: Logic Machine wishlist - by Daniel - 12.02.2018, 15:18
RE: Logic Machine wishlist - by forsterm - 12.02.2018, 17:31
RE: Logic Machine wishlist - by buuuudzik - 08.02.2018, 12:02
RE: Logic Machine wishlist - by admin - 08.02.2018, 12:14
RE: Logic Machine wishlist - by buuuudzik - 08.02.2018, 12:34
RE: Logic Machine wishlist - by Thomas - 15.02.2018, 19:06
RE: Logic Machine wishlist - by buuuudzik - 22.02.2018, 14:22
RE: Logic Machine wishlist - by Jørn - 25.02.2018, 14:00
RE: Logic Machine wishlist - by buuuudzik - 25.02.2018, 14:27
RE: Logic Machine wishlist - by admin - 26.02.2018, 10:53
RE: Logic Machine wishlist - by buuuudzik - 26.02.2018, 11:15
RE: Logic Machine wishlist - by buuuudzik - 27.02.2018, 13:19
RE: Logic Machine wishlist - by DarthPaul - 28.02.2018, 06:12
RE: Logic Machine wishlist - by Safar - 24.05.2018, 13:57
RE: Logic Machine wishlist - by Daniel - 24.05.2018, 14:34
RE: Logic Machine wishlist - by Safar - 24.05.2018, 20:01
RE: Logic Machine wishlist - by buuuudzik - 24.05.2018, 15:27
RE: Logic Machine wishlist - by buuuudzik - 01.06.2018, 09:18
RE: Logic Machine wishlist - by Evens - 17.06.2018, 16:33
RE: Logic Machine wishlist - by Daniel - 17.06.2018, 17:26
RE: Logic Machine wishlist - by Evens - 17.06.2018, 19:10
RE: Logic Machine wishlist - by buuuudzik - 15.08.2018, 10:30
RE: Logic Machine wishlist - by Jørn - 03.09.2018, 14:42
RE: Logic Machine wishlist - by equalizer - 05.09.2018, 12:44
RE: Logic Machine wishlist - by buuuudzik - 07.09.2018, 07:35
RE: Logic Machine wishlist - by buuuudzik - 10.09.2018, 17:48
RE: Logic Machine wishlist - by Jørn - 18.09.2018, 13:39
RE: Logic Machine wishlist - by AEK - 19.09.2018, 14:11
RE: Logic Machine wishlist - by Jørn - 10.10.2018, 20:54
RE: Logic Machine wishlist - by buuuudzik - 06.10.2018, 14:24
RE: Logic Machine wishlist - by buuuudzik - 06.10.2018, 18:35
RE: Logic Machine wishlist - by buuuudzik - 06.12.2018, 22:06
RE: Logic Machine wishlist - by JMM - 01.02.2019, 11:54
RE: Logic Machine wishlist - by buuuudzik - 08.02.2019, 08:37
RE: Logic Machine wishlist - by buuuudzik - 08.02.2019, 10:23
RE: Logic Machine wishlist - by buuuudzik - 22.02.2019, 10:50
RE: Logic Machine wishlist - by buuuudzik - 23.02.2019, 20:02
RE: Logic Machine wishlist - by admin - 26.02.2019, 08:38
RE: Logic Machine wishlist - by buuuudzik - 26.02.2019, 09:29
RE: Logic Machine wishlist - by admin - 26.02.2019, 10:54
RE: Logic Machine wishlist - by buuuudzik - 26.02.2019, 15:33
RE: Logic Machine wishlist - by buuuudzik - 08.03.2019, 09:03
RE: Logic Machine wishlist - by Daniel - 08.03.2019, 09:48
RE: Logic Machine wishlist - by buuuudzik - 08.03.2019, 09:55
RE: Logic Machine wishlist - by AlexLV - 09.03.2019, 20:40
RE: Logic Machine wishlist - by admin - 11.03.2019, 07:37
RE: Logic Machine wishlist - by JMM - 11.03.2019, 08:38
RE: Logic Machine wishlist - by Daniel - 11.03.2019, 14:21
RE: Logic Machine wishlist - by AlexLV - 11.03.2019, 19:09
RE: Logic Machine wishlist - by admin - 12.03.2019, 07:53
RE: Logic Machine wishlist - by AlexLV - 12.03.2019, 17:38
RE: Logic Machine wishlist - by AlexLV - 24.03.2019, 06:47
RE: Logic Machine wishlist - by forsterm - 25.03.2019, 07:40
RE: Logic Machine wishlist - by buuuudzik - 15.07.2019, 10:55
RE: Logic Machine wishlist - by pawel200388 - 15.07.2019, 12:19
RE: Logic Machine wishlist - by buuuudzik - 30.10.2019, 05:53
RE: Logic Machine wishlist - by admin - 30.10.2019, 07:59
RE: Logic Machine wishlist - by buuuudzik - 30.10.2019, 09:58
RE: Logic Machine wishlist - by legolas2069 - 02.12.2021, 17:18
RE: Logic Machine wishlist - by admin - 03.12.2021, 07:29
RE: Logic Machine wishlist - by buuuudzik - 03.12.2021, 10:57

Forum Jump: