Logic Machine Forum
Can not change parameter visparams when using grp.create - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8)
+--- Thread: Can not change parameter visparams when using grp.create (/showthread.php?tid=4145)



Can not change parameter visparams when using grp.create - Fish56 - 12.07.2022

.lua   51.lua (Size: 2.74 KB / Downloads: 2)

Hello,
 I have a homeLynk HW 1.2 , Firmware 1.5.1 in operation for 7 years and now I have implemented scripts to read data from  a Kostal inverte Plenticore plus.
Had succes to read all 125 data point by Modbus TCP. I have generated all KNX Objekts by scripts and it works while using the essetial KNX object parameter with
grp.create.
myobject = grp.create({
    datatype = dt.float32,
    address = Gruppenaddresse,
    name = "Test float32 und visparams",
    units = " W",   
    tags =  "Plenticore",
    visparams=grp_visparams
      })

But I am failing to change the visualisation parameter  with the table of visparams.
After creating the object I read its parameter with
log("Grp lesen",grp.find(Gruppenaddresse))
but do not see the table visparams in the log

Changing the visu parameter manually and  do a
log("Grp lesen",grp.find(Gruppenaddresse))
Now I have suuccess I got the string of visparams as json.

I have attached the script 51.lua with the lua code that is showing the described behaviour.

Need some information if it possible to change visparams by script using my HW/SW combination.


RE: Can not change parameter visparams when using grp.create - admin - 12.07.2022

You have very old firmware which does not support setting visparams in grp.create.


RE: Can not change parameter visparams when using grp.create - Fish56 - 12.07.2022

(12.07.2022, 15:29)admin Wrote: You have very old firmware which does not support setting visparams in grp.create.

Thanks for immediate information. Unfortunatly I expected it.


RE: Can not change parameter visparams when using grp.create - admin - 13.07.2022

You can do this via a direct DB query:
Code:
addr = '32/1/1'

grp_visparams = {
  ["max"]="10000",
  ["min"]="0",
  ["step"]="",
  ["control"]="spinner",
  ["decimals"]="0",
}

json_visparams = json.encode(grp_visparams)

id = knxlib.encodega(addr)
db:query('UPDATE objects SET visparams=? WHERE id=?', json_visparams, id)



RE: Can not change parameter visparams when using grp.create - Fish56 - 13.07.2022

(13.07.2022, 06:13)admin Wrote: You can do this via a direct DB query:
Code:
addr = '32/1/1'

grp_visparams = {
  ["max"]="10000",
  ["min"]="0",
  ["step"]="",
  ["control"]="spinner",
  ["decimals"]="0",
}

json_visparams = json.encode(grp_visparams)

id = knxlib.encodega(addr)
db:query('UPDATE objects SET visparams=? WHERE id=?', json_visparams, id)

Great!!!!!! I took your code proposal, inserted it in my code and it is working. Smile Cool 
Thank you very much for your support.