Reduce some code lines

This commit is contained in:
ElVit
2025-07-18 15:36:21 +02:00
parent fbe604523a
commit 6cbbebc6f9
8 changed files with 4 additions and 509 deletions
@@ -21,143 +21,97 @@ namespace esphome
switch (this->id_)
{
case BinarySensorIds::CONF_TOP0:
{
new_state = PanasonicDecode::getBinaryState(PanasonicDecode::getBit7and8(data[4]));
if (this->has_state() && this->state == new_state) return;
break;
}
case BinarySensorIds::CONF_TOP2:
{
new_state = PanasonicDecode::getBinaryState(PanasonicDecode::getBit1and2(data[4]));
if (this->has_state() && this->state == new_state) return;
break;
}
case BinarySensorIds::CONF_TOP3:
{
new_state = PanasonicDecode::getBinaryState(PanasonicDecode::getBit1and2(data[7]));
if (this->has_state() && this->state == new_state) return;
break;
}
case BinarySensorIds::CONF_TOP13:
{
new_state = PanasonicDecode::getBinaryState(PanasonicDecode::getBit1and2(data[5]));
if (this->has_state() && this->state == new_state) return;
break;
}
case BinarySensorIds::CONF_TOP26:
{
new_state = PanasonicDecode::getBinaryState(PanasonicDecode::getBit5and6(data[111]));
if (this->has_state() && this->state == new_state) return;
break;
}
case BinarySensorIds::CONF_TOP60:
{
new_state = PanasonicDecode::getBinaryState(PanasonicDecode::getBit7and8(data[112]));
if (this->has_state() && this->state == new_state) return;
break;
}
case BinarySensorIds::CONF_TOP61:
{
new_state = PanasonicDecode::getBinaryState(PanasonicDecode::getBit5and6(data[112]));
if (this->has_state() && this->state == new_state) return;
break;
}
case BinarySensorIds::CONF_TOP68:
{
new_state = PanasonicDecode::getBinaryState(PanasonicDecode::getBit5and6(data[5]));
if (this->has_state() && this->state == new_state) return;
break;
}
case BinarySensorIds::CONF_TOP69:
{
new_state = PanasonicDecode::getBinaryState(PanasonicDecode::getBit5and6(data[117]));
if (this->has_state() && this->state == new_state) return;
break;
}
case BinarySensorIds::CONF_TOP99:
{
new_state = PanasonicDecode::getBinaryState(PanasonicDecode::getBit5and6(data[24]));
if (this->has_state() && this->state == new_state) return;
break;
}
case BinarySensorIds::CONF_TOP100:
{
new_state = PanasonicDecode::getBinaryState(PanasonicDecode::getBit7and8(data[24]));
if (this->has_state() && this->state == new_state) return;
break;
}
case BinarySensorIds::CONF_TOP108:
{
new_state = PanasonicDecode::getBinaryState(PanasonicDecode::getBit3and4(data[20]));
if (this->has_state() && this->state == new_state) return;
break;
}
case BinarySensorIds::CONF_TOP109:
{
new_state = PanasonicDecode::getBinaryState(PanasonicDecode::getBit5and6(data[20]));
if (this->has_state() && this->state == new_state) return;
break;
}
case BinarySensorIds::CONF_TOP110:
{
new_state = PanasonicDecode::getBinaryState(PanasonicDecode::getBit7and8(data[20]));
if (this->has_state() && this->state == new_state) return;
break;
}
case BinarySensorIds::CONF_TOP119:
{
new_state = PanasonicDecode::getBinaryState(PanasonicDecode::getBit7and8(data[23]));
if (this->has_state() && this->state == new_state) return;
break;
}
case BinarySensorIds::CONF_TOP120:
{
new_state = PanasonicDecode::getBinaryState(PanasonicDecode::getBit5and6(data[23]));
if (this->has_state() && this->state == new_state) return;
break;
}
case BinarySensorIds::CONF_TOP121:
{
new_state = PanasonicDecode::getBinaryState(PanasonicDecode::getBit3and4(data[23]));
if (this->has_state() && this->state == new_state) return;
break;
}
case BinarySensorIds::CONF_TOP122:
{
new_state = PanasonicDecode::getBinaryState(PanasonicDecode::getBit1and2(data[23]));
if (this->has_state() && this->state == new_state) return;
break;
}
case BinarySensorIds::CONF_TOP123:
{
new_state = PanasonicDecode::getBinaryState(PanasonicDecode::getBit1and2(data[116]));
if (this->has_state() && this->state == new_state) return;
break;
}
case BinarySensorIds::CONF_TOP124:
{
new_state = PanasonicDecode::getBinaryState(PanasonicDecode::getBit3and4(data[116]));
if (this->has_state() && this->state == new_state) return;
break;
}
case BinarySensorIds::CONF_TOP129:
{
new_state = PanasonicDecode::getBinaryState(PanasonicDecode::getBit7and8(data[26]));
if (this->has_state() && this->state == new_state) return;
break;
}
case BinarySensorIds::CONF_TOP132:
{
new_state = PanasonicDecode::getBinaryState(PanasonicDecode::getBit3and4(data[26]));
if (this->has_state() && this->state == new_state) return;
break;
}
case BinarySensorIds::CONF_TOP133:
{
new_state = PanasonicDecode::getBinaryState(PanasonicDecode::getBit1and2(data[26]));
if (this->has_state() && this->state == new_state) return;
break;
}
default: return;
};
@@ -20,7 +20,7 @@ namespace esphome
//traits.set_supports_action(true);
traits.set_supports_current_temperature(true);
if (this->cool_mode_ &&
(this->id_ == ClimateIds::CONF_CLIMATE_ZONE1 ||
(this->id_ == ClimateIds::CONF_CLIMATE_ZONE1 ||
this->id_ == ClimateIds::CONF_CLIMATE_ZONE2))
{
traits.set_supports_two_point_target_temperature(true);
@@ -18,172 +18,107 @@ namespace esphome
switch (this->id_)
{
case NumberIds::CONF_SET5:
{
this->parent_->set_command_byte(PanasonicCommand::setPlus128(value), 38);
break;
}
case NumberIds::CONF_SET6:
{
this->parent_->set_command_byte(PanasonicCommand::setPlus128(value), 39);
break;
}
case NumberIds::CONF_SET7:
{
this->parent_->set_command_byte(PanasonicCommand::setPlus128(value), 40);
break;
}
case NumberIds::CONF_SET8:
{
this->parent_->set_command_byte(PanasonicCommand::setPlus128(value), 41);
break;
}
case NumberIds::CONF_SET11:
{
this->parent_->set_command_byte(PanasonicCommand::setPlus128(value), 42);
break;
}
case NumberIds::CONF_SET15:
{
this->parent_->set_command_byte(PanasonicCommand::setPlus1(value), 45);
break;
}
case NumberIds::CONF_SET16_01:
{
this->parent_->set_command_curve(PanasonicCommand::setPlus128(value), 75);
break;
}
case NumberIds::CONF_SET16_02:
{
this->parent_->set_command_curve(PanasonicCommand::setPlus128(value), 76);
break;
}
case NumberIds::CONF_SET16_03:
{
this->parent_->set_command_curve(PanasonicCommand::setPlus128(value), 77);
break;
}
case NumberIds::CONF_SET16_04:
{
this->parent_->set_command_curve(PanasonicCommand::setPlus128(value), 78);
break;
}
case NumberIds::CONF_SET16_05:
{
this->parent_->set_command_curve(PanasonicCommand::setPlus128(value), 79);
break;
}
case NumberIds::CONF_SET16_06:
{
this->parent_->set_command_curve(PanasonicCommand::setPlus128(value), 80);
break;
}
case NumberIds::CONF_SET16_07:
{
this->parent_->set_command_curve(PanasonicCommand::setPlus128(value), 81);
break;
}
case NumberIds::CONF_SET16_08:
{
this->parent_->set_command_curve(PanasonicCommand::setPlus128(value), 82);
break;
}
case NumberIds::CONF_SET16_09:
{
this->parent_->set_command_curve(PanasonicCommand::setPlus128(value), 86);
break;
}
case NumberIds::CONF_SET16_10:
{
this->parent_->set_command_curve(PanasonicCommand::setPlus128(value), 87);
break;
}
case NumberIds::CONF_SET16_11:
{
this->parent_->set_command_curve(PanasonicCommand::setPlus128(value), 88);
break;
}
case NumberIds::CONF_SET16_12:
{
this->parent_->set_command_curve(PanasonicCommand::setPlus128(value), 89);
break;
}
case NumberIds::CONF_SET16_13:
{
this->parent_->set_command_curve(PanasonicCommand::setPlus128(value), 90);
break;
}
case NumberIds::CONF_SET16_14:
{
this->parent_->set_command_curve(PanasonicCommand::setPlus128(value), 91);
break;
}
case NumberIds::CONF_SET16_15:
{
this->parent_->set_command_curve(PanasonicCommand::setPlus128(value), 92);
break;
}
case NumberIds::CONF_SET16_16:
{
this->parent_->set_command_curve(PanasonicCommand::setPlus128(value), 93);
break;
}
case NumberIds::CONF_SET18:
{
this->parent_->set_command_byte(PanasonicCommand::setPlus128(value), 84);
break;
}
case NumberIds::CONF_SET19:
{
this->parent_->set_command_byte(PanasonicCommand::setPlus128(value), 94);
break;
}
case NumberIds::CONF_SET20:
{
this->parent_->set_command_byte(PanasonicCommand::setPlus128(value), 99);
break;
}
case NumberIds::CONF_SET21:
{
this->parent_->set_command_byte(PanasonicCommand::setPlus1(value), 104);
break;
}
case NumberIds::CONF_SET22:
{
this->parent_->set_command_byte(PanasonicCommand::setPlus128(value), 105);
break;
}
case NumberIds::CONF_SET23:
{
this->parent_->set_command_byte(PanasonicCommand::setPlus128(value), 106);
break;
}
case NumberIds::CONF_SET27:
{
this->parent_->set_command_byte(PanasonicCommand::setPlus128(value), 59);
break;
}
case NumberIds::CONF_SET29:
{
this->parent_->set_command_byte(PanasonicCommand::setPlus128(value), 83);
break;
}
case NumberIds::CONF_SET36:
{
this->parent_->set_command_byte(PanasonicCommand::setPlus128(value), 65);
break;
}
case NumberIds::CONF_SET37:
{
this->parent_->set_command_byte(PanasonicCommand::setPlus128(value), 66);
break;
}
case NumberIds::CONF_SET38:
{
this->parent_->set_command_byte(PanasonicCommand::setPlus128(value), 68);
break;
}
default: return;
};
this->publish_state(state);
this->keep_state_ = 2;
}
@@ -201,203 +136,137 @@ namespace esphome
switch (this->id_)
{
case NumberIds::CONF_SET11:
{
new_state = PanasonicDecode::getByteMinus128(data[42]);
if (this->has_state() && this->state == new_state) return;
break;
}
case NumberIds::CONF_SET20:
{
new_state = PanasonicDecode::getByteMinus128(data[99]);
if (this->has_state() && this->state == new_state) return;
break;
}
case NumberIds::CONF_SET18:
{
new_state = PanasonicDecode::getByteMinus128(data[84]);
if (this->has_state() && this->state == new_state) return;
break;
}
case NumberIds::CONF_SET19:
{
new_state = PanasonicDecode::getByteMinus128(data[94]);
if (this->has_state() && this->state == new_state) return;
break;
}
case NumberIds::CONF_SET5:
{
new_state = PanasonicDecode::getByteMinus128(data[38]);
if (this->has_state() && this->state == new_state) return;
break;
}
case NumberIds::CONF_SET6:
{
new_state = PanasonicDecode::getByteMinus128(data[39]);
if (this->has_state() && this->state == new_state) return;
break;
}
case NumberIds::CONF_SET16_01:
{
new_state = PanasonicDecode::getByteMinus128(data[75]);
if (this->has_state() && this->state == new_state) return;
break;
}
case NumberIds::CONF_SET16_02:
{
new_state = PanasonicDecode::getByteMinus128(data[76]);
if (this->has_state() && this->state == new_state) return;
break;
}
case NumberIds::CONF_SET16_04:
{
new_state = PanasonicDecode::getByteMinus128(data[78]);
if (this->has_state() && this->state == new_state) return;
break;
}
case NumberIds::CONF_SET16_03:
{
new_state = PanasonicDecode::getByteMinus128(data[77]);
if (this->has_state() && this->state == new_state) return;
break;
}
case NumberIds::CONF_SET7:
{
new_state = PanasonicDecode::getByteMinus128(data[40]);
if (this->has_state() && this->state == new_state) return;
break;
}
case NumberIds::CONF_SET8:
{
new_state = PanasonicDecode::getByteMinus128(data[41]);
if (this->has_state() && this->state == new_state) return;
break;
}
case NumberIds::CONF_SET16_09:
{
new_state = PanasonicDecode::getByteMinus128(data[86]);
if (this->has_state() && this->state == new_state) return;
break;
}
case NumberIds::CONF_SET16_10:
{
new_state = PanasonicDecode::getByteMinus128(data[87]);
if (this->has_state() && this->state == new_state) return;
break;
}
case NumberIds::CONF_SET16_12:
{
new_state = PanasonicDecode::getByteMinus128(data[89]);
if (this->has_state() && this->state == new_state) return;
break;
}
case NumberIds::CONF_SET16_11:
{
new_state = PanasonicDecode::getByteMinus128(data[88]);
if (this->has_state() && this->state == new_state) return;
break;
}
case NumberIds::CONF_SET29:
{
new_state = PanasonicDecode::getByteMinus128(data[83]);
if (this->has_state() && this->state == new_state) return;
break;
}
case NumberIds::CONF_SET16_05:
{
new_state = PanasonicDecode::getByteMinus128(data[79]);
if (this->has_state() && this->state == new_state) return;
break;
}
case NumberIds::CONF_SET16_06:
{
new_state = PanasonicDecode::getByteMinus128(data[80]);
if (this->has_state() && this->state == new_state) return;
break;
}
case NumberIds::CONF_SET16_08:
{
new_state = PanasonicDecode::getByteMinus128(data[82]);
if (this->has_state() && this->state == new_state) return;
break;
}
case NumberIds::CONF_SET16_07:
{
new_state = PanasonicDecode::getByteMinus128(data[81]);
if (this->has_state() && this->state == new_state) return;
break;
}
case NumberIds::CONF_SET16_13:
{
new_state = PanasonicDecode::getByteMinus128(data[90]);
if (this->has_state() && this->state == new_state) return;
break;
}
case NumberIds::CONF_SET16_14:
{
new_state = PanasonicDecode::getByteMinus128(data[91]);
if (this->has_state() && this->state == new_state) return;
break;
}
case NumberIds::CONF_SET16_16:
{
new_state = PanasonicDecode::getByteMinus128(data[93]);
if (this->has_state() && this->state == new_state) return;
break;
}
case NumberIds::CONF_SET16_15:
{
new_state = PanasonicDecode::getByteMinus128(data[92]);
if (this->has_state() && this->state == new_state) return;
break;
}
case NumberIds::CONF_SET15:
{
new_state = PanasonicDecode::getByteMinus1(data[45]);
if (this->has_state() && this->state == new_state) return;
break;
}
case NumberIds::CONF_SET21:
{
new_state = PanasonicDecode::getByteMinus1(data[104]);
if (this->has_state() && this->state == new_state) return;
break;
}
case NumberIds::CONF_SET22:
{
new_state = PanasonicDecode::getByteMinus128(data[105]);
if (this->has_state() && this->state == new_state) return;
break;
}
case NumberIds::CONF_SET23:
{
new_state = PanasonicDecode::getByteMinus128(data[106]);
if (this->has_state() && this->state == new_state) return;
break;
}
case NumberIds::CONF_SET27:
{
new_state = PanasonicDecode::getByteMinus128(data[59]);
if (this->has_state() && this->state == new_state) return;
break;
}
case NumberIds::CONF_SET36:
{
new_state = PanasonicDecode::getByteMinus128(data[65]);
if (this->has_state() && this->state == new_state) return;
break;
}
case NumberIds::CONF_SET37:
{
new_state = PanasonicDecode::getByteMinus128(data[66]);
if (this->has_state() && this->state == new_state) return;
break;
}
case NumberIds::CONF_SET38:
{
new_state = PanasonicDecode::getByteMinus128(data[68]);
if (this->has_state() && this->state == new_state) return;
break;
}
default: return;
};
@@ -176,34 +176,26 @@ namespace esphome
switch (requestType)
{
case RequestType::COMMAND:
{
if (this->log_uart_msg_) PanasonicHelpers::log_uart_hex(UART_LOG_TX, this->command_message_, ',');
this->write_array(this->command_message_);
this->flush();
break;
}
case RequestType::INITIAL:
{
// Probably not necessary but CZ-TAW1 sends this query on boot
if (this->log_uart_msg_) PanasonicHelpers::log_uart_hex(UART_LOG_TX, PanasonicCommand::InitialRequest, INIT_REQUEST_SIZE, ',');
this->write_array(PanasonicCommand::InitialRequest, INIT_REQUEST_SIZE);
this->flush();
break;
}
case RequestType::POLLING:
{
if (this->log_uart_msg_) PanasonicHelpers::log_uart_hex(UART_LOG_TX, PanasonicCommand::PollingMessage, DATA_MESSAGE_SIZE, ',');
this->write_array(PanasonicCommand::PollingMessage, DATA_MESSAGE_SIZE);
this->flush();
break;
}
case RequestType::POLLING_EXTRA:
{
if (this->log_uart_msg_) PanasonicHelpers::log_uart_hex(UART_LOG_TX, PanasonicCommand::PollingExtraMessage, DATA_MESSAGE_SIZE, ',');
this->write_array(PanasonicCommand::PollingMessage, DATA_MESSAGE_SIZE);
this->flush();
break;
}
};
this->next_request_ = RequestType::NONE;
@@ -22,42 +22,29 @@ namespace esphome
switch (this->id_)
{
case SelectIds::CONF_SET2:
{
this->parent_->set_command_byte(PanasonicCommand::setPlus1Multiply16(index), 5);
break;
}
case SelectIds::CONF_SET3:
{
this->parent_->set_command_byte(PanasonicCommand::setPlus1Multiply8(index), 7);
break;
}
case SelectIds::CONF_SET4:
{
this->parent_->set_command_byte(PanasonicCommand::setPlus1(index), 7);
break;
}
case SelectIds::CONF_SET9:
{
this->parent_->set_command_byte(PanasonicCommand::setOperationMode(index), 6);
break;
}
case SelectIds::CONF_SET17:
{
this->parent_->set_command_byte(PanasonicCommand::setPlus1Multiply64(index), 6);
break;
}
case SelectIds::CONF_SET26:
{
this->parent_->set_command_byte(PanasonicCommand::setPlus1Multiply16(index), 25);
break;
}
case SelectIds::CONF_SET35:
{
this->parent_->set_command_byte(PanasonicCommand::setPlus1Multiply4(index), 26);
break;
}
default: return;
};
this->publish_state(value);
this->keep_state_ = 2;
}
@@ -75,47 +62,33 @@ namespace esphome
switch (this->id_)
{
case SelectIds::CONF_SET9:
{
new_state = PanasonicDecode::getTextState(PanasonicDecode::OperationMode, PanasonicDecode::getOperationMode(data[6]));
if (this->has_state() && this->state == new_state) return;
break;
}
case SelectIds::CONF_SET4:
{
new_state = PanasonicDecode::getTextState(PanasonicDecode::PowerfulMode, PanasonicDecode::getBit6and7and8(data[7]));
if (this->has_state() && this->state == new_state) return;
break;
}
case SelectIds::CONF_SET3:
{
new_state = PanasonicDecode::getTextState(PanasonicDecode::QuietMode, PanasonicDecode::getBit3and4and5(data[7]));
if (this->has_state() && this->state == new_state) return;
break;
}
case SelectIds::CONF_SET2:
{
new_state = PanasonicDecode::getTextState(PanasonicDecode::HolidayState, PanasonicDecode::getBit3and4(data[5]));
if (this->has_state() && this->state == new_state) return;
break;
}
case SelectIds::CONF_SET17:
{
new_state = PanasonicDecode::getTextState(PanasonicDecode::ZoneState, PanasonicDecode::getBit1and2(data[6]));
if (this->has_state() && this->state == new_state) return;
break;
}
case SelectIds::CONF_SET26:
{
new_state = PanasonicDecode::getTextState(PanasonicDecode::ExtPadHeaterType, PanasonicDecode::getBit3and4(data[25]));
if (this->has_state() && this->state == new_state) return;
break;
}
case SelectIds::CONF_SET35:
{
new_state = PanasonicDecode::getTextState(PanasonicDecode::BivalentMode, PanasonicDecode::getBit5and6(data[26]));
if (this->has_state() && this->state == new_state) return;
break;
}
default: return;
};
@@ -21,612 +21,410 @@ namespace esphome
switch (this->id_)
{
case SensorIds::CONF_TOP1:
{
new_state = PanasonicDecode::getPumpFlow(data, 169);
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case SensorIds::CONF_TOP5:
{
new_state = PanasonicDecode::getByteMinus128(data[143]) + PanasonicDecode::getFractional(data[118], 0);
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case SensorIds::CONF_TOP6:
{
new_state = PanasonicDecode::getByteMinus128(data[144]) + PanasonicDecode::getFractional(data[118], 3);
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case SensorIds::CONF_TOP7:
{
new_state = PanasonicDecode::getByteMinus128(data[153]);
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case SensorIds::CONF_TOP8:
{
new_state = PanasonicDecode::getByteMinus1(data[166]);
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case SensorIds::CONF_TOP9:
{
new_state = PanasonicDecode::getByteMinus128(data[42]);
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case SensorIds::CONF_TOP10:
{
new_state = PanasonicDecode::getByteMinus128(data[141]);
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case SensorIds::CONF_TOP11:
{
new_state = PanasonicDecode::getWordMinus1(data, 182);
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case SensorIds::CONF_TOP12:
{
new_state = PanasonicDecode::getWordMinus1(data, 179);
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case SensorIds::CONF_TOP14:
{
new_state = PanasonicDecode::getByteMinus128(data[142]);
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case SensorIds::CONF_TOP15:
{
new_state = PanasonicDecode::getByteMinus1Times200(data[194]);
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case SensorIds::CONF_TOP16:
{
new_state = PanasonicDecode::getByteMinus1Times200(data[193]);
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case SensorIds::CONF_TOP21:
{
new_state = PanasonicDecode::getByteMinus128(data[158]);
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case SensorIds::CONF_TOP22:
{
new_state = PanasonicDecode::getByteMinus128(data[99]);
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case SensorIds::CONF_TOP23:
{
new_state = PanasonicDecode::getByteMinus128(data[84]);
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case SensorIds::CONF_TOP24:
{
new_state = PanasonicDecode::getByteMinus128(data[94]);
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case SensorIds::CONF_TOP25:
{
new_state = PanasonicDecode::getByteMinus128(data[44]);
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case SensorIds::CONF_TOP27:
{
new_state = PanasonicDecode::getByteMinus128(data[38]);
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case SensorIds::CONF_TOP28:
{
new_state = PanasonicDecode::getByteMinus128(data[39]);
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case SensorIds::CONF_TOP29:
{
new_state = PanasonicDecode::getByteMinus128(data[75]);
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case SensorIds::CONF_TOP30:
{
new_state = PanasonicDecode::getByteMinus128(data[76]);
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case SensorIds::CONF_TOP31:
{
new_state = PanasonicDecode::getByteMinus128(data[78]);
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case SensorIds::CONF_TOP32:
{
new_state = PanasonicDecode::getByteMinus128(data[77]);
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case SensorIds::CONF_TOP33:
{
new_state = PanasonicDecode::getByteMinus128(data[156]);
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case SensorIds::CONF_TOP34:
{
new_state = PanasonicDecode::getByteMinus128(data[40]);
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case SensorIds::CONF_TOP35:
{
new_state = PanasonicDecode::getByteMinus128(data[41]);
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case SensorIds::CONF_TOP36:
{
new_state = PanasonicDecode::getByteMinus128(data[145]);
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case SensorIds::CONF_TOP37:
{
new_state = PanasonicDecode::getByteMinus128(data[146]);
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case SensorIds::CONF_TOP38:
{
new_state = PanasonicDecode::getByteMinus1Times200(data[196]);
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case SensorIds::CONF_TOP39:
{
new_state = PanasonicDecode::getByteMinus1Times200(data[195]);
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case SensorIds::CONF_TOP40:
{
new_state = PanasonicDecode::getByteMinus1Times200(data[198]);
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case SensorIds::CONF_TOP41:
{
new_state = PanasonicDecode::getByteMinus1Times200(data[197]);
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case SensorIds::CONF_TOP42:
{
new_state = PanasonicDecode::getByteMinus128(data[147]);
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case SensorIds::CONF_TOP43:
{
new_state = PanasonicDecode::getByteMinus128(data[148]);
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case SensorIds::CONF_TOP45:
{
new_state = PanasonicDecode::getByteMinus128(data[43]);
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case SensorIds::CONF_TOP46:
{
new_state = PanasonicDecode::getByteMinus128(data[149]);
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case SensorIds::CONF_TOP47:
{
new_state = PanasonicDecode::getByteMinus128(data[150]);
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case SensorIds::CONF_TOP48:
{
new_state = PanasonicDecode::getByteMinus128(data[151]);
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case SensorIds::CONF_TOP49:
{
new_state = PanasonicDecode::getByteMinus128(data[154]);
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case SensorIds::CONF_TOP50:
{
new_state = PanasonicDecode::getByteMinus128(data[155]);
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case SensorIds::CONF_TOP51:
{
new_state = PanasonicDecode::getByteMinus128(data[157]);
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case SensorIds::CONF_TOP52:
{
new_state = PanasonicDecode::getByteMinus128(data[159]);
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case SensorIds::CONF_TOP53:
{
new_state = PanasonicDecode::getByteMinus128(data[160]);
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case SensorIds::CONF_TOP54:
{
new_state = PanasonicDecode::getByteMinus128(data[161]);
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case SensorIds::CONF_TOP55:
{
new_state = PanasonicDecode::getByteMinus128(data[162]);
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case SensorIds::CONF_TOP56:
{
new_state = PanasonicDecode::getByteMinus128(data[139]);
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case SensorIds::CONF_TOP57:
{
new_state = PanasonicDecode::getByteMinus128(data[140]);
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case SensorIds::CONF_TOP62:
{
new_state = PanasonicDecode::getByteMinus1Times10(data[173]);
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case SensorIds::CONF_TOP63:
{
new_state = PanasonicDecode::getByteMinus1Times10(data[174]);
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case SensorIds::CONF_TOP64:
{
new_state = PanasonicDecode::getByteMinus1Div5(data[163]);
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case SensorIds::CONF_TOP65:
{
new_state = PanasonicDecode::getByteMinus1Times50(data[171]);
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case SensorIds::CONF_TOP66:
{
new_state = PanasonicDecode::getByteMinus1Times50(data[164]);
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case SensorIds::CONF_TOP67:
{
new_state = PanasonicDecode::getByteMinus1Div5(data[165]);
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case SensorIds::CONF_TOP70:
{
new_state = PanasonicDecode::getByteMinus128(data[100]);
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case SensorIds::CONF_TOP71:
{
new_state = PanasonicDecode::getByteMinus1(data[101]);
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case SensorIds::CONF_TOP72:
{
new_state = PanasonicDecode::getByteMinus128(data[86]);
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case SensorIds::CONF_TOP73:
{
new_state = PanasonicDecode::getByteMinus128(data[87]);
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case SensorIds::CONF_TOP74:
{
new_state = PanasonicDecode::getByteMinus128(data[89]);
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case SensorIds::CONF_TOP75:
{
new_state = PanasonicDecode::getByteMinus128(data[88]);
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case SensorIds::CONF_TOP77:
{
new_state = PanasonicDecode::getByteMinus128(data[83]);
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case SensorIds::CONF_TOP78:
{
new_state = PanasonicDecode::getByteMinus128(data[85]);
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case SensorIds::CONF_TOP79:
{
new_state = PanasonicDecode::getByteMinus128(data[95]);
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case SensorIds::CONF_TOP80:
{
new_state = PanasonicDecode::getByteMinus128(data[96]);
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case SensorIds::CONF_TOP82:
{
new_state = PanasonicDecode::getByteMinus128(data[79]);
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case SensorIds::CONF_TOP83:
{
new_state = PanasonicDecode::getByteMinus128(data[80]);
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case SensorIds::CONF_TOP84:
{
new_state = PanasonicDecode::getByteMinus128(data[82]);
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case SensorIds::CONF_TOP85:
{
new_state = PanasonicDecode::getByteMinus128(data[81]);
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case SensorIds::CONF_TOP86:
{
new_state = PanasonicDecode::getByteMinus128(data[90]);
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case SensorIds::CONF_TOP87:
{
new_state = PanasonicDecode::getByteMinus128(data[91]);
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case SensorIds::CONF_TOP88:
{
new_state = PanasonicDecode::getByteMinus128(data[93]);
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case SensorIds::CONF_TOP89:
{
new_state = PanasonicDecode::getByteMinus128(data[92]);
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case SensorIds::CONF_TOP90:
{
new_state = PanasonicDecode::getWordMinus1(data, 185);
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case SensorIds::CONF_TOP91:
{
new_state = PanasonicDecode::getWordMinus1(data, 188);
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case SensorIds::CONF_TOP93:
{
new_state = PanasonicDecode::getByteMinus1(data[172]);
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case SensorIds::CONF_TOP95:
{
new_state = PanasonicDecode::getByteMinus1(data[45]);
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case SensorIds::CONF_TOP96:
{
new_state = PanasonicDecode::getByteMinus1(data[104]);
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case SensorIds::CONF_TOP97:
{
new_state = PanasonicDecode::getByteMinus128(data[105]);
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case SensorIds::CONF_TOP98:
{
new_state = PanasonicDecode::getByteMinus128(data[106]);
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case SensorIds::CONF_TOP102:
{
new_state = PanasonicDecode::getByteMinus128(data[61]);
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case SensorIds::CONF_TOP103:
{
new_state = PanasonicDecode::getByteMinus128(data[62]);
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case SensorIds::CONF_TOP104:
{
new_state = PanasonicDecode::getByteMinus128(data[63]);
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case SensorIds::CONF_TOP105:
{
new_state = PanasonicDecode::getByteMinus128(data[64]);
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case SensorIds::CONF_TOP113:
{
new_state = PanasonicDecode::getByteMinus128(data[59]);
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case SensorIds::CONF_TOP115:
{
new_state = PanasonicDecode::getByteMinus1Div50(data[125]);
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case SensorIds::CONF_TOP116:
{
new_state = PanasonicDecode::getByteMinus128(data[126]);
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case SensorIds::CONF_TOP117:
{
new_state = PanasonicDecode::getByteMinus128(data[127]);
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case SensorIds::CONF_TOP118:
{
new_state = PanasonicDecode::getByteMinus128(data[128]);
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case SensorIds::CONF_TOP127:
{
new_state = PanasonicDecode::getByteMinus1Div2(data[177]);
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case SensorIds::CONF_TOP128:
{
new_state = PanasonicDecode::getByteMinus1Div2(data[178]);
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case SensorIds::CONF_TOP131:
{
new_state = PanasonicDecode::getByteMinus128(data[65]);
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case SensorIds::CONF_TOP134:
{
new_state = PanasonicDecode::getByteMinus128(data[66]);
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case SensorIds::CONF_TOP135:
{
new_state = PanasonicDecode::getByteMinus128(data[68]);
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case SensorIds::CONF_TOP136:
{
new_state = PanasonicDecode::getByteMinus1(data[67]);
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case SensorIds::CONF_TOP137:
{
new_state = PanasonicDecode::getByteMinus1(data[69]);
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case SensorIds::CONF_TOP138:
{
new_state = PanasonicDecode::getByteMinus1(data[70]);
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case SensorIds::CONF_XTOP0:
{
new_state = PanasonicDecode::getWordMinus1(data, 14);
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case SensorIds::CONF_XTOP1:
{
new_state = PanasonicDecode::getWordMinus1(data, 16);
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case SensorIds::CONF_XTOP2:
{
new_state = PanasonicDecode::getWordMinus1(data, 18);
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case SensorIds::CONF_XTOP3:
{
new_state = PanasonicDecode::getWordMinus1(data, 20);
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case SensorIds::CONF_XTOP4:
{
new_state = PanasonicDecode::getWordMinus1(data, 22);
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case SensorIds::CONF_XTOP5:
{
new_state = PanasonicDecode::getWordMinus1(data, 24);
if (this->has_state() && this->get_state() == new_state) return;
break;
}
default: return;
};
@@ -20,72 +20,47 @@ namespace esphome
switch (this->id_)
{
case SwitchIds::CONF_SET1:
{
this->parent_->set_command_byte(PanasonicCommand::setPlus1(value), 4);
break;
}
case SwitchIds::CONF_SET10:
{
this->parent_->set_command_byte(PanasonicCommand::setPlus1Multiply64(value), 4);
break;
}
case SwitchIds::CONF_SET12:
{
this->parent_->set_command_byte(PanasonicCommand::setMultiply2(value), 8);
break;
}
case SwitchIds::CONF_SET13:
{
this->parent_->set_command_byte(PanasonicCommand::setMultiply4(value), 8);
break;
}
case SwitchIds::CONF_SET14:
{
this->parent_->set_command_byte(PanasonicCommand::setPlus1Multiply16(value), 4);
break;
}
case SwitchIds::CONF_SET24:
{
this->parent_->set_command_byte(PanasonicCommand::setPlus1Multiply64(value), 5);
break;
}
case SwitchIds::CONF_SET25:
{
this->parent_->set_command_byte(PanasonicCommand::setPlus1Multiply16(value), 20);
break;
}
case SwitchIds::CONF_SET28:
{
this->parent_->set_command_byte(PanasonicCommand::setPlus1Multiply4(value), 24);
break;
}
case SwitchIds::CONF_SET30:
{
this->parent_->set_command_byte(PanasonicCommand::setPlus1(value), 23);
break;
}
case SwitchIds::CONF_SET31:
{
this->parent_->set_command_byte(PanasonicCommand::setPlus1Multiply16(value), 23);
break;
}
case SwitchIds::CONF_SET32:
{
this->parent_->set_command_byte(PanasonicCommand::setPlus1Multiply64(value), 23);
break;
}
case SwitchIds::CONF_SET33:
{
this->parent_->set_command_byte(PanasonicCommand::setPlus1Multiply4(value), 23);
break;
}
case SwitchIds::CONF_SET34:
{
this->parent_->set_command_byte(PanasonicCommand::setPlus1(value), 26);
break;
}
default: return;
};
this->publish_state(state);
this->keep_state_ = 2;
}
@@ -103,77 +78,53 @@ namespace esphome
switch (this->id_)
{
case SwitchIds::CONF_SET1:
{
new_state = PanasonicDecode::getBinaryState(PanasonicDecode::getBit7and8(data[4]));
if (this->state == new_state) return;
break;
}
case SwitchIds::CONF_SET10:
{
new_state = PanasonicDecode::getBinaryState(PanasonicDecode::getBit1and2(data[4]));
if (this->state == new_state) return;
break;
}
case SwitchIds::CONF_SET24:
{
new_state = PanasonicDecode::getBinaryState(PanasonicDecode::getBit1and2(data[5]));
if (this->state == new_state) return;
break;
}
case SwitchIds::CONF_SET12:
{
new_state = PanasonicDecode::getBinaryState(PanasonicDecode::getBit5and6(data[111]));
if (this->state == new_state) return;
break;
}
case SwitchIds::CONF_SET13:
{
new_state = PanasonicDecode::getBinaryState(PanasonicDecode::getBit5and6(data[117]));
if (this->state == new_state) return;
break;
}
case SwitchIds::CONF_SET28:
{
new_state = PanasonicDecode::getBinaryState(PanasonicDecode::getBit5and6(data[24]));
if (this->state == new_state) return;
break;
}
case SwitchIds::CONF_SET25:
{
new_state = PanasonicDecode::getBinaryState(PanasonicDecode::getBit3and4(data[20]));
if (this->state == new_state) return;
break;
}
case SwitchIds::CONF_SET30:
{
new_state = PanasonicDecode::getBinaryState(PanasonicDecode::getBit7and8(data[23]));
if (this->state == new_state) return;
break;
}
case SwitchIds::CONF_SET33:
{
new_state = PanasonicDecode::getBinaryState(PanasonicDecode::getBit5and6(data[23]));
if (this->state == new_state) return;
break;
}
case SwitchIds::CONF_SET31:
{
new_state = PanasonicDecode::getBinaryState(PanasonicDecode::getBit3and4(data[23]));
if (this->state == new_state) return;
break;
}
case SwitchIds::CONF_SET32:
{
new_state = PanasonicDecode::getBinaryState(PanasonicDecode::getBit1and2(data[23]));
if (this->state == new_state) return;
break;
}
case SwitchIds::CONF_SET34:
{
new_state = PanasonicDecode::getBinaryState(PanasonicDecode::getBit7and8(data[26]));
if (this->state == new_state) return;
break;
}
default: return;
};
@@ -21,131 +21,89 @@ namespace esphome
switch (this->id_)
{
case TextSensorIds::CONF_TOP4:
{
new_state = PanasonicDecode::getTextState(PanasonicDecode::OperationMode, PanasonicDecode::getOperationMode(data[6]));
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case TextSensorIds::CONF_TOP17:
{
new_state = PanasonicDecode::getTextState(PanasonicDecode::PowerfulMode, PanasonicDecode::getBit6and7and8(data[7]));
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case TextSensorIds::CONF_TOP18:
{
new_state = PanasonicDecode::getTextState(PanasonicDecode::QuietMode, PanasonicDecode::getBit3and4and5(data[7]));
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case TextSensorIds::CONF_TOP19:
{
new_state = PanasonicDecode::getTextState(PanasonicDecode::HolidayState, PanasonicDecode::getBit3and4(data[5]));
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case TextSensorIds::CONF_TOP20:
{
new_state = PanasonicDecode::getTextState(PanasonicDecode::ThreeWayValve, PanasonicDecode::getBit7and8(data[111]));
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case TextSensorIds::CONF_TOP44:
{
new_state = PanasonicDecode::getErrorInfo(data[113], data[114]);
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case TextSensorIds::CONF_TOP58:
{
new_state = PanasonicDecode::getTextState(PanasonicDecode::BlockedFree, PanasonicDecode::getBit5and6(data[9]));
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case TextSensorIds::CONF_TOP59:
{
new_state = PanasonicDecode::getTextState(PanasonicDecode::BlockedFree, PanasonicDecode::getBit7and8(data[9]));
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case TextSensorIds::CONF_TOP76:
{
new_state = PanasonicDecode::getTextState(PanasonicDecode::WaterTempControl, PanasonicDecode::getBit7and8(data[28]));
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case TextSensorIds::CONF_TOP81:
{
new_state = PanasonicDecode::getTextState(PanasonicDecode::WaterTempControl, PanasonicDecode::getBit5and6(data[28]));
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case TextSensorIds::CONF_TOP92:
{
new_state = PanasonicDecode::getTextState(PanasonicDecode::ModelNames, PanasonicDecode::getModel(data, 129));
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case TextSensorIds::CONF_TOP94:
{
new_state = PanasonicDecode::getTextState(PanasonicDecode::ZoneState, PanasonicDecode::getBit1and2(data[6]));
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case TextSensorIds::CONF_TOP101:
{
new_state = PanasonicDecode::getTextState(PanasonicDecode::SolarMode, PanasonicDecode::getBit3and4(data[24]));
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case TextSensorIds::CONF_TOP106:
{
new_state = PanasonicDecode::getTextState(PanasonicDecode::PumpFlowRateMode, PanasonicDecode::getBit3and4(data[29]));
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case TextSensorIds::CONF_TOP107:
{
new_state = PanasonicDecode::getTextState(PanasonicDecode::LiquidType, PanasonicDecode::getBit1(data[20]));
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case TextSensorIds::CONF_TOP111:
{
new_state = PanasonicDecode::getTextState(PanasonicDecode::ZoneSensorType, PanasonicDecode::getLowNibbleMinus1(data[22]));
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case TextSensorIds::CONF_TOP112:
{
new_state = PanasonicDecode::getTextState(PanasonicDecode::ZoneSensorType, PanasonicDecode::getHighNibbleMinus1(data[22]));
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case TextSensorIds::CONF_TOP114:
{
new_state = PanasonicDecode::getTextState(PanasonicDecode::ExtPadHeaterType, PanasonicDecode::getBit3and4(data[25]));
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case TextSensorIds::CONF_TOP125:
{
new_state = PanasonicDecode::getTextState(PanasonicDecode::TwoWayValve, PanasonicDecode::getBit5and6(data[116]));
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case TextSensorIds::CONF_TOP126:
{
new_state = PanasonicDecode::getTextState(PanasonicDecode::ThreeWayValve, PanasonicDecode::getBit7and8(data[116]));
if (this->has_state() && this->get_state() == new_state) return;
break;
}
case TextSensorIds::CONF_TOP130:
{
new_state = PanasonicDecode::getTextState(PanasonicDecode::BivalentMode, PanasonicDecode::getBit5and6(data[26]));
if (this->has_state() && this->get_state() == new_state) return;
break;
}
default: return;
};