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.

Read (dutch) smart meter with ser2net
#1
I want to read the dutch smart meter, the p1 meter script is perfect for that. 
but the only thing is the my LM is not near the smart meter.

I have a raspberry-pi next to the smartmeter with ser2net installed. how can I change this part of the script to use the ser2net?
Code:
lastchar = '!'

require('serial')
port = serial.open('/dev/ttyUSB0', { -- Let op type van de slimme meter voor de onderstaande instellingen.
  baudrate = 9600,             --DSMR 2/3 = 9600        DSMR 4 = 115200
  databits = 7,                    --DSMR 2/3 = 7            DSMR 4 = 8
  stopbits = 1,                    --DSMR 2/3 = 1            DSMR 4 = 1
  parity = 'even',            --DSMR 2/3 = even        DSMR 4 = none
  duplex = 'full'
})


function readdata(port)
  local char, buf

  buf = {}

  while true do
    char = port:read(1)
    -- error (timeout) or newline, stop
    if char == nil or char == lastchar then
      break
    -- ignore cr char
    elseif char ~= '\r' then
      table.insert(buf, char)
    end
  end

  return table.concat(buf)
end

data = readdata(port)
port:flush()

---------------------------------------------------------------
Thanks,

Mischa
Reply


Messages In This Thread
Read (dutch) smart meter with ser2net - by mischa - 02.05.2020, 18:17

Forum Jump: