Show battery temperature when sensor is present (#511)
This commit is contained in:
parent
c5427dedce
commit
8ba9048f99
@ -111,6 +111,7 @@ class VictronSmartShuntStats : public BatteryStats {
|
|||||||
float _voltage;
|
float _voltage;
|
||||||
float _current;
|
float _current;
|
||||||
float _temperature;
|
float _temperature;
|
||||||
|
bool _tempPresent;
|
||||||
uint8_t _chargeCycles;
|
uint8_t _chargeCycles;
|
||||||
uint32_t _timeToGo;
|
uint32_t _timeToGo;
|
||||||
float _chargedEnergy;
|
float _chargedEnergy;
|
||||||
|
|||||||
@ -23,6 +23,7 @@ void VeDirectShuntController::textRxEvent(char* name, char* value)
|
|||||||
|
|
||||||
if (strcmp(name, "T") == 0) {
|
if (strcmp(name, "T") == 0) {
|
||||||
_tmpFrame.T = atoi(value);
|
_tmpFrame.T = atoi(value);
|
||||||
|
_tmpFrame.tempPresent = true;
|
||||||
}
|
}
|
||||||
else if (strcmp(name, "P") == 0) {
|
else if (strcmp(name, "P") == 0) {
|
||||||
_tmpFrame.P = atoi(value);
|
_tmpFrame.P = atoi(value);
|
||||||
|
|||||||
@ -11,6 +11,7 @@ public:
|
|||||||
|
|
||||||
struct veShuntStruct : veStruct {
|
struct veShuntStruct : veStruct {
|
||||||
int32_t T; // Battery temperature
|
int32_t T; // Battery temperature
|
||||||
|
bool tempPresent = false; // Battery temperature sensor is attached to the shunt
|
||||||
int32_t P; // Instantaneous power
|
int32_t P; // Instantaneous power
|
||||||
int32_t CE; // Consumed Amp Hours
|
int32_t CE; // Consumed Amp Hours
|
||||||
int32_t SOC; // State-of-charge
|
int32_t SOC; // State-of-charge
|
||||||
|
|||||||
@ -214,6 +214,8 @@ void VictronSmartShuntStats::updateFrom(VeDirectShuntController::veShuntStruct c
|
|||||||
_chargedEnergy = shuntData.H18 / 100;
|
_chargedEnergy = shuntData.H18 / 100;
|
||||||
_dischargedEnergy = shuntData.H17 / 100;
|
_dischargedEnergy = shuntData.H17 / 100;
|
||||||
_manufacturer = "Victron " + _modelName;
|
_manufacturer = "Victron " + _modelName;
|
||||||
|
_temperature = shuntData.T;
|
||||||
|
_tempPresent = shuntData.tempPresent;
|
||||||
|
|
||||||
// shuntData.AR is a bitfield, so we need to check each bit individually
|
// shuntData.AR is a bitfield, so we need to check each bit individually
|
||||||
_alarmLowVoltage = shuntData.AR & 1;
|
_alarmLowVoltage = shuntData.AR & 1;
|
||||||
@ -235,6 +237,9 @@ void VictronSmartShuntStats::getLiveViewData(JsonVariant& root) const {
|
|||||||
addLiveViewValue(root, "chargeCycles", _chargeCycles, "", 0);
|
addLiveViewValue(root, "chargeCycles", _chargeCycles, "", 0);
|
||||||
addLiveViewValue(root, "chargedEnergy", _chargedEnergy, "KWh", 1);
|
addLiveViewValue(root, "chargedEnergy", _chargedEnergy, "KWh", 1);
|
||||||
addLiveViewValue(root, "dischargedEnergy", _dischargedEnergy, "KWh", 1);
|
addLiveViewValue(root, "dischargedEnergy", _dischargedEnergy, "KWh", 1);
|
||||||
|
if (_tempPresent) {
|
||||||
|
addLiveViewValue(root, "temperature", _temperature, "°C", 0);
|
||||||
|
}
|
||||||
|
|
||||||
addLiveViewAlarm(root, "lowVoltage", _alarmLowVoltage);
|
addLiveViewAlarm(root, "lowVoltage", _alarmLowVoltage);
|
||||||
addLiveViewAlarm(root, "highVoltage", _alarmHighVoltage);
|
addLiveViewAlarm(root, "highVoltage", _alarmHighVoltage);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user