From 15cee82e12576cbae5273c66b33852ef21f37de1 Mon Sep 17 00:00:00 2001 From: Fabian Date: Mon, 21 Oct 2024 22:14:38 +1100 Subject: [PATCH] Update victron_sensor.cpp --- components/victron_ble/sensor/victron_sensor.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/components/victron_ble/sensor/victron_sensor.cpp b/components/victron_ble/sensor/victron_sensor.cpp index dc4004e..1d00d18 100644 --- a/components/victron_ble/sensor/victron_sensor.cpp +++ b/components/victron_ble/sensor/victron_sensor.cpp @@ -80,7 +80,11 @@ void VictronSensor::setup() { this->publish_state(0.1f * msg->data.inverter.ac_current); break; case VICTRON_BLE_RECORD_TYPE::AC_CHARGER: - this->publish_state(0.1f * msg->data.ac_charger.ac_current); + if (msg->data.ac_charger.ac_current == 0x1FF) { + this->publish_state(NAN); + } else { + this->publish_state(0.1f * msg->data.ac_charger.ac_current); + } break; default: ESP_LOGW(TAG, "[%s] Device has no `ac current` field.", this->parent_->address_str().c_str()); @@ -595,7 +599,7 @@ void VictronSensor::setup() { } break; case VICTRON_BLE_RECORD_TYPE::AC_CHARGER: - if (msg->data.ac_charger.battery_temperature == 0x7F) { + if (msg->data.ac_charger.temperature == 0x7F) { this->publish_state(NAN); } else { this->publish_state(-40.0f + msg->data.ac_charger.temperature);