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.

grp.create() value_custom
#1
Ciao,

creating modbus device profile is it possible to specify custom value visual by using the value_custom key as table.

Is there a way to use the same key in scripting while creating objects using the grp.create() function?

I tried value_custom()... but it was not considered while creating a new group

thansk
Ciao
M
Reply
#2
This field is called enums in grp.create. It should either be a Lua table or a string containing a JSON object.
Reply
#3
(16.05.2022, 07:43)admin Wrote: This field is called enums in grp.create. It should either be a Lua table or a string containing a JSON object.

Hi again,

It works for objects accepting custom values. However the following code causes temperature to be read as (22) instead of 22.15

Code:
grp.create({
    datatype = 9001,
    address = '3/2/56',
    name = 'Temperature',
    enums = {},
    comment = '',
    forcename =true
  })

So, I also tried

Code:
enums = nil

which works, but point is, if I had once set 
Code:
enums = {},
then
Code:
enums = nil
cannot fix object read value until I delete it and recreate it.

I addition when I log same object when set right I see an empty string for enum key.

Can you please make more clear all the above.

Thanks in advance.
Reply
#4
At the moment it's not possible to clear custom values for existing objects via grp.create. If you set enums to an empty table it will still be used to lookup custom values. Since the table is empty the resulting value text is also empty.
Reply


Forum Jump: