ToshibaCarrierHvac
This library can make Arduino/NodeMCU communicate with Toshiba/Carrier HVAC System via serial communication through wifi adapter port. You can use this library to implement the smart home system, control your HVAC remoteless via internet or LAN, automation, etc.
Tested working on:
- ESP8266
- ESP32
- ATmega328P (Arduino Uno R3, Arduino Nano)
Supported HVAC models:
- Toshiba Seiya
- Toshiba Shorai
- Carrier X Inverter (42TVAA)
And might support (not tested yet):
- Carrier Color Smart (42TVCA)
- Carrier X Inverter Plus (42TVAB)
Supported features:
- Power ("off", "on")
- Setpoint (17-30c)
- Mode ("auto", "cool", "heat", "dry", "fan_only")
- Fan mode ("quiet", "lvl_1", "lvl_2", "lvl_3", "lvl_4", "lvl_5", "auto")
- Swing (vertical) ("off", "on")
- Pure ("off", "on")
- Power select ("50%", "75%", "100%")
- Operation ("normal", "high_power", "silent_1", "eco", "silent_2")
- Room temperature
- Outside temperature
- On/off timer status ("off", "on")
- CDU status (run, stop)
Header & Connector pinout
See images here
Sample Circuit
Note: If using ESP8266 or ESP32 please always use with TTL level shifter (5V to 3.3V TTL)
How to use
1) Include library to your sketch
#include <ToshibaCarrierHvac.h>
2) Set port you want to use
- Hardware serial
ToshibaCarrierHvac hvac(&Serial);
- Software serial
ToshibaCarrierHvac hvac(D5, D6); // RX, TX
3) Add handleHvac to loop
void loop() {
hvac.handleHvac();
}
Global data structures
- Settings structure
struct hvacSettings {
const char* state;
uint8_t setpoint;
const char* mode;
const char* swing;
const char* fanMode;
const char* pure;
const char* powerSelect;
const char* operation;
};
- Status structure
struct hvacStatus {
int8_t roomTemperature;
int8_t outsideTemperature;
const char* offTimer;
const char* onTimer;
bool running;
};
Functions
- Get all current status from structure
hvacStatus newStatus = hvac.getStatus;
- Get all current settings from structure
hvacSettings newSettings = hvac.getSettings;
- Get only one function
hvac.getState();
hvac.getSetpoint();
hvac.getMode();
hvac.getFanMode();
hvac.getSwing();
hvac.getPure();
hvac.getOffTimer();
hvac.getOnTimer();
hvac.getPowerSelect();
hvac.getOperation();
- Apply a preset
hvacSettings myPreset {
"on", // State ["off", "on"]
25, // Setpoint [16-30c]
"cool", // Mode ["auto", "cool", "heat", "dry", "fan_only"]
"on", // Swing ["off", "on"]
"lvl_3", // Fan mode ["quiet", "lvl_1", "lvl_2", "lvl_3", "lvl_4", "lvlL_5", "auto"]
"off", // Pure ["off", "on"]
"100%", // Power select ["50%", "75%", "100%"]
"normal" // Operation ["normal", "high_power", "silent_1", "eco", "silent_2"]
};
hvac.applyPreset(myPreset);
- Set only one function
hvac.setState("on");
hvac.setSetpoint(25);
hvac.setMode("cool");
hvac.setfanMode("lvl_3");
hvac.setSwing("off");
hvac.setPure("on");
hvac.setPowerSelect("100%");
hvac.setOperation("normal");
- Boolean status (true or false)
hvac.isConnected();
hvac.isCduRunning();
Callback Functions
Set your callback function in setup. See more example in UseCallback.ino
void hvacCallback(hvacStatus newStatus) {
if (newStatus.roomTemperature > 30) hvac.setState("on");
}
void setup() {
hvac.setStatusUpdatedCallback(hvacCallback);
}
Status Updated Callback
This will callback when any status updated and return structure of current status (acStatus).
hvac.setStatusUpdatedCallback(YourCallbackFunction);
Settings Updated Callback
This will callback when any setting updated and return structure of current settings (acSettings).
hvac.setSettingsUpdatedCallback(YourCallbackFunction);
Update Callback
This will callback when any status or any settings updated but doesn't return anything.
hvac.setUpdateCallback(YourCallbackFunction);
Which Function Updated Callback
This will callback when any status or any setting updated and return name of updated function.
hvac.setWhichFunctionUpdatedCallback(YourCallbackFunction);
Send custom packet
The custom packet size must be 8 to 17 bytes. This function just send your packet without checking anything so please carefully use.
byte myPacket[] = {2, 0, 3, 144, 0, 0, 9, 1, 48, 1, 0, 0, 0, 2, 163, 65, 76};
hvac.sendCustomPacket(myPacket, sizeof(myPacket));
TO DO:
- Send custom packet
- Callback function for debug