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.

Curtain Dooya dt82tv
#6
Attach an event script to a 4-bit object. A different command is sent depending on the input value (stop, up or down).
Code:
value = event.getvalue()

up = bit.band(value, 8) ~= 0
stop = bit.band(value, 7) == 0

if stop then
  command = string.char(0x55, 0x01, 0x01, 0x03, 0x03, 0x38, 0xC1)
elseif up then
  command = string.char(0x55, 0x01, 0x01, 0x03, 0x02, 0xF9, 0x01)
else
  command = string.char(0x55, 0x01, 0x01, 0x03, 0x01, 0xB9, 0x00)
end

require('serial')

port = serial.open('/dev/RS485-1', {
  baudrate = 9600,
  parity = 'even',
  duplex = 'half'
})

port:write(command)
Reply


Messages In This Thread
Curtain Dooya dt82tv - by Zhiger2003 - 02.02.2026, 12:14
RE: Curtain Dooya dt82tv - by Daniel - 02.02.2026, 12:57
RE: Curtain Dooya dt82tv - by admin - 02.02.2026, 13:01
RE: Curtain Dooya dt82tv - by Zhiger2003 - 04.02.2026, 04:42
RE: Curtain Dooya dt82tv - by AEK - 05.02.2026, 13:52
RE: Curtain Dooya dt82tv - by Daniel - 04.02.2026, 08:35
RE: Curtain Dooya dt82tv - by admin - 04.02.2026, 09:33

Forum Jump: