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.

FAN SPEEDS TO TEXT
#1
Hello guys.
I need your help.
I have a w4k and i need to convert the vrv speeds to text.
So the AUTO is 0
The LOW is 1 to 33
The MEDIUM is 34 to 67
The HIGH is 68 to 100.
The GA is 1byte unsigned integer.
The script that i want to create will have the 1 byte as an input and i will write the result in an other GA with the desired string/text.
I m attaching a photo of the visualization.    
Reply
#2
Code:
1234567891011
textobject ='1/1/1' speed = event.getvalue() if speed == 0 then   grp.checkwrite(textobject, 'Auto') elseif speed > 0 and speed =< 33 then   grp.checkwrite(textobject, 'Low') elseif speed > 33 and speed <= 67 then   grp.checkwrite(textobject, 'Medium') elseif speed > 67 then   grp.checkwrite(textobject, 'High') end
Reply
#3
Thank you Erwin again for your quick reply!
You are a life saver!
Your script works like a charm!!!!
Reply
#4
Another option is to generate text labels via a script and use them as Custom values (enums):
Code:
123456789101112131415161718192021
text = {} text[ 0 ] = 'Auto' for i = 1, 33 do   text[ i ] = 'Low' end for i = 34, 67 do   text[ i ] = 'Medium' end for i = 68, 100 do   text[ i ] = 'High' end -- must be an existing object grp.create({   address = '32/1/20',   enums = text })
Reply
#5
Thank you very much admin!
Reply
#6
Hello all
How to change custom values via JS
BR,
Best Regards,
Reply
#7
Custom values can only be changed from Lua side. Visualization has to be reloaded for new value to appear. Why do you need to change these value from JS?
Reply
#8
(27.06.2022, 12:31)admin Wrote: Custom values can only be changed from Lua side. Visualization has to be reloaded for new value to appear. Why do you need to change these value from JS?

Thanks Admin
I aim to use it in this example https://forum.logicmachine.net/showthread.php?tid=4091, to change the custom value and icon via JS.
While I should create 1byte object for the custom values (auto off, auto on, manual of, manual on, overload).

then no need to write on Custom value I should write on new 1byte object
Best Regards,
Reply


Forum Jump: