Logic Machine Forum
Mbus script LM bug - 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: Mbus script LM bug (/showthread.php?tid=3453)



Mbus script LM bug - stigen - 30.06.2021

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


RE: Mbus script LM bug - admin - 30.06.2021

What you are describing might be a hardware issue and the script might have nothing to do with it. How old is the LM that you are using?


RE: Mbus script LM bug - stigen - 30.06.2021

ARMv7 Processor rev 5 (v7l)
Version: 20180822


RE: Mbus script LM bug - stigen - 01.07.2021

(30.06.2021, 09:33)admin Wrote: What you are describing might be a hardware issue and the script might have nothing to do with it. How old is the LM that you are using?

ARMv7 Processor rev 5 (v7l)
Version: 20180822

would it help if i upgraded firmware?


RE: Mbus script LM bug - admin - 01.07.2021

You can certainly try installing 2021 RC1.