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.

Mbus script LM bug
#1
Hi!

 I have a script for reading Mbus, i works for å while then the LM is "stuck".
When it happen i cant log into it. If i take the power off, it works fine after that.
Then it works for somewhile and then the same thing happens.

I tried to deactivate the script for some days, and then the LM works fine.



I am using Tecbase Mbus 10 RS-232 Mbus gateway.

its a Sheduled script that runs every day at 07.30.

Is there something wrong in my script?
Is there someway to close the Mbus reading, so it only reads Mbus when the script runs?
Someone who has had the same experiance?



Here is my script:



-------------------------------Step 1: LM script (search for Mbus ID):

--[[
-- load mbus library
require('mbus')
-- use /dev/ttyUSB0 serial port with 2400 baud rate

mbus.init('/dev/RS232', 2400)

-- scan from range 0 to 5 (inclusive)
res = mbus.scan(0, 100)
-- save result to Logs tab
log(res)

]]--


--------------------------------Step 2: LM script (read values):(Deactivate step 1 before going to step 2)

--load mbus library
require('mbus')
-- use /dev/ttyUSB0 serial port with 2400 baud rate
mbus.init('/dev/RS232', 2400)
-- new address to write
addr = 71
-- read all data
res, err = mbus.getdata(addr)

-- read ok
if res then
  --log(res)----------------reading all the Mbus data, sort afterwards the values you want
 
 
  --log(res.data[0].value)
 
 
 
  value1 = res.data[1].value
  value2 = res.data[4].value
  value3 = res.data[5].value
 
  value10 = value1:sub(1, -3) -------remove decimal
  value20 = value2:sub(1, -3) -------remove decimal
  value30 = value3:sub(1, -3) -------remove decimal
 
 
  num1 = tonumber(value10)
  num2 = tonumber(value20)
  num3 = tonumber(value30)
  log(num1)
 
 
  grp.update('32/1/19', num1)----write value to grp.
  grp.update('32/1/20', num2)----write value to grp.
  grp.update('32/1/21', num3)----write value to grp.
-- read failed
else
  alert('[mbus] failed to read data from short address ' .. addr .. ' ' .. tostring(err)) 
end
Reply


Messages In This Thread
Mbus script LM bug - by stigen - 30.06.2021, 08:07
RE: Mbus script LM bug - by admin - 30.06.2021, 09:33
RE: Mbus script LM bug - by stigen - 01.07.2021, 05:16
RE: Mbus script LM bug - by stigen - 30.06.2021, 09:39
RE: Mbus script LM bug - by admin - 01.07.2021, 05:27

Forum Jump: