Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions components/panasonic_heatpump/sensor/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@

UNIT_LITRE_PER_MINUTE = "L/min"
UNIT_ROTATIONS_PER_MINUTE = "r/min"
UNIT_PRESSURE_KGFCM2 = "kgf/cm²"
UNIT_BAR = "bar"
ICON_PUMP = "mdi:pump"
ICON_VALVE = "mdi:pipe-valve"
Expand Down Expand Up @@ -604,7 +603,7 @@
accuracy_decimals=2,
device_class=DEVICE_CLASS_PRESSURE,
state_class=STATE_CLASS_MEASUREMENT,
unit_of_measurement=UNIT_PRESSURE_KGFCM2,
unit_of_measurement=UNIT_BAR,
),
cv.Optional(CONF_TOP65): sensor.sensor_schema(
PanasonicHeatpumpSensor,
Expand All @@ -618,7 +617,7 @@
accuracy_decimals=2,
device_class=DEVICE_CLASS_PRESSURE,
state_class=STATE_CLASS_MEASUREMENT,
unit_of_measurement=UNIT_PRESSURE_KGFCM2,
unit_of_measurement=UNIT_BAR,
),
cv.Optional(CONF_TOP67): sensor.sensor_schema(
PanasonicHeatpumpSensor,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace esphome {
namespace panasonic_heatpump {
static const char* const TAG = "panasonic_heatpump.sensor";
static constexpr float KGF_CM2_TO_BAR = 0.980665f; // 1 kgf/cm² = 0.980665 bar

void PanasonicHeatpumpSensor::dump_config() {
LOG_SENSOR("", "Panasonic Heatpump Sensor", this);
Expand Down Expand Up @@ -261,7 +262,7 @@ void PanasonicHeatpumpSensor::publish_new_state(const std::vector<uint8_t>& data
return;
break;
case SensorIds::CONF_TOP64:
new_state = PanasonicDecode::getByteMinus1Div5(data[163]);
new_state = PanasonicDecode::getByteMinus1Div5(data[163]) * KGF_CM2_TO_BAR;
if (this->has_state() && this->get_state() == new_state)
return;
break;
Expand All @@ -271,7 +272,7 @@ void PanasonicHeatpumpSensor::publish_new_state(const std::vector<uint8_t>& data
return;
break;
case SensorIds::CONF_TOP66:
new_state = PanasonicDecode::getByteMinus1Times50(data[164]);
new_state = PanasonicDecode::getByteMinus1Times50(data[164]) * KGF_CM2_TO_BAR;
if (this->has_state() && this->get_state() == new_state)
return;
break;
Expand Down
Loading