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.

Sauna RS485 connection with LM
#7
Hi.

I get response timeout when running this script in wiser knx. is there any difference for RS-485 port?

I´ve tested this script over here and also with
This:
Code:
require('serial') local port, errorMsg = serial.open('/dev/RS485', { baudrate = 57600, parity = 'none', duplex = 'half', databits = 8, stopbits = 1 }) -- Kontrollera om porten öppnades framgångsrikt if not port then     log("Kunde inte öppna porten: " .. (errorMsg or "Okänt fel"))     return end port:flush() -- Funktion för att läsa svar från bastun local function readack()   local line = {}   while true do     local char, err = port:read(1, 5)     if char == nil then       return nil, err     elseif char == ';' then       break     else       table.insert(line, char)     end   end   return table.concat(line) end -- Kontrollera om bastun ska vara PÅ eller AV local bastuState = grp.getvalue('37/1/1') if bastuState then     port:write('set sauna on\r') else     port:write('set sauna off\r') end -- Ställ in bastutemperaturen baserat på KNX-gruppadressen, värde mellan 30-110 grader local temperature = grp.getvalue('37/1/3') port:write('set sauna val ' .. temperature .. '\r') -- Läs tillbaka värdet från bastun port:write('get sauna val\r') local res, err = readack() if res then     log("Sauna värde: " .. res)     grp.checkwrite('37/1/0', res)  -- Skriver bastustatus till angiven adress     grp.checkwrite('37/1/4', res)  -- Skriver tillbaka temperaturstatus till den nya gruppadressen else     log("Fel vid läsning av bastu värde: " .. (err or "Okänt fel")) end -- Stäng porten port:close()
Anone who can see something wrong in this script?
Reply


Messages In This Thread
RE: Sauna RS485 connection with LM - by admin - 09.11.2018, 08:32
RE: Sauna RS485 connection with LM - by admin - 09.11.2018, 09:46
RE: Sauna RS485 connection with LM - by victor.back - 06.10.2023, 12:15
RE: Sauna RS485 connection with LM - by admin - 06.10.2023, 12:43
RE: Sauna RS485 connection with LM - by admin - 13.12.2023, 08:31
RE: Sauna RS485 connection with LM - by admin - 13.12.2023, 08:39
RE: Sauna RS485 connection with LM - by admin - 13.12.2023, 11:19

Forum Jump: