Skip to content

Commit

Permalink
Merge pull request #168 from IgorYbema/master
Browse files Browse the repository at this point in the history
release version 0.9b
  • Loading branch information
Egyras authored Oct 16, 2020
2 parents 1cec5b5 + 5a35168 commit c083772
Show file tree
Hide file tree
Showing 18 changed files with 949 additions and 569 deletions.
5 changes: 3 additions & 2 deletions HeatPumpType.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@ Assuming that bytes from #129 to #138 are the unique for each type of Heat pump:

| Value | Bytes 129 - 138 | IDU | ODU | KIT | Power [kW] | 1ph/3ph | T-CAP/HP |
| ---| --- | --- | --- | --- | --- | --- | ---|
| 0 | E2 CF 0B 13 33 32 D1 0C 16 33 | Monoblock | Mooblock | WH-MDC05H3E5 | 5 | 1ph | HP |
| 1 | E2 CF 0B 14 33 42 D1 0B 17 33 | Monoblock | Mooblock | WH-MDC07H3E5 | 7 | 1ph | HP |
| 0 | E2 CF 0B 13 33 32 D1 0C 16 33 | Monoblock | Monoblock | WH-MDC05H3E5 | 5 | 1ph | HP |
| 1 | E2 CF 0B 14 33 42 D1 0B 17 33 | Monoblock | Monoblock | WH-MDC07H3E5 | 7 | 1ph | HP |
| 2 | E2 CF 0D 77 09 12 D0 0B 05 11 | WH-SXC09H3E5 | WH-UX09HE5 | WXC09H3E5 | 9 | 1ph | T-CAP |
| 3 | E2 CF 0C 88 05 12 D0 0B 97 05 | WH-SDC09H3E8 | WH-UD09HE8 | WC09H3E8 | 9 | 3ph | HP |
| 4 | E2 CF 0D 85 05 12 D0 0C 94 05 | WH-SXC09H3E8 | WH-UX09HE8 | WXC09H9E8 | 9 | 3ph | T-CAP |
| 5 | E2 CF 0D 86 05 12 D0 0C 95 05 | WH-SXC12H9E8 | WH-UX12HE8 | WXC12H9E8 | 12 | 3ph | T-CAP |
| 6 | E2 CF 0D 87 05 12 D0 0C 96 05 | WH-SXC16H9E8 | WH-UX16HE8 | WXC16H9E8 | 16 | 3ph | T-CAP |
| 7 | E2 CE 0D 71 81 72 CE 0C 92 81 | WH-SDC05H3E5 | WH-UD05HE5 | WC05H3E5 | 5 | 1ph | HP |
| 8 | 62 D2 0B 43 54 42 D2 0B 72 66 | WH-SDC0709J3E5 | WH-UD09JE5 | WC09J3E5 | 9 | 1ph | HP |
| 9 | C2 D3 0B 33 65 B2 D3 0B 94 65 | Monobblock | MonoBlock | WH-MDC05J3E5 | 5 | 1ph | HP |


Byte 132 is taken for Heat Pump model.
Expand Down
Binary file added HeishaMon v3.1 case.stl
Binary file not shown.
185 changes: 103 additions & 82 deletions HeishaMon/HeishaMon.ino

Large diffs are not rendered by default.

112 changes: 103 additions & 9 deletions HeishaMon/commands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,18 @@

