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 whether you accept or reject these cookies being set.

spaceLYnk Hw Version?
#21
Ah, ok, thank you. It is a 3 then.
Reply
#22
Is there a way to get this info with a script, in addition to FW version and CPU load?
Reply
#23
Hi,

Try this:
Code:
local ARM = io.readproc('cat /proc/cpuinfo | grep \"model name\"'):match('%d+')
log(ARM)


local FW = io.readfile('/lib/genohm-scada/version'):split('.')
FW = FW[1]*1000000 + FW[2]*1000 + FW[3]
log(FW)
BR,

Erwin
Reply
#24
(10.03.2019, 00:07)Erwin van der Zwart Wrote: Hi,

Try this:
Code:
local ARM = io.readproc('cat /proc/cpuinfo | grep \"model name\"'):match('%d+')
log(ARM)


local FW = io.readfile('/lib/genohm-scada/version'):split('.')
FW = FW[1]*1000000 + FW[2]*1000 + FW[3]
log(FW)
BR,

Erwin

Great, thats what I need. Thank you!
Reply
#25
Hi Erwin,

is possible to use your script with latest LM? I just tried to start it, and receive back this:

FW * string: 7
and error log:
Resident script:6: attempt to perform arithmetic on a nil value
stack traceback:
Reply
#26
Hi,

Yes should work but i think i try to multiply a string value in line 6.

Change FW[1] to tonumber(FW[1]) and do the same with 2 and 3.

Or remove line 6 to get the FW as RAW string, we needed it to BACnet 
and the controller does not support BACnet string values so that is why 
we convert it to a analog value like 2003001. In this case it’s FW 2.3.1

BR,

Erwin
Reply
#27
LM version is already a number in YYYYMMDD format, so split is not needed.
Reply
#28
Hi,

In that case you can use:

FW = io.readfile('/lib/genohm-scada/version')
log(FW)

BR,

Erwin
Reply
#29
Hi,
thank you for answers, FW now shoved correctly, but this code below no any log at all.. May be it depends of CPU type?
local ARM = io.readproc('cat /proc/cpuinfo | grep \"model name\"'):match('%d+')
log(ARM)
Reply
#30
Code:
cpu = io.readfile('/proc/cpuinfo'):match('model name%s+:%s+([^%s]+)')
log(cpu)
Reply


Forum Jump: