add new Victron SmartShunt values to liveView and MQTT (HASS)
This commit is contained in:
parent
45c7243937
commit
4f0385285c
@ -152,6 +152,9 @@ class VictronSmartShuntStats : public BatteryStats {
|
|||||||
float _chargedEnergy;
|
float _chargedEnergy;
|
||||||
float _dischargedEnergy;
|
float _dischargedEnergy;
|
||||||
String _modelName;
|
String _modelName;
|
||||||
|
int32_t _instantaneousPower;
|
||||||
|
float _consumedAmpHours;
|
||||||
|
int32_t _lastFullCharge;
|
||||||
|
|
||||||
bool _alarmLowVoltage;
|
bool _alarmLowVoltage;
|
||||||
bool _alarmHighVoltage;
|
bool _alarmHighVoltage;
|
||||||
|
|||||||
@ -384,7 +384,9 @@ void VictronSmartShuntStats::updateFrom(VeDirectShuntController::veShuntStruct c
|
|||||||
_manufacturer = "Victron " + _modelName;
|
_manufacturer = "Victron " + _modelName;
|
||||||
_temperature = shuntData.T;
|
_temperature = shuntData.T;
|
||||||
_tempPresent = shuntData.tempPresent;
|
_tempPresent = shuntData.tempPresent;
|
||||||
|
_instantaneousPower = shuntData.P;
|
||||||
|
_consumedAmpHours = static_cast<float>(shuntData.CE) / 1000;
|
||||||
|
_lastFullCharge = shuntData.H9 / 60;
|
||||||
// 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;
|
||||||
_alarmHighVoltage = shuntData.AR & 2;
|
_alarmHighVoltage = shuntData.AR & 2;
|
||||||
@ -403,6 +405,9 @@ void VictronSmartShuntStats::getLiveViewData(JsonVariant& root) const {
|
|||||||
addLiveViewValue(root, "chargeCycles", _chargeCycles, "", 0);
|
addLiveViewValue(root, "chargeCycles", _chargeCycles, "", 0);
|
||||||
addLiveViewValue(root, "chargedEnergy", _chargedEnergy, "kWh", 2);
|
addLiveViewValue(root, "chargedEnergy", _chargedEnergy, "kWh", 2);
|
||||||
addLiveViewValue(root, "dischargedEnergy", _dischargedEnergy, "kWh", 2);
|
addLiveViewValue(root, "dischargedEnergy", _dischargedEnergy, "kWh", 2);
|
||||||
|
addLiveViewValue(root, "instantaneousPower", _instantaneousPower, "W", 0);
|
||||||
|
addLiveViewValue(root, "consumedAmpHours", _consumedAmpHours, "Ah", 3);
|
||||||
|
addLiveViewValue(root, "lastFullCharge", _lastFullCharge, "min", 0);
|
||||||
if (_tempPresent) {
|
if (_tempPresent) {
|
||||||
addLiveViewValue(root, "temperature", _temperature, "°C", 0);
|
addLiveViewValue(root, "temperature", _temperature, "°C", 0);
|
||||||
}
|
}
|
||||||
@ -421,4 +426,7 @@ void VictronSmartShuntStats::mqttPublish() const {
|
|||||||
MqttSettings.publish(F("battery/chargeCycles"), String(_chargeCycles));
|
MqttSettings.publish(F("battery/chargeCycles"), String(_chargeCycles));
|
||||||
MqttSettings.publish(F("battery/chargedEnergy"), String(_chargedEnergy));
|
MqttSettings.publish(F("battery/chargedEnergy"), String(_chargedEnergy));
|
||||||
MqttSettings.publish(F("battery/dischargedEnergy"), String(_dischargedEnergy));
|
MqttSettings.publish(F("battery/dischargedEnergy"), String(_dischargedEnergy));
|
||||||
|
MqttSettings.publish(F("battery/instantaneousPower"), String(_instantaneousPower));
|
||||||
|
MqttSettings.publish(F("battery/consumedAmpHours"), String(_consumedAmpHours));
|
||||||
|
MqttSettings.publish(F("battery/lastFullCharge"), String(_lastFullCharge));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -111,6 +111,14 @@ void MqttHandleBatteryHassClass::loop()
|
|||||||
case 2: // SoC from MQTT
|
case 2: // SoC from MQTT
|
||||||
break;
|
break;
|
||||||
case 3: // Victron SmartShunt
|
case 3: // Victron SmartShunt
|
||||||
|
publishSensor("Voltage", "mdi:battery-charging", "voltage", "voltage", "measurement", "V");
|
||||||
|
publishSensor("Current", "mdi:current-dc", "current", "current", "measurement", "A");
|
||||||
|
publishSensor("Instantaneous Power", NULL, "instantaneousPower", "power", "measurement", "W");
|
||||||
|
publishSensor("Charged Energy", NULL, "chargedEnergy", "energy", "total_increasing", "kWh");
|
||||||
|
publishSensor("Discharged Energy", NULL, "dischargedEnergy", "energy", "total_increasing", "kWh");
|
||||||
|
publishSensor("Charge Cycles", "mdi:counter", "chargeCycles");
|
||||||
|
publishSensor("Consumed Amp Hours", NULL, "consumedAmpHours", NULL, "measurement", "Ah");
|
||||||
|
publishSensor("Last Full Charge", "mdi:timelapse", "lastFullCharge", NULL, NULL, "min");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -901,6 +901,9 @@
|
|||||||
"bmsInternal": "BMS intern",
|
"bmsInternal": "BMS intern",
|
||||||
"chargeCycles": "Ladezyklen",
|
"chargeCycles": "Ladezyklen",
|
||||||
"chargedEnergy": "Geladene Energie",
|
"chargedEnergy": "Geladene Energie",
|
||||||
"dischargedEnergy": "Entladene Energie"
|
"dischargedEnergy": "Entladene Energie",
|
||||||
|
"instantaneousPower": "Aktuelle Leistung",
|
||||||
|
"consumedAmpHours": "Verbrauche Amperestunden",
|
||||||
|
"lastFullCharge": "Letztes mal Vollgeladen"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -908,6 +908,9 @@
|
|||||||
"bmsInternal": "BMS internal",
|
"bmsInternal": "BMS internal",
|
||||||
"chargeCycles": "Charge cycles",
|
"chargeCycles": "Charge cycles",
|
||||||
"chargedEnergy": "Charged energy",
|
"chargedEnergy": "Charged energy",
|
||||||
"dischargedEnergy": "Discharged energy"
|
"dischargedEnergy": "Discharged energy",
|
||||||
|
"instantaneousPower": "Instantaneous Power",
|
||||||
|
"consumedAmpHours": "Consumed Amp Hours",
|
||||||
|
"lastFullCharge": "Last full Charge"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -816,7 +816,7 @@
|
|||||||
"Close": "close",
|
"Close": "close",
|
||||||
"SetVoltageLimit": "Voltage limit:",
|
"SetVoltageLimit": "Voltage limit:",
|
||||||
"SetCurrentLimit": "Current limit:",
|
"SetCurrentLimit": "Current limit:",
|
||||||
"CurrentLimit": "Current limit:"
|
"CurrentLimit": "Current limit:"
|
||||||
},
|
},
|
||||||
"acchargeradmin": {
|
"acchargeradmin": {
|
||||||
"ChargerSettings": "AC Charger Settings",
|
"ChargerSettings": "AC Charger Settings",
|
||||||
@ -899,6 +899,9 @@
|
|||||||
"bmsInternal": "BMS internal",
|
"bmsInternal": "BMS internal",
|
||||||
"chargeCycles": "Charge cycles",
|
"chargeCycles": "Charge cycles",
|
||||||
"chargedEnergy": "Charged energy",
|
"chargedEnergy": "Charged energy",
|
||||||
"dischargedEnergy": "Discharged energy"
|
"dischargedEnergy": "Discharged energy",
|
||||||
|
"instantaneousPower": "Instantaneous Power",
|
||||||
|
"consumedAmpHours": "Consumed Amp Hours",
|
||||||
|
"lastFullCharge": "Last full Charge"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user