Air conditioner driver (Haier IR-over-UART protocol), channel type CH_AC = 10.
More...
|
| | out_AC () |
| | Default constructor; binds nothing until link() is called.
|
| void | link (Item *_item) |
| | Links the channel item, attaches persistent storage and reads the config.
|
| void | getConfig () |
| | Reads itemArg and selects the UART port (0-3) for the AC line.
|
| int | Setup () override |
| | Initializes persistent storage and starts the UART at 9600 baud.
|
| int | Poll (short cause) override |
| | Polls the AC every 5 s, parses the 37-byte status frame and publishes the status topics.
|
| int | Stop () override |
| | Releases the persistent storage and marks the channel as unknown.
|
| int | isActive () override |
| | Returns 1 if the AC power bit is set, 0 otherwise.
|
| int | getChanType () override |
| | Returns CH_THERMO (5).
|
| int | Ctrl (itemCmd cmd, char *subItem=NULL, bool toExecute=true, bool authorized=false) override |
| | Applies a control command: /set, /cmd, /fan, /mode, and lock/swing/queit/raw subitems (see class doc).
|
| void | SubmitParameters (const char *name, itemCmd value) |
| | Invokes the named callback object ("fan"/"set"/"cmd"/"temp") from itemArg with a polled value.
|
| | abstractOut () |
| virtual bool | isAllowed (itemCmd cmd) |
| virtual itemCmd | getDefaultOnVal () |
| virtual int | Status () override |
| virtual void | setStatus (uint8_t status) override |
| Item * | getItem () |
| | abstractCh () |
| virtual | ~abstractCh () |
Air conditioner driver (Haier IR-over-UART protocol), channel type CH_AC = 10.
Talks to a Haier AC over UART at 9600 baud using 13-byte request frames and 37-byte status frames (frame check = sum of bytes). Periodically polls the AC unit and applies control commands.
JSON config (itemArg): [portNum(0-3), callbacksObj]
- portNum: 0 = default port (Serial3, or USB-CDC Serial), 1..3 = Serial1..Serial3;
- callbacksObj (optional): object with keys "fan", "set", "cmd", "temp" holding execution objects invoked on every polled status update.
Ctrl commands:
- /set 16-40 - set temperature;
- /cmd - AUTO / HEAT / COOL / FAN_ONLY / DRY, plus ON / OFF;
- /fan - LOW / MEDIUM / HIGH / AUTO / OFF, or a 0-255 value;
- /mode <number> - raw mode code;
- subitems: "lock" ON/OFF, "swing" ON/OFF, "queit" (sic) ON/OFF, "raw".
Published status topics: /set, /temp, /mode, /cmd, /fan, /fresh, /lock, /quiet, /compressor, /swing.