//removed checksum from default query, is calculated in send_command
byte panasonicQuery[] = {0x71, 0x6c, 0x01, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
byte optionalPCBQuery[] = {0xF1, 0x11, 0x01, 0x50, 0x00, 0x00, 0x40, 0xFF, 0xFF, 0xE5, 0xFF, 0xFF, 0x00, 0xFF, 0xEB, 0xFF, 0xFF, 0x00, 0x00};

char mqtt_topic_base[40] = "panasonic_heat_pump";

const char* mqtt_topic_values = "sdc";
const char* mqtt_topic_1wire = "1wire";
const char* mqtt_topic_s0 = "s0";
const char* mqtt_logtopic = "log";
const char* mqtt_topic_pcb = "pcb/#";


const char* mqtt_willtopic = "LWT";
const char* mqtt_iptopic = "ip";

const char* mqtt_set_heatpump_state_topic = "SetHeatpump";
const char* mqtt_set_quiet_mode_topic = "SetQuietMode";
Expand All @@ -26,8 +29,11 @@ const char* mqtt_set_holiday_topic = "SetHolidayMode";
const char* mqtt_set_powerful_topic = "SetPowerfulMode";
const char* mqtt_set_dhw_temp_topic = "SetDHWTemp";
const char* mqtt_send_raw_value_topic = "SendRawValue";
const char* mqtt_set_pump_topic = "SetPump";
const char* mqtt_set_pumpspeed_topic = "SetPumpSpeed";


void send_heatpump_command(char* topic, char *msg,bool (*send_command)(byte*, int),void (*log_message)(char*)){
void send_heatpump_command(char* topic, char *msg, bool (*send_command)(byte*, int), void (*log_message)(char*)) {
char log_msg[256];

// set heatpump state to on by sending 1
Expand All @@ -36,13 +42,36 @@ void send_heatpump_command(char* topic, char *msg,bool (*send_command)(byte*, in
String set_heatpump_state_string(msg);
byte heatpump_state = 1;
if ( set_heatpump_state_string.toInt() == 1 ) {
heatpump_state = 2;
heatpump_state = 2;
}
sprintf(log_msg, "set heatpump state to %d", heatpump_state); log_message(log_msg);
byte command[] = {0xf1, 0x6c, 0x01, 0x10, heatpump_state, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
send_command(command, sizeof(command));
}


// set pump state to on by sending 1
if (strcmp(topic, mqtt_set_pump_topic) == 0)
{
String set_pump_string(msg);
byte pump_state = 16;
if ( set_pump_string.toInt() == 1 ) {
pump_state = 32;
}
sprintf(log_msg, "set pump state to %d", pump_state); log_message(log_msg);
byte command[] = {0xf1, 0x6c, 0x01, 0x10, pump_state, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
send_command(command, sizeof(command));
}

// set pump speed
if (strcmp(topic, mqtt_set_pumpspeed_topic) == 0)
{
String set_pumpspeed_string(msg);
byte pumpspeed = set_pumpspeed_string.toInt() + 1;
sprintf(log_msg, "set pump speed to %d", pumpspeed - 1); log_message(log_msg);
byte command[] = {0xf1, 0x6c, 0x01, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, pumpspeed, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
send_command(command, sizeof(command));
}

// set 0 for Off mode, set 1 for Quiet mode 1, set 2 for Quiet mode 2, set 3 for Quiet mode 3
if (strcmp(topic, mqtt_set_quiet_mode_topic) == 0)
{
Expand All @@ -53,7 +82,7 @@ void send_heatpump_command(char* topic, char *msg,bool (*send_command)(byte*, in
byte command[] = {0xf1, 0x6c, 0x01, 0x10, 0x00, 0x00, 0x00, quiet_mode, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
send_command(command, sizeof(command));
}

// z1 heat request temp - set from -5 to 5 to get same temperature shift point or set direct temp
if (strcmp(topic, mqtt_set_z1_heat_request_temperature_topic) == 0)
{
Expand All @@ -74,7 +103,7 @@ void send_heatpump_command(char* topic, char *msg,bool (*send_command)(byte*, in
sprintf(log_msg, "set z1 cool request temperature to %d", request_temp - 128 ); log_message(log_msg);
byte command[] = {0xf1, 0x6c, 0x01, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, request_temp, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
send_command(command, sizeof(command));
}
}

// z2 heat request temp - set from -5 to 5 to get same temperature shift point or set direct temp
if (strcmp(topic, mqtt_set_z2_heat_request_temperature_topic) == 0)
Expand All @@ -96,8 +125,8 @@ void send_heatpump_command(char* topic, char *msg,bool (*send_command)(byte*, in
sprintf(log_msg, "set z2 cool request temperature to %d", request_temp - 128 ); log_message(log_msg);
byte command[] = {0xf1, 0x6c, 0x01, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, request_temp, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
send_command(command, sizeof(command));
}
}

// set mode to force DHW by sending 1
if (strcmp(topic, mqtt_set_force_DHW_topic) == 0)
{
Expand Down Expand Up @@ -195,7 +224,72 @@ void send_heatpump_command(char* topic, char *msg,bool (*send_command)(byte*, in
byte command[] = {0xf1, 0x6c, 0x01, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, set_DHW_temp, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
send_command(command, sizeof(command));
}
}


void set_optionalpcb(char* topic, char *msg, void (*log_message)(char*)) {
for (int i = 0 ; i < NUMBER_OF_OPTIONALPCB_TOPICS ; i++) {
if (strcmp(topic, optionalPcbTopics[i]) == 0) {
char log_msg[256];
String set_pcb_string(msg);
if (strstr(topic, "Temp")) {
float temp = set_pcb_string.toFloat();
float hextemp;
if (temp > 120) {
hextemp = 0;
} else if (temp < -78) {
hextemp = 255;
}
else {
byte Uref = 255;
int constant = 3695;
int R25 = 6340;
byte T25 = 25;
int Rf = 6480;
float K = 273.15;
float RT = R25 * exp(constant * (1 / (temp + K) - 1 / (T25 + K)));
hextemp = Uref * (RT / (Rf + RT));
}
optionalPCBQuery[optionalPcbBytes[i]] = (int)hextemp;
sprintf(log_msg, "set optional pcb %s to temp %.2f, hextemp DEC %.2f = HEX %x", optionalPcbTopics[i], temp, hextemp, (int)hextemp); log_message(log_msg);
}
else if (strcmp(topic, "Heat_Cool_Mode") == 0) {
bool set_pcb_value = (set_pcb_string.toInt() == 1);
optionalPCBQuery[optionalPcbBytes[i]] = (optionalPCBQuery[optionalPcbBytes[i]] & ~(0b1 << 7)) | ( set_pcb_value << 7 );
sprintf(log_msg, "set optional pcb %s to %d", optionalPcbTopics[i], set_pcb_value); log_message(log_msg);
}
else if (strcmp(topic, "Compressor_State") == 0) {
bool set_pcb_value = (set_pcb_string.toInt() == 1);
optionalPCBQuery[optionalPcbBytes[i]] = (optionalPCBQuery[optionalPcbBytes[i]] & ~(0b1 << 6)) | ( set_pcb_value << 6 );
sprintf(log_msg, "set optional pcb %s to %d", optionalPcbTopics[i], set_pcb_value); log_message(log_msg);
}
else if (strcmp(topic, "SmartGrid_Mode") == 0) {
byte set_pcb_value = set_pcb_string.toInt();
if ((set_pcb_value >=0) && (set_pcb_value < 4)) {
optionalPCBQuery[optionalPcbBytes[i]] = (optionalPCBQuery[optionalPcbBytes[i]] & ~(0b11 << 4)) | ( set_pcb_value << 4 );
sprintf(log_msg, "set optional pcb %s to %d", optionalPcbTopics[i], set_pcb_value, optionalPCBQuery[optionalPcbBytes[i]]); log_message(log_msg);
}
}
else if (strcmp(topic, "External_Thermostat_1_State") == 0) {
byte set_pcb_value = set_pcb_string.toInt();
if ((set_pcb_value >=0) && (set_pcb_value < 4)) {
optionalPCBQuery[optionalPcbBytes[i]] = (optionalPCBQuery[optionalPcbBytes[i]] & ~(0b11 << 2)) | ( set_pcb_value << 2 );
sprintf(log_msg, "set optional pcb %s to %d", optionalPcbTopics[i], set_pcb_value, optionalPCBQuery[optionalPcbBytes[i]]); log_message(log_msg);
}

}
else if (strcmp(topic, "External_Thermostat_2_State") == 0) {
byte set_pcb_value = set_pcb_string.toInt();
if ((set_pcb_value >=0) && (set_pcb_value < 4)) {
optionalPCBQuery[optionalPcbBytes[i]] = (optionalPCBQuery[optionalPcbBytes[i]] & ~(0b11 << 0)) | ( set_pcb_value << 0 );
sprintf(log_msg, "set optional pcb %s to %d", optionalPcbTopics[i], set_pcb_value, optionalPCBQuery[optionalPcbBytes[i]]); log_message(log_msg);
}
}
else {
byte set_pcb_value = set_pcb_string.toInt();
optionalPCBQuery[optionalPcbBytes[i]] = set_pcb_value;
sprintf(log_msg, "set optional pcb %s to %s", optionalPcbTopics[i], msg); log_message(log_msg);
}

}
}
}
42 changes: 41 additions & 1 deletion HeishaMon/commands.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,49 @@
#define PANASONICQUERYSIZE 110
extern byte panasonicQuery[PANASONICQUERYSIZE];

extern char mqtt_topic_base[40];
#define OPTIONALPCBQUERYSIZE 19
extern byte optionalPCBQuery[OPTIONALPCBQUERYSIZE];
#define NUMBER_OF_OPTIONALPCB_TOPICS 13

static const char * optionalPcbTopics[] = {
"Heat_Cool_Mode",
"Compressor_State",
"SmartGrid_Mode",
"External_Thermostat_1_State",
"External_Thermostat_2_State",
"Demand_Control",
"Pool_Temp",
"Buffer_Temp",
"Z1_Room_Temp",
"Z1_Water_Temp",
"Z2_Room_Temp",
"Z2_Water_Temp",
"Solar_Temp"
};

static const byte optionalPcbBytes[] = {
6,
6,
6,
6,
6,
14,
7,
8,
10,
16,
11,
15,
13
};

extern const char* mqtt_topic_values;
extern const char* mqtt_topic_1wire;
extern const char* mqtt_topic_s0;
extern const char* mqtt_topic_pcb;
extern const char* mqtt_logtopic;
extern const char* mqtt_willtopic;
extern const char* mqtt_iptopic;
extern const char* mqtt_set_heatpump_state_topic;
extern const char* mqtt_set_quiet_mode_topic;
extern const char* mqtt_set_z1_heat_request_temperature_topic;
Expand All @@ -24,5 +61,8 @@ extern const char* mqtt_set_holiday_topic;
extern const char* mqtt_set_powerful_topic;
extern const char* mqtt_set_dhw_temp_topic;
extern const char* mqtt_send_raw_value_topic;
extern const char* mqtt_set_pump_topic;
extern const char* mqtt_set_pumpspeed_topic;

void send_heatpump_command(char* topic, char *msg,bool (*send_command)(byte*, int),void (*log_message)(char*));
void set_optionalpcb(char* topic, char *msg,void (*log_message)(char*));
7 changes: 4 additions & 3 deletions HeishaMon/decode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

unsigned long nextalldatatime = 0;


String getBit1and2(byte input) {
return String((input >> 6)-1);
}
Expand Down Expand Up @@ -106,6 +105,8 @@ String getModel(byte input) {
return "7";
case 67:
return "8";
case 51:
return "9";
default:
return "-1";
}
Expand Down Expand Up @@ -143,14 +144,14 @@ String getErrorInfo(char* data){ // TOP44 //
}

// Decode ////////////////////////////////////////////////////////////////////////////
void decode_heatpump_data(char* data, String actData[], PubSubClient &mqtt_client, void (*log_message)(char*)) {
void decode_heatpump_data(char* data, String actData[], PubSubClient &mqtt_client, void (*log_message)(char*), char* mqtt_topic_base, unsigned int updateAllTime) {
char log_msg[256];
char mqtt_topic[256];
bool updatenow = false;

if (millis() > nextalldatatime) {
updatenow = true;
nextalldatatime = millis() + UPDATEALLTIME;
nextalldatatime = millis() + (1000 * updateAllTime);
}

for (unsigned int Topic_Number = 0 ; Topic_Number < NUMBER_OF_TOPICS ; Topic_Number++) {
Expand Down
Loading

0 comments on commit c083772

Please sign in to comment.