Logic Machine Forum
Integrate Noark 1F electricity meter and write to M-Bus to change tariff - 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: Integrate Noark 1F electricity meter and write to M-Bus to change tariff (/showthread.php?tid=5038)



Integrate Noark 1F electricity meter and write to M-Bus to change tariff - fleeceable - 17.10.2023

Hello!

I checked M-Bus manual and this thread but didn't find any information...
https://openrb.com/m-bus-integration-in-lm
https://openrb.com/docs/mbus.htm
https://forum.logicmachine.net/showthread.php?tid=365&highlight=mbus

We have about 185 Noark EMS 1P 1M electricity meters. Plan is to integrate these to LM using Techbase TB-MBUS-200-RS232 converter.

Is it possible to send custom M-Bus packet to change tariff? Noark one phase electricity meters allow to change tariff only using M-Bus write command.  

Here is electricity meter manual (page 17 and 20):
https://cdn.noark-electric.eu/documents/54033eef-8adf-4961-b4d7-60718e87c62c/user_manual_ems_1p_1m_en.pdf


RE: Integrate Noark 1F electricity meter and write to M-Bus to change tariff - admin - 18.10.2023

Try this, make sure that only one script is accessing the serial port at any time moment.
Code:
require('serial')

port, err = serial.open('/dev/RS232', {
  baudrate = 9600,
  parity = 'even',
  duplex = 'full',
})

port:flush()

addr = 0x01 -- short address
tariff = 0x02 -- selected tariff

data = { 0x53, addr, 0x51, 0x09, 0x7C, 0x01, 0x54, tariff }

len = #data

buf = { 0x68, len, len, 0x68 }
cs = 0

for _, char in ipairs(data) do
  buf[ #buf + 1 ] = char
  cs = cs + char
end

buf[ #buf + 1 ] = bit.band(cs, 0xFF)
buf[ #buf + 1 ] = 0x16

data = string.char(unpack(buf))

port:write(data)

res = port:read(1, 0.5)

if res then
  if res:byte(1) == 0xE5 then
    log('write ok')
  else
    log('reply error')
  end
else
  log('no reply')
end

port:close()



RE: Integrate Noark 1F electricity meter and write to M-Bus to change tariff - fleeceable - 19.10.2023

Thanks!
Gonna try it