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.

Haier air conditioner
#1
Hello, everyone.

I have a Haier air conditioner that I want to control through its RS 232 port. I found a description of how to make an MQTT device with an ESP 8266, but I don't want it to go over wifi. I can't convert RS 232 commands myself so please help. I am attaching the code with the commands for arduino, how to convert them for LM to reduce Wi-Fi devices. Please if anyone can and has the necessary time - I would be grateful for any help.

GitHub
Reply
#2
It won't work directly via RS232. You will need RS232 - TTL 5V converter and some soldering as the AC uses USB port for serial communication.
The command format is described here: https://blog-instalator-ru.translate.goo...r_pto=wapp
Reply
#3
(21.12.2022, 09:57)admin Wrote: It won't work directly via RS232. You will need RS232 - TTL 5V converter and some soldering as the AC uses USB port for serial communication.
The command format is described here: https://blog-instalator-ru.translate.goo...r_pto=wapp

Yes, that's clear, but I wanted to use the LM directly with a USB to TTL converter.
Reply
#4
Example of sending data packets:
Code:
port = require('serial').open('/dev/ttyUSB0', { baudrate = 9600 })

function send(...)
  local data = string.char(...)
  local len = #data + 1
  local hdr = string.char(0xFF, 0xFF, len)
  local csum = len

  for _, byte in ipairs({ ... }) do
    csum = bit.band(csum + byte, 0xFF)
  end

  local pkt = hdr .. data .. string.char(csum)
  port:write(pkt)
end

send(0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x4D, 0x02) -- turn on
send(0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x4D, 0x03) -- turn off
send(0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x4D, 0x01) -- request state
Reply
#5
Thank you so much! I'll try these days that I'm not at the air conditioner right now.

As always great admin!
Merry Christmas and New Year holidays!
Reply


Forum Jump: