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.

RS232
#1
Hello, 
I have a client who has a Homelynk on their installation running with LM5 firmware. 
Everything works perfectly except the RS232 port which is not recognized. 
Do you have a solution for this?" 

BR
Jean-Marc
Reply
#2
How did you test it?
------------------------------
Ctrl+F5
Reply
#3
Code:
-- Fonction pour vérifier si le port est libre (sans lsof)
function isPortFree()
  local test_port = serial.open('/dev/RS232', {
    baudrate = 1200,
    databits = 7,
    stopbits = 1,
    parity = 'even',
    duplex = 'half'
  })
 
  if test_port then
    test_port:close()
    log("Port libre")
    return true
  else
    log("Port occupé ou inaccessible")
    return false
  end
end

isPortFree()


And error log :
test le port rs232 11.06.2025 10:45:53
User script:3: attempt to index global 'serial' (a nil value)
stack traceback:
User script:3: in function 'isPortFree'
User script:21: in main chunk
Jean-Marc
Reply
#4
Actually this is correct. Hw is not the same as LM and this will not work.
------------------------------
Ctrl+F5
Reply
#5
OK thank Daniel.
Jean-Marc
Reply
#6
I think it will work if you add on top -> require('serial')
Code:
require('serial')
port = serial.open('/dev/RS232', {
  baudrate = 38400,
  databits = 8,
  stopbits = 1,
  parity = 'none',
  duplex = 'full'
})
Reply
#7
Hello,

Yes of course I just copied the function but require('serial') is present in the script
Jean-Marc
Reply


Forum Jump: