Added "has_state()" check in "publish_new_state()" functions.
Save raw_topics in a map for setting traits.
This commit is contained in:
parent
97aa262c70
commit
423ca2dbc8
|
|
@ -23,139 +23,139 @@ namespace esphome
|
|||
case BinarySensorIds::CONF_TOP0:
|
||||
{
|
||||
new_state = PanasonicDecode::getBinaryState(PanasonicDecode::getBit7and8(data[4]));
|
||||
if (this->state == new_state) return;
|
||||
if (this->has_state() && this->state == new_state) return;
|
||||
break;
|
||||
}
|
||||
case BinarySensorIds::CONF_TOP2:
|
||||
{
|
||||
new_state = PanasonicDecode::getBinaryState(PanasonicDecode::getBit1and2(data[4]));
|
||||
if (this->state == new_state) return;
|
||||
if (this->has_state() && this->state == new_state) return;
|
||||
break;
|
||||
}
|
||||
case BinarySensorIds::CONF_TOP3:
|
||||
{
|
||||
new_state = PanasonicDecode::getBinaryState(PanasonicDecode::getBit1and2(data[7]));
|
||||
if (this->state == new_state) return;
|
||||
if (this->has_state() && this->state == new_state) return;
|
||||
break;
|
||||
}
|
||||
case BinarySensorIds::CONF_TOP13:
|
||||
{
|
||||
new_state = PanasonicDecode::getBinaryState(PanasonicDecode::getBit1and2(data[5]));
|
||||
if (this->state == new_state) return;
|
||||
if (this->has_state() && this->state == new_state) return;
|
||||
break;
|
||||
}
|
||||
case BinarySensorIds::CONF_TOP26:
|
||||
{
|
||||
new_state = PanasonicDecode::getBinaryState(PanasonicDecode::getBit5and6(data[111]));
|
||||
if (this->state == new_state) return;
|
||||
if (this->has_state() && this->state == new_state) return;
|
||||
break;
|
||||
}
|
||||
case BinarySensorIds::CONF_TOP60:
|
||||
{
|
||||
new_state = PanasonicDecode::getBinaryState(PanasonicDecode::getBit7and8(data[112]));
|
||||
if (this->state == new_state) return;
|
||||
if (this->has_state() && this->state == new_state) return;
|
||||
break;
|
||||
}
|
||||
case BinarySensorIds::CONF_TOP61:
|
||||
{
|
||||
new_state = PanasonicDecode::getBinaryState(PanasonicDecode::getBit5and6(data[112]));
|
||||
if (this->state == new_state) return;
|
||||
if (this->has_state() && this->state == new_state) return;
|
||||
break;
|
||||
}
|
||||
case BinarySensorIds::CONF_TOP68:
|
||||
{
|
||||
new_state = PanasonicDecode::getBinaryState(PanasonicDecode::getBit5and6(data[5]));
|
||||
if (this->state == new_state) return;
|
||||
if (this->has_state() && this->state == new_state) return;
|
||||
break;
|
||||
}
|
||||
case BinarySensorIds::CONF_TOP69:
|
||||
{
|
||||
new_state = PanasonicDecode::getBinaryState(PanasonicDecode::getBit5and6(data[117]));
|
||||
if (this->state == new_state) return;
|
||||
if (this->has_state() && this->state == new_state) return;
|
||||
break;
|
||||
}
|
||||
case BinarySensorIds::CONF_TOP99:
|
||||
{
|
||||
new_state = PanasonicDecode::getBinaryState(PanasonicDecode::getBit5and6(data[24]));
|
||||
if (this->state == new_state) return;
|
||||
if (this->has_state() && this->state == new_state) return;
|
||||
break;
|
||||
}
|
||||
case BinarySensorIds::CONF_TOP100:
|
||||
{
|
||||
new_state = PanasonicDecode::getBinaryState(PanasonicDecode::getBit7and8(data[24]));
|
||||
if (this->state == new_state) return;
|
||||
if (this->has_state() && this->state == new_state) return;
|
||||
break;
|
||||
}
|
||||
case BinarySensorIds::CONF_TOP108:
|
||||
{
|
||||
new_state = PanasonicDecode::getBinaryState(PanasonicDecode::getBit3and4(data[20]));
|
||||
if (this->state == new_state) return;
|
||||
if (this->has_state() && this->state == new_state) return;
|
||||
break;
|
||||
}
|
||||
case BinarySensorIds::CONF_TOP109:
|
||||
{
|
||||
new_state = PanasonicDecode::getBinaryState(PanasonicDecode::getBit5and6(data[20]));
|
||||
if (this->state == new_state) return;
|
||||
if (this->has_state() && this->state == new_state) return;
|
||||
break;
|
||||
}
|
||||
case BinarySensorIds::CONF_TOP110:
|
||||
{
|
||||
new_state = PanasonicDecode::getBinaryState(PanasonicDecode::getBit7and8(data[20]));
|
||||
if (this->state == new_state) return;
|
||||
if (this->has_state() && this->state == new_state) return;
|
||||
break;
|
||||
}
|
||||
case BinarySensorIds::CONF_TOP119:
|
||||
{
|
||||
new_state = PanasonicDecode::getBinaryState(PanasonicDecode::getBit7and8(data[23]));
|
||||
if (this->state == new_state) return;
|
||||
if (this->has_state() && this->state == new_state) return;
|
||||
break;
|
||||
}
|
||||
case BinarySensorIds::CONF_TOP120:
|
||||
{
|
||||
new_state = PanasonicDecode::getBinaryState(PanasonicDecode::getBit5and6(data[23]));
|
||||
if (this->state == new_state) return;
|
||||
if (this->has_state() && this->state == new_state) return;
|
||||
break;
|
||||
}
|
||||
case BinarySensorIds::CONF_TOP121:
|
||||
{
|
||||
new_state = PanasonicDecode::getBinaryState(PanasonicDecode::getBit3and4(data[23]));
|
||||
if (this->state == new_state) return;
|
||||
if (this->has_state() && this->state == new_state) return;
|
||||
break;
|
||||
}
|
||||
case BinarySensorIds::CONF_TOP122:
|
||||
{
|
||||
new_state = PanasonicDecode::getBinaryState(PanasonicDecode::getBit1and2(data[23]));
|
||||
if (this->state == new_state) return;
|
||||
if (this->has_state() && this->state == new_state) return;
|
||||
break;
|
||||
}
|
||||
case BinarySensorIds::CONF_TOP123:
|
||||
{
|
||||
new_state = PanasonicDecode::getBinaryState(PanasonicDecode::getBit1and2(data[116]));
|
||||
if (this->state == new_state) return;
|
||||
if (this->has_state() && this->state == new_state) return;
|
||||
break;
|
||||
}
|
||||
case BinarySensorIds::CONF_TOP124:
|
||||
{
|
||||
new_state = PanasonicDecode::getBinaryState(PanasonicDecode::getBit3and4(data[116]));
|
||||
if (this->state == new_state) return;
|
||||
if (this->has_state() && this->state == new_state) return;
|
||||
break;
|
||||
}
|
||||
case BinarySensorIds::CONF_TOP129:
|
||||
{
|
||||
new_state = PanasonicDecode::getBinaryState(PanasonicDecode::getBit7and8(data[26]));
|
||||
if (this->state == new_state) return;
|
||||
if (this->has_state() && this->state == new_state) return;
|
||||
break;
|
||||
}
|
||||
case BinarySensorIds::CONF_TOP132:
|
||||
{
|
||||
new_state = PanasonicDecode::getBinaryState(PanasonicDecode::getBit3and4(data[26]));
|
||||
if (this->state == new_state) return;
|
||||
if (this->has_state() && this->state == new_state) return;
|
||||
break;
|
||||
}
|
||||
case BinarySensorIds::CONF_TOP133:
|
||||
{
|
||||
new_state = PanasonicDecode::getBinaryState(PanasonicDecode::getBit1and2(data[26]));
|
||||
if (this->state == new_state) return;
|
||||
if (this->has_state() && this->state == new_state) return;
|
||||
break;
|
||||
}
|
||||
default: return;
|
||||
|
|
|
|||
|
|
@ -203,199 +203,199 @@ namespace esphome
|
|||
case NumberIds::CONF_SET11:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus128(data[42]);
|
||||
if (this->state == new_state) return;
|
||||
if (this->has_state() && this->state == new_state) return;
|
||||
break;
|
||||
}
|
||||
case NumberIds::CONF_SET20:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus128(data[99]);
|
||||
if (this->state == new_state) return;
|
||||
if (this->has_state() && this->state == new_state) return;
|
||||
break;
|
||||
}
|
||||
case NumberIds::CONF_SET18:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus128(data[84]);
|
||||
if (this->state == new_state) return;
|
||||
if (this->has_state() && this->state == new_state) return;
|
||||
break;
|
||||
}
|
||||
case NumberIds::CONF_SET19:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus128(data[94]);
|
||||
if (this->state == new_state) return;
|
||||
if (this->has_state() && this->state == new_state) return;
|
||||
break;
|
||||
}
|
||||
case NumberIds::CONF_SET5:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus128(data[38]);
|
||||
if (this->state == new_state) return;
|
||||
if (this->has_state() && this->state == new_state) return;
|
||||
break;
|
||||
}
|
||||
case NumberIds::CONF_SET6:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus128(data[39]);
|
||||
if (this->state == new_state) return;
|
||||
if (this->has_state() && this->state == new_state) return;
|
||||
break;
|
||||
}
|
||||
case NumberIds::CONF_SET16_01:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus128(data[75]);
|
||||
if (this->state == new_state) return;
|
||||
if (this->has_state() && this->state == new_state) return;
|
||||
break;
|
||||
}
|
||||
case NumberIds::CONF_SET16_02:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus128(data[76]);
|
||||
if (this->state == new_state) return;
|
||||
if (this->has_state() && this->state == new_state) return;
|
||||
break;
|
||||
}
|
||||
case NumberIds::CONF_SET16_04:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus128(data[78]);
|
||||
if (this->state == new_state) return;
|
||||
if (this->has_state() && this->state == new_state) return;
|
||||
break;
|
||||
}
|
||||
case NumberIds::CONF_SET16_03:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus128(data[77]);
|
||||
if (this->state == new_state) return;
|
||||
if (this->has_state() && this->state == new_state) return;
|
||||
break;
|
||||
}
|
||||
case NumberIds::CONF_SET7:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus128(data[40]);
|
||||
if (this->state == new_state) return;
|
||||
if (this->has_state() && this->state == new_state) return;
|
||||
break;
|
||||
}
|
||||
case NumberIds::CONF_SET8:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus128(data[41]);
|
||||
if (this->state == new_state) return;
|
||||
if (this->has_state() && this->state == new_state) return;
|
||||
break;
|
||||
}
|
||||
case NumberIds::CONF_SET16_09:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus128(data[86]);
|
||||
if (this->state == new_state) return;
|
||||
if (this->has_state() && this->state == new_state) return;
|
||||
break;
|
||||
}
|
||||
case NumberIds::CONF_SET16_10:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus128(data[87]);
|
||||
if (this->state == new_state) return;
|
||||
if (this->has_state() && this->state == new_state) return;
|
||||
break;
|
||||
}
|
||||
case NumberIds::CONF_SET16_12:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus128(data[89]);
|
||||
if (this->state == new_state) return;
|
||||
if (this->has_state() && this->state == new_state) return;
|
||||
break;
|
||||
}
|
||||
case NumberIds::CONF_SET16_11:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus128(data[88]);
|
||||
if (this->state == new_state) return;
|
||||
if (this->has_state() && this->state == new_state) return;
|
||||
break;
|
||||
}
|
||||
case NumberIds::CONF_SET29:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus128(data[83]);
|
||||
if (this->state == new_state) return;
|
||||
if (this->has_state() && this->state == new_state) return;
|
||||
break;
|
||||
}
|
||||
case NumberIds::CONF_SET16_05:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus128(data[79]);
|
||||
if (this->state == new_state) return;
|
||||
if (this->has_state() && this->state == new_state) return;
|
||||
break;
|
||||
}
|
||||
case NumberIds::CONF_SET16_06:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus128(data[80]);
|
||||
if (this->state == new_state) return;
|
||||
if (this->has_state() && this->state == new_state) return;
|
||||
break;
|
||||
}
|
||||
case NumberIds::CONF_SET16_08:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus128(data[82]);
|
||||
if (this->state == new_state) return;
|
||||
if (this->has_state() && this->state == new_state) return;
|
||||
break;
|
||||
}
|
||||
case NumberIds::CONF_SET16_07:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus128(data[81]);
|
||||
if (this->state == new_state) return;
|
||||
if (this->has_state() && this->state == new_state) return;
|
||||
break;
|
||||
}
|
||||
case NumberIds::CONF_SET16_13:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus128(data[90]);
|
||||
if (this->state == new_state) return;
|
||||
if (this->has_state() && this->state == new_state) return;
|
||||
break;
|
||||
}
|
||||
case NumberIds::CONF_SET16_14:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus128(data[91]);
|
||||
if (this->state == new_state) return;
|
||||
if (this->has_state() && this->state == new_state) return;
|
||||
break;
|
||||
}
|
||||
case NumberIds::CONF_SET16_16:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus128(data[93]);
|
||||
if (this->state == new_state) return;
|
||||
if (this->has_state() && this->state == new_state) return;
|
||||
break;
|
||||
}
|
||||
case NumberIds::CONF_SET16_15:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus128(data[92]);
|
||||
if (this->state == new_state) return;
|
||||
if (this->has_state() && this->state == new_state) return;
|
||||
break;
|
||||
}
|
||||
case NumberIds::CONF_SET15:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus1(data[45]);
|
||||
if (this->state == new_state) return;
|
||||
if (this->has_state() && this->state == new_state) return;
|
||||
break;
|
||||
}
|
||||
case NumberIds::CONF_SET21:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus1(data[104]);
|
||||
if (this->state == new_state) return;
|
||||
if (this->has_state() && this->state == new_state) return;
|
||||
break;
|
||||
}
|
||||
case NumberIds::CONF_SET22:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus128(data[105]);
|
||||
if (this->state == new_state) return;
|
||||
if (this->has_state() && this->state == new_state) return;
|
||||
break;
|
||||
}
|
||||
case NumberIds::CONF_SET23:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus128(data[106]);
|
||||
if (this->state == new_state) return;
|
||||
if (this->has_state() && this->state == new_state) return;
|
||||
break;
|
||||
}
|
||||
case NumberIds::CONF_SET27:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus128(data[59]);
|
||||
if (this->state == new_state) return;
|
||||
if (this->has_state() && this->state == new_state) return;
|
||||
break;
|
||||
}
|
||||
case NumberIds::CONF_SET36:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus128(data[65]);
|
||||
if (this->state == new_state) return;
|
||||
if (this->has_state() && this->state == new_state) return;
|
||||
break;
|
||||
}
|
||||
case NumberIds::CONF_SET37:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus128(data[66]);
|
||||
if (this->state == new_state) return;
|
||||
if (this->has_state() && this->state == new_state) return;
|
||||
break;
|
||||
}
|
||||
case NumberIds::CONF_SET38:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus128(data[68]);
|
||||
if (this->state == new_state) return;
|
||||
if (this->has_state() && this->state == new_state) return;
|
||||
break;
|
||||
}
|
||||
default: return;
|
||||
|
|
@ -404,25 +404,21 @@ namespace esphome
|
|||
this->publish_state(new_state);
|
||||
}
|
||||
|
||||
bool PanasonicHeatpumpNumber::set_traits(const std::vector<uint8_t>& data)
|
||||
bool PanasonicHeatpumpNumber::set_traits(std::map<std::string, int>& raw_topics)
|
||||
{
|
||||
if (data.empty()) return false;
|
||||
if (raw_topics.empty()) return false;
|
||||
|
||||
std::string top76 = PanasonicDecode::getTextState(
|
||||
PanasonicDecode::WaterTempControl, PanasonicDecode::getBit7and8(data[28])); // Heating Mode
|
||||
std::string top81 = PanasonicDecode::getTextState(
|
||||
PanasonicDecode::WaterTempControl, PanasonicDecode::getBit5and6(data[28])); // Cooling Mode
|
||||
switch (this->id_)
|
||||
{
|
||||
case NumberIds::CONF_SET5:
|
||||
{
|
||||
if (this->traits.get_min_value() != -5.0 && top76 == PanasonicDecode::WaterTempControl[1])
|
||||
if (this->traits.get_min_value() != -5.0 && raw_topics["top76"] == 0)
|
||||
{
|
||||
this->traits.set_min_value(-5.0);
|
||||
this->traits.set_max_value(5.0);
|
||||
return true;
|
||||
}
|
||||
if (this->traits.get_min_value() != 20.0 && top76 == PanasonicDecode::WaterTempControl[2])
|
||||
if (this->traits.get_min_value() != 20.0 && raw_topics["top76"] == 1)
|
||||
{
|
||||
this->traits.set_min_value(20.0);
|
||||
this->traits.set_max_value(60.0);
|
||||
|
|
@ -432,13 +428,13 @@ namespace esphome
|
|||
}
|
||||
case NumberIds::CONF_SET6:
|
||||
{
|
||||
if (this->traits.get_min_value() != -5.0 && top81 == PanasonicDecode::WaterTempControl[1])
|
||||
if (this->traits.get_min_value() != -5.0 && raw_topics["top81"] == 0)
|
||||
{
|
||||
this->traits.set_min_value(-5.0);
|
||||
this->traits.set_max_value(5.0);
|
||||
return true;
|
||||
}
|
||||
if (this->traits.get_min_value() != 20.0 && top81 == PanasonicDecode::WaterTempControl[2])
|
||||
if (this->traits.get_min_value() != 20.0 && raw_topics["top81"] == 1)
|
||||
{
|
||||
this->traits.set_min_value(20.0);
|
||||
this->traits.set_max_value(60.0);
|
||||
|
|
@ -448,13 +444,13 @@ namespace esphome
|
|||
}
|
||||
case NumberIds::CONF_SET7:
|
||||
{
|
||||
if (this->traits.get_min_value() != -5.0 && top76 == PanasonicDecode::WaterTempControl[1])
|
||||
if (this->traits.get_min_value() != -5.0 && raw_topics["top76"] == 0)
|
||||
{
|
||||
this->traits.set_min_value(-5.0);
|
||||
this->traits.set_max_value(5.0);
|
||||
return true;
|
||||
}
|
||||
if (this->traits.get_min_value() != 20.0 && top76 == PanasonicDecode::WaterTempControl[2])
|
||||
if (this->traits.get_min_value() != 20.0 && raw_topics["top76"] == 1)
|
||||
{
|
||||
this->traits.set_min_value(20.0);
|
||||
this->traits.set_max_value(60.0);
|
||||
|
|
@ -464,13 +460,13 @@ namespace esphome
|
|||
}
|
||||
case NumberIds::CONF_SET8:
|
||||
{
|
||||
if (this->traits.get_min_value() != -5.0 && top81 == PanasonicDecode::WaterTempControl[1])
|
||||
if (this->traits.get_min_value() != -5.0 && raw_topics["top81"] == 0)
|
||||
{
|
||||
this->traits.set_min_value(-5.0);
|
||||
this->traits.set_max_value(5.0);
|
||||
return true;
|
||||
}
|
||||
if (this->traits.get_min_value() != 20.0 && top81 == PanasonicDecode::WaterTempControl[2])
|
||||
if (this->traits.get_min_value() != 20.0 && raw_topics["top81"] == 1)
|
||||
{
|
||||
this->traits.set_min_value(20.0);
|
||||
this->traits.set_max_value(60.0);
|
||||
|
|
@ -479,6 +475,7 @@ namespace esphome
|
|||
break;
|
||||
}
|
||||
};
|
||||
|
||||
return false;
|
||||
}
|
||||
} // namespace panasonic_heatpump
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ namespace esphome
|
|||
PanasonicHeatpumpNumber() = default;
|
||||
void dump_config() override;
|
||||
void publish_new_state(const std::vector<uint8_t>& data) override;
|
||||
bool set_traits(const std::vector<uint8_t>& data) override;
|
||||
bool set_traits(std::map<std::string, int>& raw_topics) override;
|
||||
|
||||
protected:
|
||||
void control(float value) override;
|
||||
|
|
|
|||
|
|
@ -46,15 +46,24 @@ namespace esphome
|
|||
LoopState::SET_NUMBER_TRAITS : LoopState::SEND_REQUEST;
|
||||
break;
|
||||
}
|
||||
// traits can be changed anytime, but entities will only be updated in home assistant,
|
||||
// if the traits was set before connecting to home assistant. If now a traits must be changed later,
|
||||
// a reboot of the ESP controller is required to see the changes in home assistant.
|
||||
case LoopState::SET_NUMBER_TRAITS:
|
||||
{
|
||||
this->set_number_traits(this->heatpump_message_);
|
||||
for (auto *entity : this->numbers_)
|
||||
{
|
||||
this->traits_changed_ = entity->set_traits(this->raw_topics_) ? true : this->traits_changed_;
|
||||
}
|
||||
this->loop_state_ = LoopState::SET_SELECT_TRAITS;
|
||||
break;
|
||||
}
|
||||
case LoopState::SET_SELECT_TRAITS:
|
||||
{
|
||||
this->set_select_traits(this->heatpump_message_);
|
||||
for (auto *entity : this->selects_)
|
||||
{
|
||||
this->traits_changed_ = entity->set_traits(this->raw_topics_) ? true : this->traits_changed_;
|
||||
}
|
||||
this->loop_state_ = LoopState::PUBLISH_SENSOR;
|
||||
break;
|
||||
}
|
||||
|
|
@ -309,8 +318,15 @@ namespace esphome
|
|||
return false;
|
||||
}
|
||||
|
||||
// Check if the current response is a new response
|
||||
if (this->last_response_count_ == this->current_response_count_) return false;
|
||||
this->last_response_count_ = this->current_response_count_;
|
||||
|
||||
// Save some topic values that are needed for setting traits
|
||||
raw_topics_["top76"] = PanasonicDecode::getBit7and8(data[28]); // Heating Mode
|
||||
raw_topics_["top81"] = PanasonicDecode::getBit5and6(data[28]); // Cooling Mode
|
||||
raw_topics_["top120"] = PanasonicDecode::getBit5and6(data[23]); // Heat Cool Control
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -413,35 +429,5 @@ namespace esphome
|
|||
// command will be send on next loop
|
||||
this->next_request_ = RequestType::COMMAND;
|
||||
}
|
||||
|
||||
// traits can be changed anytime, but entities will only be updated in home assistant,
|
||||
// if the traits was set before connecting to home assistant. If now a traits must be changed later,
|
||||
// a reboot of the ESP controller is required to see the changes in home assistant.
|
||||
|
||||
void PanasonicHeatpumpComponent::set_number_traits(const std::vector<uint8_t>& data)
|
||||
{
|
||||
if (data.empty()) return;
|
||||
std::string top76_str = PanasonicDecode::getTextState(
|
||||
PanasonicDecode::WaterTempControl, PanasonicDecode::getBit7and8(data[28])); // Heating Mode
|
||||
std::string top81_str = PanasonicDecode::getTextState(
|
||||
PanasonicDecode::WaterTempControl, PanasonicDecode::getBit5and6(data[28])); // Cooling Mode
|
||||
// ToDo: Convert top76 and top81 into int and pass them to set_traits();
|
||||
|
||||
for (auto *entity : this->numbers_)
|
||||
{
|
||||
this->traits_changed_ = entity->set_traits(data) ? true : this->traits_changed_;
|
||||
}
|
||||
}
|
||||
|
||||
void PanasonicHeatpumpComponent::set_select_traits(const std::vector<uint8_t>& data)
|
||||
{
|
||||
if (data.empty()) return;
|
||||
bool top120 = PanasonicDecode::getBinaryState(PanasonicDecode::getBit5and6(data[23])); // Heat Cool Control
|
||||
|
||||
for (auto *entity : this->selects_)
|
||||
{
|
||||
this->traits_changed_ = entity->set_traits(data) ? true : this->traits_changed_ ;
|
||||
}
|
||||
}
|
||||
} // namespace panasonic_heatpump
|
||||
} // namespace esphome
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
#include <vector>
|
||||
#include <tuple>
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include "esphome/core/component.h"
|
||||
#include "esphome/core/defines.h"
|
||||
#include "esphome/core/log.h"
|
||||
|
|
@ -45,7 +46,7 @@ namespace esphome
|
|||
public:
|
||||
virtual void set_id(const int id) { id_ = id; }
|
||||
virtual void publish_new_state(const std::vector<uint8_t>& data) = 0;
|
||||
virtual bool set_traits(const std::vector<uint8_t>& data) { return false; }
|
||||
virtual bool set_traits(std::map<std::string, int>& raw_topics) { return false; }
|
||||
|
||||
protected:
|
||||
int id_ { -1 };
|
||||
|
|
@ -91,6 +92,7 @@ namespace esphome
|
|||
std::vector<uint8_t> response_message_;
|
||||
std::vector<uint8_t> request_message_;
|
||||
std::vector<uint8_t> command_message_;
|
||||
std::map<std::string, int> raw_topics_;
|
||||
uint8_t payload_length_;
|
||||
uint8_t byte_;
|
||||
uint8_t current_response_count_ { 0 };
|
||||
|
|
@ -113,9 +115,6 @@ namespace esphome
|
|||
void send_request(RequestType requestType);
|
||||
void read_request();
|
||||
bool check_response(const std::vector<uint8_t>& data);
|
||||
// entity functions
|
||||
void set_number_traits(const std::vector<uint8_t>& data);
|
||||
void set_select_traits(const std::vector<uint8_t>& data);
|
||||
};
|
||||
} // namespace panasonic_heatpump
|
||||
} // namespace esphome
|
||||
|
|
|
|||
|
|
@ -77,43 +77,43 @@ namespace esphome
|
|||
case SelectIds::CONF_SET9:
|
||||
{
|
||||
new_state = PanasonicDecode::getTextState(PanasonicDecode::OperationMode, PanasonicDecode::getOperationMode(data[6]));
|
||||
if (this->state == new_state) return;
|
||||
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->state == new_state) return;
|
||||
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->state == new_state) return;
|
||||
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->state == new_state) return;
|
||||
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->state == new_state) return;
|
||||
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->state == new_state) return;
|
||||
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->state == new_state) return;
|
||||
if (this->has_state() && this->state == new_state) return;
|
||||
break;
|
||||
}
|
||||
default: return;
|
||||
|
|
@ -122,22 +122,21 @@ namespace esphome
|
|||
this->publish_state(new_state);
|
||||
}
|
||||
|
||||
bool PanasonicHeatpumpSelect::set_traits(const std::vector<uint8_t>& data)
|
||||
bool PanasonicHeatpumpSelect::set_traits(std::map<std::string, int>& raw_topics)
|
||||
{
|
||||
if (data.empty()) return false;
|
||||
if (raw_topics.empty()) return false;
|
||||
|
||||
bool top120 = PanasonicDecode::getBinaryState(PanasonicDecode::getBit5and6(data[23])); // Heat Cool Control
|
||||
switch (this->id_)
|
||||
{
|
||||
case SelectIds::CONF_SET9:
|
||||
{
|
||||
if (this->traits.get_options().size() != 3 && !top120)
|
||||
if (this->traits.get_options().size() != 3 && raw_topics["top120"] == 0)
|
||||
{
|
||||
auto options = std::vector<std::string>(PanasonicDecode::OperationMode + 1, PanasonicDecode::OperationMode + 4);
|
||||
this->traits.set_options(options);
|
||||
return true;
|
||||
}
|
||||
if (this->traits.get_options().size() != 10 && top120)
|
||||
if (this->traits.get_options().size() != 10 && raw_topics["top120"] != 0)
|
||||
{
|
||||
auto options = std::vector<std::string>(PanasonicDecode::OperationMode + 1, std::end(PanasonicDecode::OperationMode));
|
||||
this->traits.set_options(options);
|
||||
|
|
@ -146,6 +145,7 @@ namespace esphome
|
|||
break;
|
||||
}
|
||||
};
|
||||
|
||||
return false;
|
||||
}
|
||||
} // namespace panasonic_heatpump
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ namespace esphome
|
|||
PanasonicHeatpumpSelect() = default;
|
||||
void dump_config() override;
|
||||
void publish_new_state(const std::vector<uint8_t>& data) override;
|
||||
bool set_traits(const std::vector<uint8_t>& data) override;
|
||||
bool set_traits(std::map<std::string, int>& raw_topics) override;
|
||||
|
||||
protected:
|
||||
void control(const std::string &value) override;
|
||||
|
|
|
|||
|
|
@ -23,571 +23,571 @@ namespace esphome
|
|||
case SensorIds::CONF_TOP1:
|
||||
{
|
||||
new_state = PanasonicDecode::getPumpFlow(data, 169);
|
||||
if (this->get_state() == new_state) return;
|
||||
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->get_state() == new_state) return;
|
||||
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->get_state() == new_state) return;
|
||||
if (this->has_state() && this->get_state() == new_state) return;
|
||||
break;
|
||||
}
|
||||
case SensorIds::CONF_TOP7:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus128(data[153]);
|
||||
if (this->get_state() == new_state) return;
|
||||
if (this->has_state() && this->get_state() == new_state) return;
|
||||
break;
|
||||
}
|
||||
case SensorIds::CONF_TOP8:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus1(data[166]);
|
||||
if (this->get_state() == new_state) return;
|
||||
if (this->has_state() && this->get_state() == new_state) return;
|
||||
break;
|
||||
}
|
||||
case SensorIds::CONF_TOP9:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus128(data[42]);
|
||||
if (this->get_state() == new_state) return;
|
||||
if (this->has_state() && this->get_state() == new_state) return;
|
||||
break;
|
||||
}
|
||||
case SensorIds::CONF_TOP10:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus128(data[141]);
|
||||
if (this->get_state() == new_state) return;
|
||||
if (this->has_state() && this->get_state() == new_state) return;
|
||||
break;
|
||||
}
|
||||
case SensorIds::CONF_TOP11:
|
||||
{
|
||||
new_state = PanasonicDecode::getWordMinus1(data, 182);
|
||||
if (this->get_state() == new_state) return;
|
||||
if (this->has_state() && this->get_state() == new_state) return;
|
||||
break;
|
||||
}
|
||||
case SensorIds::CONF_TOP12:
|
||||
{
|
||||
new_state = PanasonicDecode::getWordMinus1(data, 179);
|
||||
if (this->get_state() == new_state) return;
|
||||
if (this->has_state() && this->get_state() == new_state) return;
|
||||
break;
|
||||
}
|
||||
case SensorIds::CONF_TOP14:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus128(data[142]);
|
||||
if (this->get_state() == new_state) return;
|
||||
if (this->has_state() && this->get_state() == new_state) return;
|
||||
break;
|
||||
}
|
||||
case SensorIds::CONF_TOP15:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus1Times200(data[194]);
|
||||
if (this->get_state() == new_state) return;
|
||||
if (this->has_state() && this->get_state() == new_state) return;
|
||||
break;
|
||||
}
|
||||
case SensorIds::CONF_TOP16:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus1Times200(data[193]);
|
||||
if (this->get_state() == new_state) return;
|
||||
if (this->has_state() && this->get_state() == new_state) return;
|
||||
break;
|
||||
}
|
||||
case SensorIds::CONF_TOP21:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus128(data[158]);
|
||||
if (this->get_state() == new_state) return;
|
||||
if (this->has_state() && this->get_state() == new_state) return;
|
||||
break;
|
||||
}
|
||||
case SensorIds::CONF_TOP22:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus128(data[99]);
|
||||
if (this->get_state() == new_state) return;
|
||||
if (this->has_state() && this->get_state() == new_state) return;
|
||||
break;
|
||||
}
|
||||
case SensorIds::CONF_TOP23:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus128(data[84]);
|
||||
if (this->get_state() == new_state) return;
|
||||
if (this->has_state() && this->get_state() == new_state) return;
|
||||
break;
|
||||
}
|
||||
case SensorIds::CONF_TOP24:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus128(data[94]);
|
||||
if (this->get_state() == new_state) return;
|
||||
if (this->has_state() && this->get_state() == new_state) return;
|
||||
break;
|
||||
}
|
||||
case SensorIds::CONF_TOP25:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus128(data[44]);
|
||||
if (this->get_state() == new_state) return;
|
||||
if (this->has_state() && this->get_state() == new_state) return;
|
||||
break;
|
||||
}
|
||||
case SensorIds::CONF_TOP27:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus128(data[38]);
|
||||
if (this->get_state() == new_state) return;
|
||||
if (this->has_state() && this->get_state() == new_state) return;
|
||||
break;
|
||||
}
|
||||
case SensorIds::CONF_TOP28:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus128(data[39]);
|
||||
if (this->get_state() == new_state) return;
|
||||
if (this->has_state() && this->get_state() == new_state) return;
|
||||
break;
|
||||
}
|
||||
case SensorIds::CONF_TOP29:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus128(data[75]);
|
||||
if (this->get_state() == new_state) return;
|
||||
if (this->has_state() && this->get_state() == new_state) return;
|
||||
break;
|
||||
}
|
||||
case SensorIds::CONF_TOP30:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus128(data[76]);
|
||||
if (this->get_state() == new_state) return;
|
||||
if (this->has_state() && this->get_state() == new_state) return;
|
||||
break;
|
||||
}
|
||||
case SensorIds::CONF_TOP31:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus128(data[78]);
|
||||
if (this->get_state() == new_state) return;
|
||||
if (this->has_state() && this->get_state() == new_state) return;
|
||||
break;
|
||||
}
|
||||
case SensorIds::CONF_TOP32:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus128(data[77]);
|
||||
if (this->get_state() == new_state) return;
|
||||
if (this->has_state() && this->get_state() == new_state) return;
|
||||
break;
|
||||
}
|
||||
case SensorIds::CONF_TOP33:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus128(data[156]);
|
||||
if (this->get_state() == new_state) return;
|
||||
if (this->has_state() && this->get_state() == new_state) return;
|
||||
break;
|
||||
}
|
||||
case SensorIds::CONF_TOP34:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus128(data[40]);
|
||||
if (this->get_state() == new_state) return;
|
||||
if (this->has_state() && this->get_state() == new_state) return;
|
||||
break;
|
||||
}
|
||||
case SensorIds::CONF_TOP35:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus128(data[41]);
|
||||
if (this->get_state() == new_state) return;
|
||||
if (this->has_state() && this->get_state() == new_state) return;
|
||||
break;
|
||||
}
|
||||
case SensorIds::CONF_TOP36:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus128(data[145]);
|
||||
if (this->get_state() == new_state) return;
|
||||
if (this->has_state() && this->get_state() == new_state) return;
|
||||
break;
|
||||
}
|
||||
case SensorIds::CONF_TOP37:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus128(data[146]);
|
||||
if (this->get_state() == new_state) return;
|
||||
if (this->has_state() && this->get_state() == new_state) return;
|
||||
break;
|
||||
}
|
||||
case SensorIds::CONF_TOP38:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus1Times200(data[196]);
|
||||
if (this->get_state() == new_state) return;
|
||||
if (this->has_state() && this->get_state() == new_state) return;
|
||||
break;
|
||||
}
|
||||
case SensorIds::CONF_TOP39:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus1Times200(data[195]);
|
||||
if (this->get_state() == new_state) return;
|
||||
if (this->has_state() && this->get_state() == new_state) return;
|
||||
break;
|
||||
}
|
||||
case SensorIds::CONF_TOP40:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus1Times200(data[198]);
|
||||
if (this->get_state() == new_state) return;
|
||||
if (this->has_state() && this->get_state() == new_state) return;
|
||||
break;
|
||||
}
|
||||
case SensorIds::CONF_TOP41:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus1Times200(data[197]);
|
||||
if (this->get_state() == new_state) return;
|
||||
if (this->has_state() && this->get_state() == new_state) return;
|
||||
break;
|
||||
}
|
||||
case SensorIds::CONF_TOP42:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus128(data[147]);
|
||||
if (this->get_state() == new_state) return;
|
||||
if (this->has_state() && this->get_state() == new_state) return;
|
||||
break;
|
||||
}
|
||||
case SensorIds::CONF_TOP43:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus128(data[148]);
|
||||
if (this->get_state() == new_state) return;
|
||||
if (this->has_state() && this->get_state() == new_state) return;
|
||||
break;
|
||||
}
|
||||
case SensorIds::CONF_TOP45:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus128(data[43]);
|
||||
if (this->get_state() == new_state) return;
|
||||
if (this->has_state() && this->get_state() == new_state) return;
|
||||
break;
|
||||
}
|
||||
case SensorIds::CONF_TOP46:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus128(data[149]);
|
||||
if (this->get_state() == new_state) return;
|
||||
if (this->has_state() && this->get_state() == new_state) return;
|
||||
break;
|
||||
}
|
||||
case SensorIds::CONF_TOP47:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus128(data[150]);
|
||||
if (this->get_state() == new_state) return;
|
||||
if (this->has_state() && this->get_state() == new_state) return;
|
||||
break;
|
||||
}
|
||||
case SensorIds::CONF_TOP48:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus128(data[151]);
|
||||
if (this->get_state() == new_state) return;
|
||||
if (this->has_state() && this->get_state() == new_state) return;
|
||||
break;
|
||||
}
|
||||
case SensorIds::CONF_TOP49:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus128(data[154]);
|
||||
if (this->get_state() == new_state) return;
|
||||
if (this->has_state() && this->get_state() == new_state) return;
|
||||
break;
|
||||
}
|
||||
case SensorIds::CONF_TOP50:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus128(data[155]);
|
||||
if (this->get_state() == new_state) return;
|
||||
if (this->has_state() && this->get_state() == new_state) return;
|
||||
break;
|
||||
}
|
||||
case SensorIds::CONF_TOP51:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus128(data[157]);
|
||||
if (this->get_state() == new_state) return;
|
||||
if (this->has_state() && this->get_state() == new_state) return;
|
||||
break;
|
||||
}
|
||||
case SensorIds::CONF_TOP52:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus128(data[159]);
|
||||
if (this->get_state() == new_state) return;
|
||||
if (this->has_state() && this->get_state() == new_state) return;
|
||||
break;
|
||||
}
|
||||
case SensorIds::CONF_TOP53:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus128(data[160]);
|
||||
if (this->get_state() == new_state) return;
|
||||
if (this->has_state() && this->get_state() == new_state) return;
|
||||
break;
|
||||
}
|
||||
case SensorIds::CONF_TOP54:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus128(data[161]);
|
||||
if (this->get_state() == new_state) return;
|
||||
if (this->has_state() && this->get_state() == new_state) return;
|
||||
break;
|
||||
}
|
||||
case SensorIds::CONF_TOP55:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus128(data[162]);
|
||||
if (this->get_state() == new_state) return;
|
||||
if (this->has_state() && this->get_state() == new_state) return;
|
||||
break;
|
||||
}
|
||||
case SensorIds::CONF_TOP56:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus128(data[139]);
|
||||
if (this->get_state() == new_state) return;
|
||||
if (this->has_state() && this->get_state() == new_state) return;
|
||||
break;
|
||||
}
|
||||
case SensorIds::CONF_TOP57:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus128(data[140]);
|
||||
if (this->get_state() == new_state) return;
|
||||
if (this->has_state() && this->get_state() == new_state) return;
|
||||
break;
|
||||
}
|
||||
case SensorIds::CONF_TOP62:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus1Times10(data[173]);
|
||||
if (this->get_state() == new_state) return;
|
||||
if (this->has_state() && this->get_state() == new_state) return;
|
||||
break;
|
||||
}
|
||||
case SensorIds::CONF_TOP63:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus1Times10(data[174]);
|
||||
if (this->get_state() == new_state) return;
|
||||
if (this->has_state() && this->get_state() == new_state) return;
|
||||
break;
|
||||
}
|
||||
case SensorIds::CONF_TOP64:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus1Div5(data[163]);
|
||||
if (this->get_state() == new_state) return;
|
||||
if (this->has_state() && this->get_state() == new_state) return;
|
||||
break;
|
||||
}
|
||||
case SensorIds::CONF_TOP65:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus1Times50(data[171]);
|
||||
if (this->get_state() == new_state) return;
|
||||
if (this->has_state() && this->get_state() == new_state) return;
|
||||
break;
|
||||
}
|
||||
case SensorIds::CONF_TOP66:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus1Times50(data[164]);
|
||||
if (this->get_state() == new_state) return;
|
||||
if (this->has_state() && this->get_state() == new_state) return;
|
||||
break;
|
||||
}
|
||||
case SensorIds::CONF_TOP67:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus1Div5(data[165]);
|
||||
if (this->get_state() == new_state) return;
|
||||
if (this->has_state() && this->get_state() == new_state) return;
|
||||
break;
|
||||
}
|
||||
case SensorIds::CONF_TOP70:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus128(data[100]);
|
||||
if (this->get_state() == new_state) return;
|
||||
if (this->has_state() && this->get_state() == new_state) return;
|
||||
break;
|
||||
}
|
||||
case SensorIds::CONF_TOP71:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus1(data[101]);
|
||||
if (this->get_state() == new_state) return;
|
||||
if (this->has_state() && this->get_state() == new_state) return;
|
||||
break;
|
||||
}
|
||||
case SensorIds::CONF_TOP72:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus128(data[86]);
|
||||
if (this->get_state() == new_state) return;
|
||||
if (this->has_state() && this->get_state() == new_state) return;
|
||||
break;
|
||||
}
|
||||
case SensorIds::CONF_TOP73:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus128(data[87]);
|
||||
if (this->get_state() == new_state) return;
|
||||
if (this->has_state() && this->get_state() == new_state) return;
|
||||
break;
|
||||
}
|
||||
case SensorIds::CONF_TOP74:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus128(data[89]);
|
||||
if (this->get_state() == new_state) return;
|
||||
if (this->has_state() && this->get_state() == new_state) return;
|
||||
break;
|
||||
}
|
||||
case SensorIds::CONF_TOP75:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus128(data[88]);
|
||||
if (this->get_state() == new_state) return;
|
||||
if (this->has_state() && this->get_state() == new_state) return;
|
||||
break;
|
||||
}
|
||||
case SensorIds::CONF_TOP77:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus128(data[83]);
|
||||
if (this->get_state() == new_state) return;
|
||||
if (this->has_state() && this->get_state() == new_state) return;
|
||||
break;
|
||||
}
|
||||
case SensorIds::CONF_TOP78:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus128(data[85]);
|
||||
if (this->get_state() == new_state) return;
|
||||
if (this->has_state() && this->get_state() == new_state) return;
|
||||
break;
|
||||
}
|
||||
case SensorIds::CONF_TOP79:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus128(data[95]);
|
||||
if (this->get_state() == new_state) return;
|
||||
if (this->has_state() && this->get_state() == new_state) return;
|
||||
break;
|
||||
}
|
||||
case SensorIds::CONF_TOP80:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus128(data[96]);
|
||||
if (this->get_state() == new_state) return;
|
||||
if (this->has_state() && this->get_state() == new_state) return;
|
||||
break;
|
||||
}
|
||||
case SensorIds::CONF_TOP82:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus128(data[79]);
|
||||
if (this->get_state() == new_state) return;
|
||||
if (this->has_state() && this->get_state() == new_state) return;
|
||||
break;
|
||||
}
|
||||
case SensorIds::CONF_TOP83:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus128(data[80]);
|
||||
if (this->get_state() == new_state) return;
|
||||
if (this->has_state() && this->get_state() == new_state) return;
|
||||
break;
|
||||
}
|
||||
case SensorIds::CONF_TOP84:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus128(data[82]);
|
||||
if (this->get_state() == new_state) return;
|
||||
if (this->has_state() && this->get_state() == new_state) return;
|
||||
break;
|
||||
}
|
||||
case SensorIds::CONF_TOP85:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus128(data[81]);
|
||||
if (this->get_state() == new_state) return;
|
||||
if (this->has_state() && this->get_state() == new_state) return;
|
||||
break;
|
||||
}
|
||||
case SensorIds::CONF_TOP86:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus128(data[90]);
|
||||
if (this->get_state() == new_state) return;
|
||||
if (this->has_state() && this->get_state() == new_state) return;
|
||||
break;
|
||||
}
|
||||
case SensorIds::CONF_TOP87:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus128(data[91]);
|
||||
if (this->get_state() == new_state) return;
|
||||
if (this->has_state() && this->get_state() == new_state) return;
|
||||
break;
|
||||
}
|
||||
case SensorIds::CONF_TOP88:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus128(data[93]);
|
||||
if (this->get_state() == new_state) return;
|
||||
if (this->has_state() && this->get_state() == new_state) return;
|
||||
break;
|
||||
}
|
||||
case SensorIds::CONF_TOP89:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus128(data[92]);
|
||||
if (this->get_state() == new_state) return;
|
||||
if (this->has_state() && this->get_state() == new_state) return;
|
||||
break;
|
||||
}
|
||||
case SensorIds::CONF_TOP90:
|
||||
{
|
||||
new_state = PanasonicDecode::getWordMinus1(data, 185);
|
||||
if (this->get_state() == new_state) return;
|
||||
if (this->has_state() && this->get_state() == new_state) return;
|
||||
break;
|
||||
}
|
||||
case SensorIds::CONF_TOP91:
|
||||
{
|
||||
new_state = PanasonicDecode::getWordMinus1(data, 188);
|
||||
if (this->get_state() == new_state) return;
|
||||
if (this->has_state() && this->get_state() == new_state) return;
|
||||
break;
|
||||
}
|
||||
case SensorIds::CONF_TOP93:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus1(data[172]);
|
||||
if (this->get_state() == new_state) return;
|
||||
if (this->has_state() && this->get_state() == new_state) return;
|
||||
break;
|
||||
}
|
||||
case SensorIds::CONF_TOP95:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus1(data[45]);
|
||||
if (this->get_state() == new_state) return;
|
||||
if (this->has_state() && this->get_state() == new_state) return;
|
||||
break;
|
||||
}
|
||||
case SensorIds::CONF_TOP96:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus1(data[104]);
|
||||
if (this->get_state() == new_state) return;
|
||||
if (this->has_state() && this->get_state() == new_state) return;
|
||||
break;
|
||||
}
|
||||
case SensorIds::CONF_TOP97:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus128(data[105]);
|
||||
if (this->get_state() == new_state) return;
|
||||
if (this->has_state() && this->get_state() == new_state) return;
|
||||
break;
|
||||
}
|
||||
case SensorIds::CONF_TOP98:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus128(data[106]);
|
||||
if (this->get_state() == new_state) return;
|
||||
if (this->has_state() && this->get_state() == new_state) return;
|
||||
break;
|
||||
}
|
||||
case SensorIds::CONF_TOP102:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus128(data[61]);
|
||||
if (this->get_state() == new_state) return;
|
||||
if (this->has_state() && this->get_state() == new_state) return;
|
||||
break;
|
||||
}
|
||||
case SensorIds::CONF_TOP103:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus128(data[62]);
|
||||
if (this->get_state() == new_state) return;
|
||||
if (this->has_state() && this->get_state() == new_state) return;
|
||||
break;
|
||||
}
|
||||
case SensorIds::CONF_TOP104:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus128(data[63]);
|
||||
if (this->get_state() == new_state) return;
|
||||
if (this->has_state() && this->get_state() == new_state) return;
|
||||
break;
|
||||
}
|
||||
case SensorIds::CONF_TOP105:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus128(data[64]);
|
||||
if (this->get_state() == new_state) return;
|
||||
if (this->has_state() && this->get_state() == new_state) return;
|
||||
break;
|
||||
}
|
||||
case SensorIds::CONF_TOP113:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus128(data[59]);
|
||||
if (this->get_state() == new_state) return;
|
||||
if (this->has_state() && this->get_state() == new_state) return;
|
||||
break;
|
||||
}
|
||||
case SensorIds::CONF_TOP115:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus1Div50(data[125]);
|
||||
if (this->get_state() == new_state) return;
|
||||
if (this->has_state() && this->get_state() == new_state) return;
|
||||
break;
|
||||
}
|
||||
case SensorIds::CONF_TOP116:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus128(data[126]);
|
||||
if (this->get_state() == new_state) return;
|
||||
if (this->has_state() && this->get_state() == new_state) return;
|
||||
break;
|
||||
}
|
||||
case SensorIds::CONF_TOP117:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus128(data[127]);
|
||||
if (this->get_state() == new_state) return;
|
||||
if (this->has_state() && this->get_state() == new_state) return;
|
||||
break;
|
||||
}
|
||||
case SensorIds::CONF_TOP118:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus128(data[128]);
|
||||
if (this->get_state() == new_state) return;
|
||||
if (this->has_state() && this->get_state() == new_state) return;
|
||||
break;
|
||||
}
|
||||
case SensorIds::CONF_TOP127:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus1Div2(data[177]);
|
||||
if (this->get_state() == new_state) return;
|
||||
if (this->has_state() && this->get_state() == new_state) return;
|
||||
break;
|
||||
}
|
||||
case SensorIds::CONF_TOP128:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus1Div2(data[178]);
|
||||
if (this->get_state() == new_state) return;
|
||||
if (this->has_state() && this->get_state() == new_state) return;
|
||||
break;
|
||||
}
|
||||
case SensorIds::CONF_TOP131:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus128(data[65]);
|
||||
if (this->get_state() == new_state) return;
|
||||
if (this->has_state() && this->get_state() == new_state) return;
|
||||
break;
|
||||
}
|
||||
case SensorIds::CONF_TOP134:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus128(data[66]);
|
||||
if (this->get_state() == new_state) return;
|
||||
if (this->has_state() && this->get_state() == new_state) return;
|
||||
break;
|
||||
}
|
||||
case SensorIds::CONF_TOP135:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus128(data[68]);
|
||||
if (this->get_state() == new_state) return;
|
||||
if (this->has_state() && this->get_state() == new_state) return;
|
||||
break;
|
||||
}
|
||||
case SensorIds::CONF_TOP136:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus1(data[67]);
|
||||
if (this->get_state() == new_state) return;
|
||||
if (this->has_state() && this->get_state() == new_state) return;
|
||||
break;
|
||||
}
|
||||
case SensorIds::CONF_TOP137:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus1(data[69]);
|
||||
if (this->get_state() == new_state) return;
|
||||
if (this->has_state() && this->get_state() == new_state) return;
|
||||
break;
|
||||
}
|
||||
case SensorIds::CONF_TOP138:
|
||||
{
|
||||
new_state = PanasonicDecode::getByteMinus1(data[70]);
|
||||
if (this->get_state() == new_state) return;
|
||||
if (this->has_state() && this->get_state() == new_state) return;
|
||||
break;
|
||||
}
|
||||
default: return;
|
||||
|
|
|
|||
|
|
@ -23,127 +23,127 @@ namespace esphome
|
|||
case TextSensorIds::CONF_TOP4:
|
||||
{
|
||||
new_state = PanasonicDecode::getTextState(PanasonicDecode::OperationMode, PanasonicDecode::getOperationMode(data[6]));
|
||||
if (this->get_state() == new_state) return;
|
||||
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->get_state() == new_state) return;
|
||||
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->get_state() == new_state) return;
|
||||
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->get_state() == new_state) return;
|
||||
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->get_state() == new_state) return;
|
||||
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->get_state() == new_state) return;
|
||||
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->get_state() == new_state) return;
|
||||
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->get_state() == new_state) return;
|
||||
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->get_state() == new_state) return;
|
||||
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->get_state() == new_state) return;
|
||||
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->get_state() == new_state) return;
|
||||
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->get_state() == new_state) return;
|
||||
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->get_state() == new_state) return;
|
||||
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->get_state() == new_state) return;
|
||||
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->get_state() == new_state) return;
|
||||
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->get_state() == new_state) return;
|
||||
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->get_state() == new_state) return;
|
||||
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->get_state() == new_state) return;
|
||||
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->get_state() == new_state) return;
|
||||
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->get_state() == new_state) return;
|
||||
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->get_state() == new_state) return;
|
||||
if (this->has_state() && this->get_state() == new_state) return;
|
||||
break;
|
||||
}
|
||||
default: return;
|
||||
|
|
|
|||
Loading…
Reference in New Issue