Here the main HVAC_status object that containts all properties (even those I not understood...)
struct HVAC_status { word power; //power (on, off) word op_mode; //mode (auto, hot, dry, cool, fan) word fan_speed; //fan speed (auto, high, medium, low, silent) word temperature; //temperature (16~32°C) word param_6; // ? word param_11; // ? word param_12; // ? word swing_mode; //swing mode (on, off) word room_temp; //room temperature word param_102; // ? word param_201; // ? // word param_300; // ? word param_301; // ? word param_302; // ? // word param_304; // ? // word param_800; // ? // word param_900; // ? } Hitachi_status;
Here the mode list and fan_list table.
const char mode_list[10][10] = {
{"off"}, //0x0000
{"heat"}, //0x0010
{"dry"}, //0x0020
{"-"},
{"cool"}, //0x0040
{"fan_only"}, //0x0050
// {"auto"}, //0x8000
{"auto_heat"}, //0x8010
{"auto_dry"}, //0x8020
{"-"},
{"auto_cool"}, //0x8040
};
const char fan_list[5][7] = {
{"auto"}, //0x00
{"high"}, //0x01
{"medium"}, //0x02
{"low"}, //0x03
{"silent"}, //0x04
};
I add 2 timers to trigger :
- HVAC write/scan : write to HVAC if neede or ask for status
- Send MQTT to HomeAssistant
/********************* Function management *****************/
if (millis()-scan_timer_counter > scan_timer) {
scan_timer_counter = millis();
if(things_to_write){ // write to HVAC id request by callback
set_HVAC(0x0800,0x07, false); // Enter setup mode
set_HVAC(address_list[1], Hitachi_status.op_mode, true); // Op mode
set_HVAC(0x0300,0x0000, true); // Unknow
set_HVAC(address_list[3], Hitachi_status.temperature, true);// desired temp
set_HVAC(address_list[1], Hitachi_status.op_mode, true); // Op mode
set_HVAC(0x0300,0x0000, true); // Unknow
set_HVAC(address_list[3], Hitachi_status.temperature, true);// desired temp
set_HVAC(address_list[2], Hitachi_status.fan_speed, false); // fan speed
set_HVAC(address_list[4], Hitachi_status.swing_mode, false);// swing mode
set_HVAC(address_list[0], Hitachi_status.power, false); // power
set_HVAC(0x0006,0x00, false); // Unknow
set_HVAC(0x0007,0x00, false); // Unknow
things_to_write = false; // done
delay(500); // wait a while before send status
request_HVAC_status(); // read status
Send_fct(); // send status to HA
} else { // read from HVAC en send if needed
request_HVAC_status();
if (need_to_send_MQTT) Send_fct(); // send status to HA
need_to_send_MQTT = false;
}
}
/********************** Function send **********************/
if (millis()-send_timer_counter > send_timer) {
send_timer_counter = millis();
Send_fct(); // send status to HA
}
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.