diff --git a/components/panasonic_heatpump/decode.cpp b/components/panasonic_heatpump/decode.cpp index 0926dcc..c0cdb07 100644 --- a/components/panasonic_heatpump/decode.cpp +++ b/components/panasonic_heatpump/decode.cpp @@ -113,47 +113,47 @@ namespace esphome return ((input >> 3) & 0b111) - 1; } - int PanasonicDecode::getRight3Bits(uint8_t input) + int PanasonicDecode::getBit6and7and8(uint8_t input) { return (input & 0b111) - 1; } - int PanasonicDecode::getIntMinus1(uint8_t input) + int PanasonicDecode::getByteMinus1(uint8_t input) { return (int)input - 1; } - int PanasonicDecode::getIntMinus128(uint8_t input) + int PanasonicDecode::getByteMinus128(uint8_t input) { return (int)input - 128; } - float PanasonicDecode::getIntMinus1Div2(uint8_t input) + float PanasonicDecode::getByteMinus1Div2(uint8_t input) { return ((float)input - 1) / 2; } - float PanasonicDecode::getIntMinus1Div5(uint8_t input) + float PanasonicDecode::getByteMinus1Div5(uint8_t input) { return ((float)input - 1) / 5; } - float PanasonicDecode::getIntMinus1Div50(uint8_t input) + float PanasonicDecode::getByteMinus1Div50(uint8_t input) { return ((float)input - 1) / 50; } - int PanasonicDecode::getIntMinus1Times10(uint8_t input) + int PanasonicDecode::getByteMinus1Times10(uint8_t input) { return ((int)input - 1) * 10; } - int PanasonicDecode::getIntMinus1Times50(uint8_t input) + int PanasonicDecode::getByteMinus1Times50(uint8_t input) { return ((int)input - 1) * 50; } - int PanasonicDecode::getIntMinus1Times200(uint8_t input) + int PanasonicDecode::getByteMinus1Times200(uint8_t input) { return ((int)input - 1) * 200; } diff --git a/components/panasonic_heatpump/decode.h b/components/panasonic_heatpump/decode.h index 0d52e7f..df64bb0 100644 --- a/components/panasonic_heatpump/decode.h +++ b/components/panasonic_heatpump/decode.h @@ -22,15 +22,15 @@ namespace esphome static int getBit5and6(uint8_t input); static int getBit7and8(uint8_t input); static int getBit3and4and5(uint8_t input); - static int getRight3Bits(uint8_t input); - static int getIntMinus1(uint8_t input); - static int getIntMinus128(uint8_t input); - static float getIntMinus1Div2(uint8_t input); - static float getIntMinus1Div5(uint8_t input); - static float getIntMinus1Div50(uint8_t input); - static int getIntMinus1Times10(uint8_t input); - static int getIntMinus1Times50(uint8_t input); - static int getIntMinus1Times200(uint8_t input); + static int getBit6and7and8(uint8_t input); + static int getByteMinus1(uint8_t input); + static int getByteMinus128(uint8_t input); + static float getByteMinus1Div2(uint8_t input); + static float getByteMinus1Div5(uint8_t input); + static float getByteMinus1Div50(uint8_t input); + static int getByteMinus1Times10(uint8_t input); + static int getByteMinus1Times50(uint8_t input); + static int getByteMinus1Times200(uint8_t input); static int getHighNibbleMinus1(uint8_t input); static int getLowNibbleMinus1(uint8_t input); static int getWordMinus1(uint8_t hi, uint8_t low); diff --git a/components/panasonic_heatpump/panasonic_heatpump.cpp b/components/panasonic_heatpump/panasonic_heatpump.cpp index 92e7d6c..bc5ac99 100644 --- a/components/panasonic_heatpump/panasonic_heatpump.cpp +++ b/components/panasonic_heatpump/panasonic_heatpump.cpp @@ -371,100 +371,100 @@ namespace esphome #ifdef USE_SENSOR if (this->top1_sensor_) this->top1_sensor_->publish_state(PanasonicDecode::getPumpFlow(bytes[169], bytes[170])); - if (this->top5_sensor_) this->top5_sensor_->publish_state(PanasonicDecode::getIntMinus128(bytes[143]) + PanasonicDecode::getFractional(bytes[118], 0)); - if (this->top6_sensor_) this->top6_sensor_->publish_state(PanasonicDecode::getIntMinus128(bytes[144]) + PanasonicDecode::getFractional(bytes[118], 3)); - if (this->top7_sensor_) this->top7_sensor_->publish_state(PanasonicDecode::getIntMinus128(bytes[153])); - if (this->top8_sensor_) this->top8_sensor_->publish_state(PanasonicDecode::getIntMinus1(bytes[166])); - if (this->top9_sensor_) this->top9_sensor_->publish_state(PanasonicDecode::getIntMinus128(bytes[42])); - if (this->top10_sensor_) this->top10_sensor_->publish_state(PanasonicDecode::getIntMinus128(bytes[141])); + if (this->top5_sensor_) this->top5_sensor_->publish_state(PanasonicDecode::getByteMinus128(bytes[143]) + PanasonicDecode::getFractional(bytes[118], 0)); + if (this->top6_sensor_) this->top6_sensor_->publish_state(PanasonicDecode::getByteMinus128(bytes[144]) + PanasonicDecode::getFractional(bytes[118], 3)); + if (this->top7_sensor_) this->top7_sensor_->publish_state(PanasonicDecode::getByteMinus128(bytes[153])); + if (this->top8_sensor_) this->top8_sensor_->publish_state(PanasonicDecode::getByteMinus1(bytes[166])); + if (this->top9_sensor_) this->top9_sensor_->publish_state(PanasonicDecode::getByteMinus128(bytes[42])); + if (this->top10_sensor_) this->top10_sensor_->publish_state(PanasonicDecode::getByteMinus128(bytes[141])); if (this->top11_sensor_) this->top11_sensor_->publish_state(PanasonicDecode::getWordMinus1(bytes[182], bytes[183])); if (this->top12_sensor_) this->top12_sensor_->publish_state(PanasonicDecode::getWordMinus1(bytes[179], bytes[180])); - if (this->top14_sensor_) this->top14_sensor_->publish_state(PanasonicDecode::getIntMinus128(bytes[142])); - if (this->top15_sensor_) this->top15_sensor_->publish_state(PanasonicDecode::getIntMinus1Times200(bytes[194])); - if (this->top16_sensor_) this->top16_sensor_->publish_state(PanasonicDecode::getIntMinus1Times200(bytes[193])); - if (this->top21_sensor_) this->top21_sensor_->publish_state(PanasonicDecode::getIntMinus128(bytes[158])); - if (this->top22_sensor_) this->top22_sensor_->publish_state(PanasonicDecode::getIntMinus128(bytes[99])); - if (this->top23_sensor_) this->top23_sensor_->publish_state(PanasonicDecode::getIntMinus128(bytes[84])); - if (this->top24_sensor_) this->top24_sensor_->publish_state(PanasonicDecode::getIntMinus128(bytes[94])); - if (this->top25_sensor_) this->top25_sensor_->publish_state(PanasonicDecode::getIntMinus128(bytes[44])); - if (this->top27_sensor_) this->top27_sensor_->publish_state(PanasonicDecode::getIntMinus128(bytes[38])); - if (this->top28_sensor_) this->top28_sensor_->publish_state(PanasonicDecode::getIntMinus128(bytes[39])); - if (this->top29_sensor_) this->top29_sensor_->publish_state(PanasonicDecode::getIntMinus128(bytes[75])); - if (this->top30_sensor_) this->top30_sensor_->publish_state(PanasonicDecode::getIntMinus128(bytes[76])); - if (this->top31_sensor_) this->top31_sensor_->publish_state(PanasonicDecode::getIntMinus128(bytes[78])); - if (this->top32_sensor_) this->top32_sensor_->publish_state(PanasonicDecode::getIntMinus128(bytes[77])); - if (this->top33_sensor_) this->top33_sensor_->publish_state(PanasonicDecode::getIntMinus128(bytes[156])); - if (this->top34_sensor_) this->top34_sensor_->publish_state(PanasonicDecode::getIntMinus128(bytes[40])); - if (this->top35_sensor_) this->top35_sensor_->publish_state(PanasonicDecode::getIntMinus128(bytes[41])); - if (this->top36_sensor_) this->top36_sensor_->publish_state(PanasonicDecode::getIntMinus128(bytes[145])); - if (this->top37_sensor_) this->top37_sensor_->publish_state(PanasonicDecode::getIntMinus128(bytes[146])); - if (this->top38_sensor_) this->top38_sensor_->publish_state(PanasonicDecode::getIntMinus1Times200(bytes[196])); - if (this->top39_sensor_) this->top39_sensor_->publish_state(PanasonicDecode::getIntMinus1Times200(bytes[195])); - if (this->top40_sensor_) this->top40_sensor_->publish_state(PanasonicDecode::getIntMinus1Times200(bytes[198])); - if (this->top41_sensor_) this->top41_sensor_->publish_state(PanasonicDecode::getIntMinus1Times200(bytes[197])); - if (this->top42_sensor_) this->top42_sensor_->publish_state(PanasonicDecode::getIntMinus128(bytes[147])); - if (this->top43_sensor_) this->top43_sensor_->publish_state(PanasonicDecode::getIntMinus128(bytes[148])); - if (this->top45_sensor_) this->top45_sensor_->publish_state(PanasonicDecode::getIntMinus128(bytes[43])); - if (this->top46_sensor_) this->top46_sensor_->publish_state(PanasonicDecode::getIntMinus128(bytes[149])); - if (this->top47_sensor_) this->top47_sensor_->publish_state(PanasonicDecode::getIntMinus128(bytes[150])); - if (this->top48_sensor_) this->top48_sensor_->publish_state(PanasonicDecode::getIntMinus128(bytes[151])); - if (this->top49_sensor_) this->top49_sensor_->publish_state(PanasonicDecode::getIntMinus128(bytes[154])); - if (this->top50_sensor_) this->top50_sensor_->publish_state(PanasonicDecode::getIntMinus128(bytes[155])); - if (this->top51_sensor_) this->top51_sensor_->publish_state(PanasonicDecode::getIntMinus128(bytes[157])); - if (this->top52_sensor_) this->top52_sensor_->publish_state(PanasonicDecode::getIntMinus128(bytes[159])); - if (this->top53_sensor_) this->top53_sensor_->publish_state(PanasonicDecode::getIntMinus128(bytes[160])); - if (this->top54_sensor_) this->top54_sensor_->publish_state(PanasonicDecode::getIntMinus128(bytes[161])); - if (this->top55_sensor_) this->top55_sensor_->publish_state(PanasonicDecode::getIntMinus128(bytes[162])); - if (this->top56_sensor_) this->top56_sensor_->publish_state(PanasonicDecode::getIntMinus128(bytes[139])); - if (this->top57_sensor_) this->top57_sensor_->publish_state(PanasonicDecode::getIntMinus128(bytes[140])); - if (this->top62_sensor_) this->top62_sensor_->publish_state(PanasonicDecode::getIntMinus1Times10(bytes[173])); - if (this->top63_sensor_) this->top63_sensor_->publish_state(PanasonicDecode::getIntMinus1Times10(bytes[174])); - if (this->top64_sensor_) this->top64_sensor_->publish_state(PanasonicDecode::getIntMinus1Div5(bytes[163])); - if (this->top65_sensor_) this->top65_sensor_->publish_state(PanasonicDecode::getIntMinus1Times50(bytes[171])); - if (this->top66_sensor_) this->top66_sensor_->publish_state(PanasonicDecode::getIntMinus1Times50(bytes[164])); - if (this->top67_sensor_) this->top67_sensor_->publish_state(PanasonicDecode::getIntMinus1Div5(bytes[165])); - if (this->top70_sensor_) this->top70_sensor_->publish_state(PanasonicDecode::getIntMinus128(bytes[100])); - if (this->top71_sensor_) this->top71_sensor_->publish_state(PanasonicDecode::getIntMinus1(bytes[101])); - if (this->top72_sensor_) this->top72_sensor_->publish_state(PanasonicDecode::getIntMinus128(bytes[86])); - if (this->top73_sensor_) this->top73_sensor_->publish_state(PanasonicDecode::getIntMinus128(bytes[87])); - if (this->top74_sensor_) this->top74_sensor_->publish_state(PanasonicDecode::getIntMinus128(bytes[89])); - if (this->top75_sensor_) this->top75_sensor_->publish_state(PanasonicDecode::getIntMinus128(bytes[88])); - if (this->top77_sensor_) this->top77_sensor_->publish_state(PanasonicDecode::getIntMinus128(bytes[83])); - if (this->top78_sensor_) this->top78_sensor_->publish_state(PanasonicDecode::getIntMinus128(bytes[85])); - if (this->top79_sensor_) this->top79_sensor_->publish_state(PanasonicDecode::getIntMinus128(bytes[95])); - if (this->top80_sensor_) this->top80_sensor_->publish_state(PanasonicDecode::getIntMinus128(bytes[96])); - if (this->top82_sensor_) this->top82_sensor_->publish_state(PanasonicDecode::getIntMinus128(bytes[79])); - if (this->top83_sensor_) this->top83_sensor_->publish_state(PanasonicDecode::getIntMinus128(bytes[80])); - if (this->top84_sensor_) this->top84_sensor_->publish_state(PanasonicDecode::getIntMinus128(bytes[82])); - if (this->top85_sensor_) this->top85_sensor_->publish_state(PanasonicDecode::getIntMinus128(bytes[81])); - if (this->top86_sensor_) this->top86_sensor_->publish_state(PanasonicDecode::getIntMinus128(bytes[90])); - if (this->top87_sensor_) this->top87_sensor_->publish_state(PanasonicDecode::getIntMinus128(bytes[91])); - if (this->top88_sensor_) this->top88_sensor_->publish_state(PanasonicDecode::getIntMinus128(bytes[93])); - if (this->top89_sensor_) this->top89_sensor_->publish_state(PanasonicDecode::getIntMinus128(bytes[92])); + if (this->top14_sensor_) this->top14_sensor_->publish_state(PanasonicDecode::getByteMinus128(bytes[142])); + if (this->top15_sensor_) this->top15_sensor_->publish_state(PanasonicDecode::getByteMinus1Times200(bytes[194])); + if (this->top16_sensor_) this->top16_sensor_->publish_state(PanasonicDecode::getByteMinus1Times200(bytes[193])); + if (this->top21_sensor_) this->top21_sensor_->publish_state(PanasonicDecode::getByteMinus128(bytes[158])); + if (this->top22_sensor_) this->top22_sensor_->publish_state(PanasonicDecode::getByteMinus128(bytes[99])); + if (this->top23_sensor_) this->top23_sensor_->publish_state(PanasonicDecode::getByteMinus128(bytes[84])); + if (this->top24_sensor_) this->top24_sensor_->publish_state(PanasonicDecode::getByteMinus128(bytes[94])); + if (this->top25_sensor_) this->top25_sensor_->publish_state(PanasonicDecode::getByteMinus128(bytes[44])); + if (this->top27_sensor_) this->top27_sensor_->publish_state(PanasonicDecode::getByteMinus128(bytes[38])); + if (this->top28_sensor_) this->top28_sensor_->publish_state(PanasonicDecode::getByteMinus128(bytes[39])); + if (this->top29_sensor_) this->top29_sensor_->publish_state(PanasonicDecode::getByteMinus128(bytes[75])); + if (this->top30_sensor_) this->top30_sensor_->publish_state(PanasonicDecode::getByteMinus128(bytes[76])); + if (this->top31_sensor_) this->top31_sensor_->publish_state(PanasonicDecode::getByteMinus128(bytes[78])); + if (this->top32_sensor_) this->top32_sensor_->publish_state(PanasonicDecode::getByteMinus128(bytes[77])); + if (this->top33_sensor_) this->top33_sensor_->publish_state(PanasonicDecode::getByteMinus128(bytes[156])); + if (this->top34_sensor_) this->top34_sensor_->publish_state(PanasonicDecode::getByteMinus128(bytes[40])); + if (this->top35_sensor_) this->top35_sensor_->publish_state(PanasonicDecode::getByteMinus128(bytes[41])); + if (this->top36_sensor_) this->top36_sensor_->publish_state(PanasonicDecode::getByteMinus128(bytes[145])); + if (this->top37_sensor_) this->top37_sensor_->publish_state(PanasonicDecode::getByteMinus128(bytes[146])); + if (this->top38_sensor_) this->top38_sensor_->publish_state(PanasonicDecode::getByteMinus1Times200(bytes[196])); + if (this->top39_sensor_) this->top39_sensor_->publish_state(PanasonicDecode::getByteMinus1Times200(bytes[195])); + if (this->top40_sensor_) this->top40_sensor_->publish_state(PanasonicDecode::getByteMinus1Times200(bytes[198])); + if (this->top41_sensor_) this->top41_sensor_->publish_state(PanasonicDecode::getByteMinus1Times200(bytes[197])); + if (this->top42_sensor_) this->top42_sensor_->publish_state(PanasonicDecode::getByteMinus128(bytes[147])); + if (this->top43_sensor_) this->top43_sensor_->publish_state(PanasonicDecode::getByteMinus128(bytes[148])); + if (this->top45_sensor_) this->top45_sensor_->publish_state(PanasonicDecode::getByteMinus128(bytes[43])); + if (this->top46_sensor_) this->top46_sensor_->publish_state(PanasonicDecode::getByteMinus128(bytes[149])); + if (this->top47_sensor_) this->top47_sensor_->publish_state(PanasonicDecode::getByteMinus128(bytes[150])); + if (this->top48_sensor_) this->top48_sensor_->publish_state(PanasonicDecode::getByteMinus128(bytes[151])); + if (this->top49_sensor_) this->top49_sensor_->publish_state(PanasonicDecode::getByteMinus128(bytes[154])); + if (this->top50_sensor_) this->top50_sensor_->publish_state(PanasonicDecode::getByteMinus128(bytes[155])); + if (this->top51_sensor_) this->top51_sensor_->publish_state(PanasonicDecode::getByteMinus128(bytes[157])); + if (this->top52_sensor_) this->top52_sensor_->publish_state(PanasonicDecode::getByteMinus128(bytes[159])); + if (this->top53_sensor_) this->top53_sensor_->publish_state(PanasonicDecode::getByteMinus128(bytes[160])); + if (this->top54_sensor_) this->top54_sensor_->publish_state(PanasonicDecode::getByteMinus128(bytes[161])); + if (this->top55_sensor_) this->top55_sensor_->publish_state(PanasonicDecode::getByteMinus128(bytes[162])); + if (this->top56_sensor_) this->top56_sensor_->publish_state(PanasonicDecode::getByteMinus128(bytes[139])); + if (this->top57_sensor_) this->top57_sensor_->publish_state(PanasonicDecode::getByteMinus128(bytes[140])); + if (this->top62_sensor_) this->top62_sensor_->publish_state(PanasonicDecode::getByteMinus1Times10(bytes[173])); + if (this->top63_sensor_) this->top63_sensor_->publish_state(PanasonicDecode::getByteMinus1Times10(bytes[174])); + if (this->top64_sensor_) this->top64_sensor_->publish_state(PanasonicDecode::getByteMinus1Div5(bytes[163])); + if (this->top65_sensor_) this->top65_sensor_->publish_state(PanasonicDecode::getByteMinus1Times50(bytes[171])); + if (this->top66_sensor_) this->top66_sensor_->publish_state(PanasonicDecode::getByteMinus1Times50(bytes[164])); + if (this->top67_sensor_) this->top67_sensor_->publish_state(PanasonicDecode::getByteMinus1Div5(bytes[165])); + if (this->top70_sensor_) this->top70_sensor_->publish_state(PanasonicDecode::getByteMinus128(bytes[100])); + if (this->top71_sensor_) this->top71_sensor_->publish_state(PanasonicDecode::getByteMinus1(bytes[101])); + if (this->top72_sensor_) this->top72_sensor_->publish_state(PanasonicDecode::getByteMinus128(bytes[86])); + if (this->top73_sensor_) this->top73_sensor_->publish_state(PanasonicDecode::getByteMinus128(bytes[87])); + if (this->top74_sensor_) this->top74_sensor_->publish_state(PanasonicDecode::getByteMinus128(bytes[89])); + if (this->top75_sensor_) this->top75_sensor_->publish_state(PanasonicDecode::getByteMinus128(bytes[88])); + if (this->top77_sensor_) this->top77_sensor_->publish_state(PanasonicDecode::getByteMinus128(bytes[83])); + if (this->top78_sensor_) this->top78_sensor_->publish_state(PanasonicDecode::getByteMinus128(bytes[85])); + if (this->top79_sensor_) this->top79_sensor_->publish_state(PanasonicDecode::getByteMinus128(bytes[95])); + if (this->top80_sensor_) this->top80_sensor_->publish_state(PanasonicDecode::getByteMinus128(bytes[96])); + if (this->top82_sensor_) this->top82_sensor_->publish_state(PanasonicDecode::getByteMinus128(bytes[79])); + if (this->top83_sensor_) this->top83_sensor_->publish_state(PanasonicDecode::getByteMinus128(bytes[80])); + if (this->top84_sensor_) this->top84_sensor_->publish_state(PanasonicDecode::getByteMinus128(bytes[82])); + if (this->top85_sensor_) this->top85_sensor_->publish_state(PanasonicDecode::getByteMinus128(bytes[81])); + if (this->top86_sensor_) this->top86_sensor_->publish_state(PanasonicDecode::getByteMinus128(bytes[90])); + if (this->top87_sensor_) this->top87_sensor_->publish_state(PanasonicDecode::getByteMinus128(bytes[91])); + if (this->top88_sensor_) this->top88_sensor_->publish_state(PanasonicDecode::getByteMinus128(bytes[93])); + if (this->top89_sensor_) this->top89_sensor_->publish_state(PanasonicDecode::getByteMinus128(bytes[92])); if (this->top90_sensor_) this->top90_sensor_->publish_state(PanasonicDecode::getWordMinus1(bytes[185], bytes[186])); if (this->top91_sensor_) this->top91_sensor_->publish_state(PanasonicDecode::getWordMinus1(bytes[188], bytes[189])); - if (this->top93_sensor_) this->top93_sensor_->publish_state(PanasonicDecode::getIntMinus1(bytes[172])); - if (this->top95_sensor_) this->top95_sensor_->publish_state(PanasonicDecode::getIntMinus1(bytes[45])); - if (this->top96_sensor_) this->top96_sensor_->publish_state(PanasonicDecode::getIntMinus1(bytes[104])); - if (this->top97_sensor_) this->top97_sensor_->publish_state(PanasonicDecode::getIntMinus128(bytes[105])); - if (this->top98_sensor_) this->top98_sensor_->publish_state(PanasonicDecode::getIntMinus128(bytes[106])); - if (this->top102_sensor_) this->top102_sensor_->publish_state(PanasonicDecode::getIntMinus128(bytes[61])); - if (this->top103_sensor_) this->top103_sensor_->publish_state(PanasonicDecode::getIntMinus128(bytes[62])); - if (this->top104_sensor_) this->top104_sensor_->publish_state(PanasonicDecode::getIntMinus128(bytes[63])); - if (this->top105_sensor_) this->top105_sensor_->publish_state(PanasonicDecode::getIntMinus128(bytes[64])); - if (this->top113_sensor_) this->top113_sensor_->publish_state(PanasonicDecode::getIntMinus128(bytes[59])); - if (this->top115_sensor_) this->top115_sensor_->publish_state(PanasonicDecode::getIntMinus1Div50(bytes[125])); - if (this->top116_sensor_) this->top116_sensor_->publish_state(PanasonicDecode::getIntMinus128(bytes[126])); - if (this->top117_sensor_) this->top117_sensor_->publish_state(PanasonicDecode::getIntMinus128(bytes[127])); - if (this->top118_sensor_) this->top118_sensor_->publish_state(PanasonicDecode::getIntMinus128(bytes[128])); - if (this->top127_sensor_) this->top127_sensor_->publish_state(PanasonicDecode::getIntMinus1Div2(bytes[177])); - if (this->top128_sensor_) this->top128_sensor_->publish_state(PanasonicDecode::getIntMinus1Div2(bytes[178])); - if (this->top131_sensor_) this->top131_sensor_->publish_state(PanasonicDecode::getIntMinus128(bytes[65])); - if (this->top134_sensor_) this->top134_sensor_->publish_state(PanasonicDecode::getIntMinus128(bytes[66])); - if (this->top135_sensor_) this->top135_sensor_->publish_state(PanasonicDecode::getIntMinus128(bytes[68])); - if (this->top136_sensor_) this->top136_sensor_->publish_state(PanasonicDecode::getIntMinus1(bytes[67])); - if (this->top137_sensor_) this->top137_sensor_->publish_state(PanasonicDecode::getIntMinus1(bytes[69])); - if (this->top138_sensor_) this->top138_sensor_->publish_state(PanasonicDecode::getIntMinus1(bytes[70])); + if (this->top93_sensor_) this->top93_sensor_->publish_state(PanasonicDecode::getByteMinus1(bytes[172])); + if (this->top95_sensor_) this->top95_sensor_->publish_state(PanasonicDecode::getByteMinus1(bytes[45])); + if (this->top96_sensor_) this->top96_sensor_->publish_state(PanasonicDecode::getByteMinus1(bytes[104])); + if (this->top97_sensor_) this->top97_sensor_->publish_state(PanasonicDecode::getByteMinus128(bytes[105])); + if (this->top98_sensor_) this->top98_sensor_->publish_state(PanasonicDecode::getByteMinus128(bytes[106])); + if (this->top102_sensor_) this->top102_sensor_->publish_state(PanasonicDecode::getByteMinus128(bytes[61])); + if (this->top103_sensor_) this->top103_sensor_->publish_state(PanasonicDecode::getByteMinus128(bytes[62])); + if (this->top104_sensor_) this->top104_sensor_->publish_state(PanasonicDecode::getByteMinus128(bytes[63])); + if (this->top105_sensor_) this->top105_sensor_->publish_state(PanasonicDecode::getByteMinus128(bytes[64])); + if (this->top113_sensor_) this->top113_sensor_->publish_state(PanasonicDecode::getByteMinus128(bytes[59])); + if (this->top115_sensor_) this->top115_sensor_->publish_state(PanasonicDecode::getByteMinus1Div50(bytes[125])); + if (this->top116_sensor_) this->top116_sensor_->publish_state(PanasonicDecode::getByteMinus128(bytes[126])); + if (this->top117_sensor_) this->top117_sensor_->publish_state(PanasonicDecode::getByteMinus128(bytes[127])); + if (this->top118_sensor_) this->top118_sensor_->publish_state(PanasonicDecode::getByteMinus128(bytes[128])); + if (this->top127_sensor_) this->top127_sensor_->publish_state(PanasonicDecode::getByteMinus1Div2(bytes[177])); + if (this->top128_sensor_) this->top128_sensor_->publish_state(PanasonicDecode::getByteMinus1Div2(bytes[178])); + if (this->top131_sensor_) this->top131_sensor_->publish_state(PanasonicDecode::getByteMinus128(bytes[65])); + if (this->top134_sensor_) this->top134_sensor_->publish_state(PanasonicDecode::getByteMinus128(bytes[66])); + if (this->top135_sensor_) this->top135_sensor_->publish_state(PanasonicDecode::getByteMinus128(bytes[68])); + if (this->top136_sensor_) this->top136_sensor_->publish_state(PanasonicDecode::getByteMinus1(bytes[67])); + if (this->top137_sensor_) this->top137_sensor_->publish_state(PanasonicDecode::getByteMinus1(bytes[69])); + if (this->top138_sensor_) this->top138_sensor_->publish_state(PanasonicDecode::getByteMinus1(bytes[70])); #endif #ifdef USE_BINARY_SENSOR if (this->top0_binary_sensor_) this->top0_binary_sensor_->publish_state(PanasonicDecode::getBinaryState(PanasonicDecode::getBit7and8(bytes[4]))); @@ -493,7 +493,7 @@ namespace esphome #endif #ifdef USE_TEXT_SENSOR if (this->top4_text_sensor_) this->top4_text_sensor_->publish_state(PanasonicDecode::getTextState(PanasonicDecode::OpModeDesc, PanasonicDecode::getOpMode(bytes[6]))); - if (this->top17_text_sensor_) this->top17_text_sensor_->publish_state(PanasonicDecode::getTextState(PanasonicDecode::Powerfulmode, PanasonicDecode::getRight3Bits(bytes[7]))); + if (this->top17_text_sensor_) this->top17_text_sensor_->publish_state(PanasonicDecode::getTextState(PanasonicDecode::Powerfulmode, PanasonicDecode::getBit6and7and8(bytes[7]))); if (this->top18_text_sensor_) this->top18_text_sensor_->publish_state(PanasonicDecode::getTextState(PanasonicDecode::Quietmode, PanasonicDecode::getBit3and4and5(bytes[7]))); if (this->top19_text_sensor_) this->top19_text_sensor_->publish_state(PanasonicDecode::getTextState(PanasonicDecode::HolidayState, PanasonicDecode::getBit3and4(bytes[5]))); if (this->top20_text_sensor_) this->top20_text_sensor_->publish_state(PanasonicDecode::getTextState(PanasonicDecode::Valve, PanasonicDecode::getBit7and8(bytes[111]))); @@ -515,43 +515,43 @@ namespace esphome if (this->top130_text_sensor_) this->top130_text_sensor_->publish_state(PanasonicDecode::getTextState(PanasonicDecode::Bivalent, PanasonicDecode::getBit5and6(bytes[26]))); #endif #ifdef USE_NUMBER - if (this->set11_number_) this->set11_number_->publish_state(PanasonicDecode::getIntMinus128(bytes[42])); - if (this->set20_number_) this->set20_number_->publish_state(PanasonicDecode::getIntMinus128(bytes[99])); - if (this->set18_number_) this->set18_number_->publish_state(PanasonicDecode::getIntMinus128(bytes[84])); - if (this->set19_number_) this->set19_number_->publish_state(PanasonicDecode::getIntMinus128(bytes[94])); - if (this->set5_number_) this->set5_number_->publish_state(PanasonicDecode::getIntMinus128(bytes[38])); - if (this->set6_number_) this->set6_number_->publish_state(PanasonicDecode::getIntMinus128(bytes[39])); - if (this->set16_1_number_) this->set16_1_number_->publish_state(PanasonicDecode::getIntMinus128(bytes[75])); - if (this->set16_2_number_) this->set16_2_number_->publish_state(PanasonicDecode::getIntMinus128(bytes[76])); - if (this->set16_4_number_) this->set16_4_number_->publish_state(PanasonicDecode::getIntMinus128(bytes[78])); - if (this->set16_3_number_) this->set16_3_number_->publish_state(PanasonicDecode::getIntMinus128(bytes[77])); - if (this->set7_number_) this->set7_number_->publish_state(PanasonicDecode::getIntMinus128(bytes[40])); - if (this->set8_number_) this->set8_number_->publish_state(PanasonicDecode::getIntMinus128(bytes[41])); - if (this->set16_9_number_) this->set16_9_number_->publish_state(PanasonicDecode::getIntMinus128(bytes[86])); - if (this->set16_10_number_) this->set16_10_number_->publish_state(PanasonicDecode::getIntMinus128(bytes[87])); - if (this->set16_12_number_) this->set16_12_number_->publish_state(PanasonicDecode::getIntMinus128(bytes[89])); - if (this->set16_11_number_) this->set16_11_number_->publish_state(PanasonicDecode::getIntMinus128(bytes[88])); - if (this->set29_number_) this->set29_number_->publish_state(PanasonicDecode::getIntMinus128(bytes[83])); - if (this->set16_5_number_) this->set16_5_number_->publish_state(PanasonicDecode::getIntMinus128(bytes[79])); - if (this->set16_6_number_) this->set16_6_number_->publish_state(PanasonicDecode::getIntMinus128(bytes[80])); - if (this->set16_8_number_) this->set16_8_number_->publish_state(PanasonicDecode::getIntMinus128(bytes[82])); - if (this->set16_7_number_) this->set16_7_number_->publish_state(PanasonicDecode::getIntMinus128(bytes[81])); - if (this->set16_13_number_) this->set16_13_number_->publish_state(PanasonicDecode::getIntMinus128(bytes[90])); - if (this->set16_14_number_) this->set16_14_number_->publish_state(PanasonicDecode::getIntMinus128(bytes[91])); - if (this->set16_16_number_) this->set16_16_number_->publish_state(PanasonicDecode::getIntMinus128(bytes[93])); - if (this->set16_15_number_) this->set16_15_number_->publish_state(PanasonicDecode::getIntMinus128(bytes[92])); - if (this->set15_number_) this->set15_number_->publish_state(PanasonicDecode::getIntMinus1(bytes[45])); - if (this->set21_number_) this->set21_number_->publish_state(PanasonicDecode::getIntMinus1(bytes[104])); - if (this->set22_number_) this->set22_number_->publish_state(PanasonicDecode::getIntMinus128(bytes[105])); - if (this->set23_number_) this->set23_number_->publish_state(PanasonicDecode::getIntMinus128(bytes[106])); - if (this->set27_number_) this->set27_number_->publish_state(PanasonicDecode::getIntMinus128(bytes[59])); - if (this->set36_number_) this->set36_number_->publish_state(PanasonicDecode::getIntMinus128(bytes[65])); - if (this->set37_number_) this->set37_number_->publish_state(PanasonicDecode::getIntMinus128(bytes[66])); - if (this->set38_number_) this->set38_number_->publish_state(PanasonicDecode::getIntMinus128(bytes[68])); + if (this->set11_number_) this->set11_number_->publish_state(PanasonicDecode::getByteMinus128(bytes[42])); + if (this->set20_number_) this->set20_number_->publish_state(PanasonicDecode::getByteMinus128(bytes[99])); + if (this->set18_number_) this->set18_number_->publish_state(PanasonicDecode::getByteMinus128(bytes[84])); + if (this->set19_number_) this->set19_number_->publish_state(PanasonicDecode::getByteMinus128(bytes[94])); + if (this->set5_number_) this->set5_number_->publish_state(PanasonicDecode::getByteMinus128(bytes[38])); + if (this->set6_number_) this->set6_number_->publish_state(PanasonicDecode::getByteMinus128(bytes[39])); + if (this->set16_1_number_) this->set16_1_number_->publish_state(PanasonicDecode::getByteMinus128(bytes[75])); + if (this->set16_2_number_) this->set16_2_number_->publish_state(PanasonicDecode::getByteMinus128(bytes[76])); + if (this->set16_4_number_) this->set16_4_number_->publish_state(PanasonicDecode::getByteMinus128(bytes[78])); + if (this->set16_3_number_) this->set16_3_number_->publish_state(PanasonicDecode::getByteMinus128(bytes[77])); + if (this->set7_number_) this->set7_number_->publish_state(PanasonicDecode::getByteMinus128(bytes[40])); + if (this->set8_number_) this->set8_number_->publish_state(PanasonicDecode::getByteMinus128(bytes[41])); + if (this->set16_9_number_) this->set16_9_number_->publish_state(PanasonicDecode::getByteMinus128(bytes[86])); + if (this->set16_10_number_) this->set16_10_number_->publish_state(PanasonicDecode::getByteMinus128(bytes[87])); + if (this->set16_12_number_) this->set16_12_number_->publish_state(PanasonicDecode::getByteMinus128(bytes[89])); + if (this->set16_11_number_) this->set16_11_number_->publish_state(PanasonicDecode::getByteMinus128(bytes[88])); + if (this->set29_number_) this->set29_number_->publish_state(PanasonicDecode::getByteMinus128(bytes[83])); + if (this->set16_5_number_) this->set16_5_number_->publish_state(PanasonicDecode::getByteMinus128(bytes[79])); + if (this->set16_6_number_) this->set16_6_number_->publish_state(PanasonicDecode::getByteMinus128(bytes[80])); + if (this->set16_8_number_) this->set16_8_number_->publish_state(PanasonicDecode::getByteMinus128(bytes[82])); + if (this->set16_7_number_) this->set16_7_number_->publish_state(PanasonicDecode::getByteMinus128(bytes[81])); + if (this->set16_13_number_) this->set16_13_number_->publish_state(PanasonicDecode::getByteMinus128(bytes[90])); + if (this->set16_14_number_) this->set16_14_number_->publish_state(PanasonicDecode::getByteMinus128(bytes[91])); + if (this->set16_16_number_) this->set16_16_number_->publish_state(PanasonicDecode::getByteMinus128(bytes[93])); + if (this->set16_15_number_) this->set16_15_number_->publish_state(PanasonicDecode::getByteMinus128(bytes[92])); + if (this->set15_number_) this->set15_number_->publish_state(PanasonicDecode::getByteMinus1(bytes[45])); + if (this->set21_number_) this->set21_number_->publish_state(PanasonicDecode::getByteMinus1(bytes[104])); + if (this->set22_number_) this->set22_number_->publish_state(PanasonicDecode::getByteMinus128(bytes[105])); + if (this->set23_number_) this->set23_number_->publish_state(PanasonicDecode::getByteMinus128(bytes[106])); + if (this->set27_number_) this->set27_number_->publish_state(PanasonicDecode::getByteMinus128(bytes[59])); + if (this->set36_number_) this->set36_number_->publish_state(PanasonicDecode::getByteMinus128(bytes[65])); + if (this->set37_number_) this->set37_number_->publish_state(PanasonicDecode::getByteMinus128(bytes[66])); + if (this->set38_number_) this->set38_number_->publish_state(PanasonicDecode::getByteMinus128(bytes[68])); #endif #ifdef USE_SELECT if (this->set9_select_) this->set9_select_->publish_state(PanasonicDecode::getTextState(PanasonicDecode::OpModeDesc, PanasonicDecode::getOpMode(bytes[6]))); - if (this->set4_select_) this->set4_select_->publish_state(PanasonicDecode::getTextState(PanasonicDecode::Powerfulmode, PanasonicDecode::getRight3Bits(bytes[7]))); + if (this->set4_select_) this->set4_select_->publish_state(PanasonicDecode::getTextState(PanasonicDecode::Powerfulmode, PanasonicDecode::getBit6and7and8(bytes[7]))); if (this->set3_select_) this->set3_select_->publish_state(PanasonicDecode::getTextState(PanasonicDecode::Quietmode, PanasonicDecode::getBit3and4and5(bytes[7]))); if (this->set2_select_) this->set2_select_->publish_state(PanasonicDecode::getTextState(PanasonicDecode::HolidayState, PanasonicDecode::getBit3and4(bytes[5]))); if (this->set17_select_) this->set17_select_->publish_state(PanasonicDecode::getTextState(PanasonicDecode::ZonesState, PanasonicDecode::getBit1and2(bytes[6]))); diff --git a/components/panasonic_heatpump/text_sensor.py b/components/panasonic_heatpump/text_sensor.py index ea9d943..adb8bca 100644 --- a/components/panasonic_heatpump/text_sensor.py +++ b/components/panasonic_heatpump/text_sensor.py @@ -125,8 +125,12 @@ CONFIG_SCHEMA = cv.All( cv.Optional(CONF_TOP114): text_sensor.text_sensor_schema( icon=ICON_EXTERNAL_PAD_HEATER, ), - cv.Optional(CONF_TOP125): text_sensor.text_sensor_schema(), - cv.Optional(CONF_TOP126): text_sensor.text_sensor_schema(), + cv.Optional(CONF_TOP125): text_sensor.text_sensor_schema( + icon=ICON_VALVE, + ), + cv.Optional(CONF_TOP126): text_sensor.text_sensor_schema( + icon=ICON_VALVE, + ), cv.Optional(CONF_TOP130): text_sensor.text_sensor_schema(), } ).extend(cv.COMPONENT_SCHEMA)