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.

Make higher group adress
#1
Hi
In current project we will make conversation from 4 bit from a swich to 0-100 % to use with dimmer output.
I want to use tag and event on the tags.
Then use event.dst to get the group adress that triggered it.
How to edit this group adress in lua?
I.e if triggered group adress returns 1/1/1
I want the output byte adress to be (1/1/1 +1) 1/1/2 ?
Reply
#2
Hi
It is good practice to do it based on group naming. Let say your dim group will be called Room101-dim and your output group will be Room101-value then you can make such script.

Code:
outName, found = string.gsub(grp.alias(event.dst), 'dim', 'value')
value=100
if  found == 1 then
  grp.write(outName, value)
end
 
You tag only the input groups.
------------------------------
Ctrl+F5
Reply
#3
Perfect. Will try this tomorrow. Can this functions also be used in javascript/css?
Reply
#4
Lua:
Code:
addr = '1/1/1'
nextaddr = buslib.decodega(buslib.encodega(addr) + 1)

Visualization:
Code:
addr = '1/1/1'
nextaddr = Scada.decodeGroupAddress(Scada.encodeGroupAddress(addr) + 1)

Apps:
Code:
addr = '1/1/1'
nextaddr = localbus.decodega(localbus.encodega(addr) + 1)
Reply


Forum Jump: