Merge pull request #679 from schlimmchen/dpl-voltage-features
DPL Voltage Features
This commit is contained in:
commit
1eb75c322d
@ -17,9 +17,12 @@ class BatteryStats {
|
|||||||
uint32_t getAgeSeconds() const { return (millis() - _lastUpdate) / 1000; }
|
uint32_t getAgeSeconds() const { return (millis() - _lastUpdate) / 1000; }
|
||||||
bool updateAvailable(uint32_t since) const { return _lastUpdate > since; }
|
bool updateAvailable(uint32_t since) const { return _lastUpdate > since; }
|
||||||
|
|
||||||
uint8_t getSoC() const { return _SoC; }
|
uint8_t getSoC() const { return _soc; }
|
||||||
uint32_t getSoCAgeSeconds() const { return (millis() - _lastUpdateSoC) / 1000; }
|
uint32_t getSoCAgeSeconds() const { return (millis() - _lastUpdateSoC) / 1000; }
|
||||||
|
|
||||||
|
float getVoltage() const { return _voltage; }
|
||||||
|
uint32_t getVoltageAgeSeconds() const { return (millis() - _lastUpdateVoltage) / 1000; }
|
||||||
|
|
||||||
// convert stats to JSON for web application live view
|
// convert stats to JSON for web application live view
|
||||||
virtual void getLiveViewData(JsonVariant& root) const;
|
virtual void getLiveViewData(JsonVariant& root) const;
|
||||||
|
|
||||||
@ -29,18 +32,33 @@ class BatteryStats {
|
|||||||
// if they did not change. used to calculate Home Assistent expiration.
|
// if they did not change. used to calculate Home Assistent expiration.
|
||||||
virtual uint32_t getMqttFullPublishIntervalMs() const;
|
virtual uint32_t getMqttFullPublishIntervalMs() const;
|
||||||
|
|
||||||
bool isValid() const { return _lastUpdateSoC > 0 && _lastUpdate > 0; }
|
bool isSoCValid() const { return _lastUpdateSoC > 0; }
|
||||||
|
bool isVoltageValid() const { return _lastUpdateVoltage > 0; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void mqttPublish() const;
|
virtual void mqttPublish() const;
|
||||||
|
|
||||||
|
void setSoC(float soc, uint8_t precision, uint32_t timestamp) {
|
||||||
|
_soc = soc;
|
||||||
|
_socPrecision = precision;
|
||||||
|
_lastUpdateSoC = timestamp;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setVoltage(float voltage, uint32_t timestamp) {
|
||||||
|
_voltage = voltage;
|
||||||
|
_lastUpdateVoltage = timestamp;
|
||||||
|
}
|
||||||
|
|
||||||
String _manufacturer = "unknown";
|
String _manufacturer = "unknown";
|
||||||
uint8_t _SoC = 0;
|
|
||||||
uint32_t _lastUpdateSoC = 0;
|
|
||||||
uint32_t _lastUpdate = 0;
|
uint32_t _lastUpdate = 0;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint32_t _lastMqttPublish = 0;
|
uint32_t _lastMqttPublish = 0;
|
||||||
|
float _soc = 0;
|
||||||
|
uint8_t _socPrecision = 0; // decimal places
|
||||||
|
uint32_t _lastUpdateSoC = 0;
|
||||||
|
float _voltage = 0; // total battery pack voltage
|
||||||
|
uint32_t _lastUpdateVoltage = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class PylontechBatteryStats : public BatteryStats {
|
class PylontechBatteryStats : public BatteryStats {
|
||||||
@ -52,14 +70,12 @@ class PylontechBatteryStats : public BatteryStats {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void setManufacturer(String&& m) { _manufacturer = std::move(m); }
|
void setManufacturer(String&& m) { _manufacturer = std::move(m); }
|
||||||
void setSoC(uint8_t SoC) { _SoC = SoC; _lastUpdateSoC = millis(); }
|
|
||||||
void setLastUpdate(uint32_t ts) { _lastUpdate = ts; }
|
void setLastUpdate(uint32_t ts) { _lastUpdate = ts; }
|
||||||
|
|
||||||
float _chargeVoltage;
|
float _chargeVoltage;
|
||||||
float _chargeCurrentLimitation;
|
float _chargeCurrentLimitation;
|
||||||
float _dischargeCurrentLimitation;
|
float _dischargeCurrentLimitation;
|
||||||
uint16_t _stateOfHealth;
|
uint16_t _stateOfHealth;
|
||||||
float _voltage; // total voltage of the battery pack
|
|
||||||
// total current into (positive) or from (negative)
|
// total current into (positive) or from (negative)
|
||||||
// the battery, i.e., the charging current
|
// the battery, i.e., the charging current
|
||||||
float _current;
|
float _current;
|
||||||
@ -123,7 +139,6 @@ class VictronSmartShuntStats : public BatteryStats {
|
|||||||
void updateFrom(VeDirectShuntController::veShuntStruct const& shuntData);
|
void updateFrom(VeDirectShuntController::veShuntStruct const& shuntData);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
float _voltage;
|
|
||||||
float _current;
|
float _current;
|
||||||
float _temperature;
|
float _temperature;
|
||||||
bool _tempPresent;
|
bool _tempPresent;
|
||||||
@ -141,14 +156,14 @@ class VictronSmartShuntStats : public BatteryStats {
|
|||||||
};
|
};
|
||||||
|
|
||||||
class MqttBatteryStats : public BatteryStats {
|
class MqttBatteryStats : public BatteryStats {
|
||||||
|
friend class MqttBattery;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// since the source of information was MQTT in the first place,
|
// since the source of information was MQTT in the first place,
|
||||||
// we do NOT publish the same data under a different topic.
|
// we do NOT publish the same data under a different topic.
|
||||||
void mqttPublish() const final { }
|
void mqttPublish() const final { }
|
||||||
|
|
||||||
// the SoC is the only interesting value in this case, which is already
|
// if the voltage is subscribed to at all, it alone does not warrant a
|
||||||
// displayed at the top of the live view. do not generate a card.
|
// card in the live view, since the SoC is already displayed at the top
|
||||||
void getLiveViewData(JsonVariant& root) const final { }
|
void getLiveViewData(JsonVariant& root) const final { }
|
||||||
|
|
||||||
void setSoC(uint8_t SoC) { _SoC = SoC; _lastUpdateSoC = _lastUpdate = millis(); }
|
|
||||||
};
|
};
|
||||||
|
|||||||
@ -213,6 +213,7 @@ struct CONFIG_T {
|
|||||||
int32_t TargetPowerConsumptionHysteresis;
|
int32_t TargetPowerConsumptionHysteresis;
|
||||||
int32_t LowerPowerLimit;
|
int32_t LowerPowerLimit;
|
||||||
int32_t UpperPowerLimit;
|
int32_t UpperPowerLimit;
|
||||||
|
bool IgnoreSoc;
|
||||||
uint32_t BatterySocStartThreshold;
|
uint32_t BatterySocStartThreshold;
|
||||||
uint32_t BatterySocStopThreshold;
|
uint32_t BatterySocStopThreshold;
|
||||||
float VoltageStartThreshold;
|
float VoltageStartThreshold;
|
||||||
@ -230,7 +231,8 @@ struct CONFIG_T {
|
|||||||
uint8_t Provider;
|
uint8_t Provider;
|
||||||
uint8_t JkBmsInterface;
|
uint8_t JkBmsInterface;
|
||||||
uint8_t JkBmsPollingInterval;
|
uint8_t JkBmsPollingInterval;
|
||||||
char MqttTopic[MQTT_MAX_TOPIC_STRLEN + 1];
|
char MqttSocTopic[MQTT_MAX_TOPIC_STRLEN + 1];
|
||||||
|
char MqttVoltageTopic[MQTT_MAX_TOPIC_STRLEN + 1];
|
||||||
} Battery;
|
} Battery;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <optional>
|
||||||
#include "Battery.h"
|
#include "Battery.h"
|
||||||
#include <espMqttClient.h>
|
#include <espMqttClient.h>
|
||||||
|
|
||||||
@ -15,8 +16,12 @@ class MqttBattery : public BatteryProvider {
|
|||||||
private:
|
private:
|
||||||
bool _verboseLogging = false;
|
bool _verboseLogging = false;
|
||||||
String _socTopic;
|
String _socTopic;
|
||||||
|
String _voltageTopic;
|
||||||
std::shared_ptr<MqttBatteryStats> _stats = std::make_shared<MqttBatteryStats>();
|
std::shared_ptr<MqttBatteryStats> _stats = std::make_shared<MqttBatteryStats>();
|
||||||
|
|
||||||
void onMqttMessage(espMqttClientTypes::MessageProperties const& properties,
|
std::optional<float> getFloat(std::string const& src, char const* topic);
|
||||||
|
void onMqttMessageSoC(espMqttClientTypes::MessageProperties const& properties,
|
||||||
|
char const* topic, uint8_t const* payload, size_t len, size_t index, size_t total);
|
||||||
|
void onMqttMessageVoltage(espMqttClientTypes::MessageProperties const& properties,
|
||||||
char const* topic, uint8_t const* payload, size_t len, size_t index, size_t total);
|
char const* topic, uint8_t const* payload, size_t len, size_t index, size_t total);
|
||||||
};
|
};
|
||||||
|
|||||||
@ -88,6 +88,7 @@ private:
|
|||||||
void announceStatus(Status status);
|
void announceStatus(Status status);
|
||||||
bool shutdown(Status status);
|
bool shutdown(Status status);
|
||||||
bool shutdown() { return shutdown(_lastStatus); }
|
bool shutdown() { return shutdown(_lastStatus); }
|
||||||
|
float getBatteryVoltage(bool log = false);
|
||||||
int32_t inverterPowerDcToAc(std::shared_ptr<InverterAbstract> inverter, int32_t dcPower);
|
int32_t inverterPowerDcToAc(std::shared_ptr<InverterAbstract> inverter, int32_t dcPower);
|
||||||
void unconditionalSolarPassthrough(std::shared_ptr<InverterAbstract> inverter);
|
void unconditionalSolarPassthrough(std::shared_ptr<InverterAbstract> inverter);
|
||||||
bool canUseDirectSolarPower();
|
bool canUseDirectSolarPower();
|
||||||
|
|||||||
@ -35,6 +35,9 @@ public:
|
|||||||
// sum of today's yield of all MPPT charge controllers in kWh
|
// sum of today's yield of all MPPT charge controllers in kWh
|
||||||
double getYieldDay() const;
|
double getYieldDay() const;
|
||||||
|
|
||||||
|
// minimum of all MPPT charge controllers' output voltages in V
|
||||||
|
double getOutputVoltage() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void loop();
|
void loop();
|
||||||
VictronMpptClass(VictronMpptClass const& other) = delete;
|
VictronMpptClass(VictronMpptClass const& other) = delete;
|
||||||
|
|||||||
@ -128,6 +128,7 @@
|
|||||||
#define POWERLIMITER_TARGET_POWER_CONSUMPTION_HYSTERESIS 0
|
#define POWERLIMITER_TARGET_POWER_CONSUMPTION_HYSTERESIS 0
|
||||||
#define POWERLIMITER_LOWER_POWER_LIMIT 10
|
#define POWERLIMITER_LOWER_POWER_LIMIT 10
|
||||||
#define POWERLIMITER_UPPER_POWER_LIMIT 800
|
#define POWERLIMITER_UPPER_POWER_LIMIT 800
|
||||||
|
#define POWERLIMITER_IGNORE_SOC false
|
||||||
#define POWERLIMITER_BATTERY_SOC_START_THRESHOLD 80
|
#define POWERLIMITER_BATTERY_SOC_START_THRESHOLD 80
|
||||||
#define POWERLIMITER_BATTERY_SOC_STOP_THRESHOLD 20
|
#define POWERLIMITER_BATTERY_SOC_STOP_THRESHOLD 20
|
||||||
#define POWERLIMITER_VOLTAGE_START_THRESHOLD 50.0
|
#define POWERLIMITER_VOLTAGE_START_THRESHOLD 50.0
|
||||||
|
|||||||
@ -56,7 +56,8 @@ void BatteryStats::getLiveViewData(JsonVariant& root) const
|
|||||||
root[F("manufacturer")] = _manufacturer;
|
root[F("manufacturer")] = _manufacturer;
|
||||||
root[F("data_age")] = getAgeSeconds();
|
root[F("data_age")] = getAgeSeconds();
|
||||||
|
|
||||||
addLiveViewValue(root, "SoC", _SoC, "%", 0);
|
addLiveViewValue(root, "SoC", _soc, "%", _socPrecision);
|
||||||
|
addLiveViewValue(root, "voltage", _voltage, "V", 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PylontechBatteryStats::getLiveViewData(JsonVariant& root) const
|
void PylontechBatteryStats::getLiveViewData(JsonVariant& root) const
|
||||||
@ -68,7 +69,6 @@ void PylontechBatteryStats::getLiveViewData(JsonVariant& root) const
|
|||||||
addLiveViewValue(root, "chargeCurrentLimitation", _chargeCurrentLimitation, "A", 1);
|
addLiveViewValue(root, "chargeCurrentLimitation", _chargeCurrentLimitation, "A", 1);
|
||||||
addLiveViewValue(root, "dischargeCurrentLimitation", _dischargeCurrentLimitation, "A", 1);
|
addLiveViewValue(root, "dischargeCurrentLimitation", _dischargeCurrentLimitation, "A", 1);
|
||||||
addLiveViewValue(root, "stateOfHealth", _stateOfHealth, "%", 0);
|
addLiveViewValue(root, "stateOfHealth", _stateOfHealth, "%", 0);
|
||||||
addLiveViewValue(root, "voltage", _voltage, "V", 2);
|
|
||||||
addLiveViewValue(root, "current", _current, "A", 1);
|
addLiveViewValue(root, "current", _current, "A", 1);
|
||||||
addLiveViewValue(root, "temperature", _temperature, "°C", 1);
|
addLiveViewValue(root, "temperature", _temperature, "°C", 1);
|
||||||
|
|
||||||
@ -105,18 +105,13 @@ void JkBmsBatteryStats::getJsonData(JsonVariant& root, bool verbose) const
|
|||||||
|
|
||||||
using Label = JkBms::DataPointLabel;
|
using Label = JkBms::DataPointLabel;
|
||||||
|
|
||||||
auto oVoltage = _dataPoints.get<Label::BatteryVoltageMilliVolt>();
|
|
||||||
if (oVoltage.has_value()) {
|
|
||||||
addLiveViewValue(root, "voltage",
|
|
||||||
static_cast<float>(*oVoltage) / 1000, "V", 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
auto oCurrent = _dataPoints.get<Label::BatteryCurrentMilliAmps>();
|
auto oCurrent = _dataPoints.get<Label::BatteryCurrentMilliAmps>();
|
||||||
if (oCurrent.has_value()) {
|
if (oCurrent.has_value()) {
|
||||||
addLiveViewValue(root, "current",
|
addLiveViewValue(root, "current",
|
||||||
static_cast<float>(*oCurrent) / 1000, "A", 2);
|
static_cast<float>(*oCurrent) / 1000, "A", 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto oVoltage = _dataPoints.get<Label::BatteryVoltageMilliVolt>();
|
||||||
if (oVoltage.has_value() && oCurrent.has_value()) {
|
if (oVoltage.has_value() && oCurrent.has_value()) {
|
||||||
auto current = static_cast<float>(*oCurrent) / 1000;
|
auto current = static_cast<float>(*oCurrent) / 1000;
|
||||||
auto voltage = static_cast<float>(*oVoltage) / 1000;
|
auto voltage = static_cast<float>(*oVoltage) / 1000;
|
||||||
@ -217,7 +212,8 @@ void BatteryStats::mqttPublish() const
|
|||||||
{
|
{
|
||||||
MqttSettings.publish(F("battery/manufacturer"), _manufacturer);
|
MqttSettings.publish(F("battery/manufacturer"), _manufacturer);
|
||||||
MqttSettings.publish(F("battery/dataAge"), String(getAgeSeconds()));
|
MqttSettings.publish(F("battery/dataAge"), String(getAgeSeconds()));
|
||||||
MqttSettings.publish(F("battery/stateOfCharge"), String(_SoC));
|
MqttSettings.publish(F("battery/stateOfCharge"), String(_soc));
|
||||||
|
MqttSettings.publish(F("battery/voltage"), String(_voltage));
|
||||||
}
|
}
|
||||||
|
|
||||||
void PylontechBatteryStats::mqttPublish() const
|
void PylontechBatteryStats::mqttPublish() const
|
||||||
@ -228,7 +224,6 @@ void PylontechBatteryStats::mqttPublish() const
|
|||||||
MqttSettings.publish(F("battery/settings/chargeCurrentLimitation"), String(_chargeCurrentLimitation));
|
MqttSettings.publish(F("battery/settings/chargeCurrentLimitation"), String(_chargeCurrentLimitation));
|
||||||
MqttSettings.publish(F("battery/settings/dischargeCurrentLimitation"), String(_dischargeCurrentLimitation));
|
MqttSettings.publish(F("battery/settings/dischargeCurrentLimitation"), String(_dischargeCurrentLimitation));
|
||||||
MqttSettings.publish(F("battery/stateOfHealth"), String(_stateOfHealth));
|
MqttSettings.publish(F("battery/stateOfHealth"), String(_stateOfHealth));
|
||||||
MqttSettings.publish(F("battery/voltage"), String(_voltage));
|
|
||||||
MqttSettings.publish(F("battery/current"), String(_current));
|
MqttSettings.publish(F("battery/current"), String(_current));
|
||||||
MqttSettings.publish(F("battery/temperature"), String(_temperature));
|
MqttSettings.publish(F("battery/temperature"), String(_temperature));
|
||||||
MqttSettings.publish(F("battery/alarm/overCurrentDischarge"), String(_alarmOverCurrentDischarge));
|
MqttSettings.publish(F("battery/alarm/overCurrentDischarge"), String(_alarmOverCurrentDischarge));
|
||||||
@ -260,6 +255,10 @@ void JkBmsBatteryStats::mqttPublish() const
|
|||||||
Label::CellsMilliVolt, // complex data format
|
Label::CellsMilliVolt, // complex data format
|
||||||
Label::ModificationPassword, // sensitive data
|
Label::ModificationPassword, // sensitive data
|
||||||
Label::BatterySoCPercent // already published by base class
|
Label::BatterySoCPercent // already published by base class
|
||||||
|
// NOTE that voltage is also published by the base class, however, we
|
||||||
|
// previously published it only from here using the respective topic.
|
||||||
|
// to avoid a breaking change, we publish the value again using the
|
||||||
|
// "old" topic.
|
||||||
};
|
};
|
||||||
|
|
||||||
// regularly publish all topics regardless of whether or not their value changed
|
// regularly publish all topics regardless of whether or not their value changed
|
||||||
@ -335,9 +334,16 @@ void JkBmsBatteryStats::updateFrom(JkBms::DataPointContainer const& dp)
|
|||||||
|
|
||||||
auto oSoCValue = dp.get<Label::BatterySoCPercent>();
|
auto oSoCValue = dp.get<Label::BatterySoCPercent>();
|
||||||
if (oSoCValue.has_value()) {
|
if (oSoCValue.has_value()) {
|
||||||
_SoC = *oSoCValue;
|
|
||||||
auto oSoCDataPoint = dp.getDataPointFor<Label::BatterySoCPercent>();
|
auto oSoCDataPoint = dp.getDataPointFor<Label::BatterySoCPercent>();
|
||||||
_lastUpdateSoC = oSoCDataPoint->getTimestamp();
|
BatteryStats::setSoC(*oSoCValue, 0/*precision*/,
|
||||||
|
oSoCDataPoint->getTimestamp());
|
||||||
|
}
|
||||||
|
|
||||||
|
auto oVoltage = dp.get<Label::BatteryVoltageMilliVolt>();
|
||||||
|
if (oVoltage.has_value()) {
|
||||||
|
auto oVoltageDataPoint = dp.getDataPointFor<Label::BatteryVoltageMilliVolt>();
|
||||||
|
BatteryStats::setVoltage(static_cast<float>(*oVoltage) / 1000,
|
||||||
|
oVoltageDataPoint->getTimestamp());
|
||||||
}
|
}
|
||||||
|
|
||||||
_dataPoints.updateFrom(dp);
|
_dataPoints.updateFrom(dp);
|
||||||
@ -360,8 +366,9 @@ void JkBmsBatteryStats::updateFrom(JkBms::DataPointContainer const& dp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void VictronSmartShuntStats::updateFrom(VeDirectShuntController::veShuntStruct const& shuntData) {
|
void VictronSmartShuntStats::updateFrom(VeDirectShuntController::veShuntStruct const& shuntData) {
|
||||||
_SoC = shuntData.SOC / 10;
|
BatteryStats::setVoltage(shuntData.V, millis());
|
||||||
_voltage = shuntData.V;
|
BatteryStats::setSoC(static_cast<float>(shuntData.SOC) / 10, 1/*precision*/, millis());
|
||||||
|
|
||||||
_current = shuntData.I;
|
_current = shuntData.I;
|
||||||
_modelName = shuntData.getPidAsString().data();
|
_modelName = shuntData.getPidAsString().data();
|
||||||
_chargeCycles = shuntData.H4;
|
_chargeCycles = shuntData.H4;
|
||||||
@ -380,14 +387,12 @@ void VictronSmartShuntStats::updateFrom(VeDirectShuntController::veShuntStruct c
|
|||||||
_alarmHighTemperature = shuntData.AR & 64;
|
_alarmHighTemperature = shuntData.AR & 64;
|
||||||
|
|
||||||
_lastUpdate = VeDirectShunt.getLastUpdate();
|
_lastUpdate = VeDirectShunt.getLastUpdate();
|
||||||
_lastUpdateSoC = VeDirectShunt.getLastUpdate();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void VictronSmartShuntStats::getLiveViewData(JsonVariant& root) const {
|
void VictronSmartShuntStats::getLiveViewData(JsonVariant& root) const {
|
||||||
BatteryStats::getLiveViewData(root);
|
BatteryStats::getLiveViewData(root);
|
||||||
|
|
||||||
// values go into the "Status" card of the web application
|
// values go into the "Status" card of the web application
|
||||||
addLiveViewValue(root, "voltage", _voltage, "V", 2);
|
|
||||||
addLiveViewValue(root, "current", _current, "A", 1);
|
addLiveViewValue(root, "current", _current, "A", 1);
|
||||||
addLiveViewValue(root, "chargeCycles", _chargeCycles, "", 0);
|
addLiveViewValue(root, "chargeCycles", _chargeCycles, "", 0);
|
||||||
addLiveViewValue(root, "chargedEnergy", _chargedEnergy, "KWh", 1);
|
addLiveViewValue(root, "chargedEnergy", _chargedEnergy, "KWh", 1);
|
||||||
@ -406,7 +411,6 @@ void VictronSmartShuntStats::getLiveViewData(JsonVariant& root) const {
|
|||||||
void VictronSmartShuntStats::mqttPublish() const {
|
void VictronSmartShuntStats::mqttPublish() const {
|
||||||
BatteryStats::mqttPublish();
|
BatteryStats::mqttPublish();
|
||||||
|
|
||||||
MqttSettings.publish(F("battery/voltage"), String(_voltage));
|
|
||||||
MqttSettings.publish(F("battery/current"), String(_current));
|
MqttSettings.publish(F("battery/current"), String(_current));
|
||||||
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));
|
||||||
|
|||||||
@ -191,6 +191,7 @@ bool ConfigurationClass::write()
|
|||||||
powerlimiter["target_power_consumption_hysteresis"] = config.PowerLimiter.TargetPowerConsumptionHysteresis;
|
powerlimiter["target_power_consumption_hysteresis"] = config.PowerLimiter.TargetPowerConsumptionHysteresis;
|
||||||
powerlimiter["lower_power_limit"] = config.PowerLimiter.LowerPowerLimit;
|
powerlimiter["lower_power_limit"] = config.PowerLimiter.LowerPowerLimit;
|
||||||
powerlimiter["upper_power_limit"] = config.PowerLimiter.UpperPowerLimit;
|
powerlimiter["upper_power_limit"] = config.PowerLimiter.UpperPowerLimit;
|
||||||
|
powerlimiter["ignore_soc"] = config.PowerLimiter.IgnoreSoc;
|
||||||
powerlimiter["battery_soc_start_threshold"] = config.PowerLimiter.BatterySocStartThreshold;
|
powerlimiter["battery_soc_start_threshold"] = config.PowerLimiter.BatterySocStartThreshold;
|
||||||
powerlimiter["battery_soc_stop_threshold"] = config.PowerLimiter.BatterySocStopThreshold;
|
powerlimiter["battery_soc_stop_threshold"] = config.PowerLimiter.BatterySocStopThreshold;
|
||||||
powerlimiter["voltage_start_threshold"] = config.PowerLimiter.VoltageStartThreshold;
|
powerlimiter["voltage_start_threshold"] = config.PowerLimiter.VoltageStartThreshold;
|
||||||
@ -207,7 +208,8 @@ bool ConfigurationClass::write()
|
|||||||
battery["provider"] = config.Battery.Provider;
|
battery["provider"] = config.Battery.Provider;
|
||||||
battery["jkbms_interface"] = config.Battery.JkBmsInterface;
|
battery["jkbms_interface"] = config.Battery.JkBmsInterface;
|
||||||
battery["jkbms_polling_interval"] = config.Battery.JkBmsPollingInterval;
|
battery["jkbms_polling_interval"] = config.Battery.JkBmsPollingInterval;
|
||||||
battery["mqtt_topic"] = config.Battery.MqttTopic;
|
battery["mqtt_topic"] = config.Battery.MqttSocTopic;
|
||||||
|
battery["mqtt_voltage_topic"] = config.Battery.MqttVoltageTopic;
|
||||||
|
|
||||||
JsonObject huawei = doc.createNestedObject("huawei");
|
JsonObject huawei = doc.createNestedObject("huawei");
|
||||||
huawei["enabled"] = config.Huawei.Enabled;
|
huawei["enabled"] = config.Huawei.Enabled;
|
||||||
@ -435,6 +437,7 @@ bool ConfigurationClass::read()
|
|||||||
config.PowerLimiter.TargetPowerConsumptionHysteresis = powerlimiter["target_power_consumption_hysteresis"] | POWERLIMITER_TARGET_POWER_CONSUMPTION_HYSTERESIS;
|
config.PowerLimiter.TargetPowerConsumptionHysteresis = powerlimiter["target_power_consumption_hysteresis"] | POWERLIMITER_TARGET_POWER_CONSUMPTION_HYSTERESIS;
|
||||||
config.PowerLimiter.LowerPowerLimit = powerlimiter["lower_power_limit"] | POWERLIMITER_LOWER_POWER_LIMIT;
|
config.PowerLimiter.LowerPowerLimit = powerlimiter["lower_power_limit"] | POWERLIMITER_LOWER_POWER_LIMIT;
|
||||||
config.PowerLimiter.UpperPowerLimit = powerlimiter["upper_power_limit"] | POWERLIMITER_UPPER_POWER_LIMIT;
|
config.PowerLimiter.UpperPowerLimit = powerlimiter["upper_power_limit"] | POWERLIMITER_UPPER_POWER_LIMIT;
|
||||||
|
config.PowerLimiter.IgnoreSoc = powerlimiter["ignore_soc"] | POWERLIMITER_IGNORE_SOC;
|
||||||
config.PowerLimiter.BatterySocStartThreshold = powerlimiter["battery_soc_start_threshold"] | POWERLIMITER_BATTERY_SOC_START_THRESHOLD;
|
config.PowerLimiter.BatterySocStartThreshold = powerlimiter["battery_soc_start_threshold"] | POWERLIMITER_BATTERY_SOC_START_THRESHOLD;
|
||||||
config.PowerLimiter.BatterySocStopThreshold = powerlimiter["battery_soc_stop_threshold"] | POWERLIMITER_BATTERY_SOC_STOP_THRESHOLD;
|
config.PowerLimiter.BatterySocStopThreshold = powerlimiter["battery_soc_stop_threshold"] | POWERLIMITER_BATTERY_SOC_STOP_THRESHOLD;
|
||||||
config.PowerLimiter.VoltageStartThreshold = powerlimiter["voltage_start_threshold"] | POWERLIMITER_VOLTAGE_START_THRESHOLD;
|
config.PowerLimiter.VoltageStartThreshold = powerlimiter["voltage_start_threshold"] | POWERLIMITER_VOLTAGE_START_THRESHOLD;
|
||||||
@ -451,7 +454,8 @@ bool ConfigurationClass::read()
|
|||||||
config.Battery.Provider = battery["provider"] | BATTERY_PROVIDER;
|
config.Battery.Provider = battery["provider"] | BATTERY_PROVIDER;
|
||||||
config.Battery.JkBmsInterface = battery["jkbms_interface"] | BATTERY_JKBMS_INTERFACE;
|
config.Battery.JkBmsInterface = battery["jkbms_interface"] | BATTERY_JKBMS_INTERFACE;
|
||||||
config.Battery.JkBmsPollingInterval = battery["jkbms_polling_interval"] | BATTERY_JKBMS_POLLING_INTERVAL;
|
config.Battery.JkBmsPollingInterval = battery["jkbms_polling_interval"] | BATTERY_JKBMS_POLLING_INTERVAL;
|
||||||
strlcpy(config.Battery.MqttTopic, battery["mqtt_topic"] | "", sizeof(config.Battery.MqttTopic));
|
strlcpy(config.Battery.MqttSocTopic, battery["mqtt_topic"] | "", sizeof(config.Battery.MqttSocTopic));
|
||||||
|
strlcpy(config.Battery.MqttVoltageTopic, battery["mqtt_voltage_topic"] | "", sizeof(config.Battery.MqttVoltageTopic));
|
||||||
|
|
||||||
JsonObject huawei = doc["huawei"];
|
JsonObject huawei = doc["huawei"];
|
||||||
config.Huawei.Enabled = huawei["enabled"] | HUAWEI_ENABLED;
|
config.Huawei.Enabled = huawei["enabled"] | HUAWEI_ENABLED;
|
||||||
|
|||||||
@ -10,20 +10,35 @@ bool MqttBattery::init(bool verboseLogging)
|
|||||||
_verboseLogging = verboseLogging;
|
_verboseLogging = verboseLogging;
|
||||||
|
|
||||||
auto const& config = Configuration.get();
|
auto const& config = Configuration.get();
|
||||||
_socTopic = config.Battery.MqttTopic;
|
|
||||||
|
|
||||||
if (_socTopic.isEmpty()) { return false; }
|
_socTopic = config.Battery.MqttSocTopic;
|
||||||
|
if (!_socTopic.isEmpty()) {
|
||||||
|
MqttSettings.subscribe(_socTopic, 0/*QoS*/,
|
||||||
|
std::bind(&MqttBattery::onMqttMessageSoC,
|
||||||
|
this, std::placeholders::_1, std::placeholders::_2,
|
||||||
|
std::placeholders::_3, std::placeholders::_4,
|
||||||
|
std::placeholders::_5, std::placeholders::_6)
|
||||||
|
);
|
||||||
|
|
||||||
MqttSettings.subscribe(_socTopic, 0/*QoS*/,
|
if (_verboseLogging) {
|
||||||
std::bind(&MqttBattery::onMqttMessage,
|
MessageOutput.printf("MqttBattery: Subscribed to '%s' for SoC readings\r\n",
|
||||||
this, std::placeholders::_1, std::placeholders::_2,
|
_socTopic.c_str());
|
||||||
std::placeholders::_3, std::placeholders::_4,
|
}
|
||||||
std::placeholders::_5, std::placeholders::_6)
|
}
|
||||||
);
|
|
||||||
|
|
||||||
if (_verboseLogging) {
|
_voltageTopic = config.Battery.MqttVoltageTopic;
|
||||||
MessageOutput.printf("MqttBattery: Subscribed to '%s'\r\n",
|
if (!_voltageTopic.isEmpty()) {
|
||||||
_socTopic.c_str());
|
MqttSettings.subscribe(_voltageTopic, 0/*QoS*/,
|
||||||
|
std::bind(&MqttBattery::onMqttMessageVoltage,
|
||||||
|
this, std::placeholders::_1, std::placeholders::_2,
|
||||||
|
std::placeholders::_3, std::placeholders::_4,
|
||||||
|
std::placeholders::_5, std::placeholders::_6)
|
||||||
|
);
|
||||||
|
|
||||||
|
if (_verboseLogging) {
|
||||||
|
MessageOutput.printf("MqttBattery: Subscribed to '%s' for voltage readings\r\n",
|
||||||
|
_voltageTopic.c_str());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -31,35 +46,69 @@ bool MqttBattery::init(bool verboseLogging)
|
|||||||
|
|
||||||
void MqttBattery::deinit()
|
void MqttBattery::deinit()
|
||||||
{
|
{
|
||||||
if (_socTopic.isEmpty()) { return; }
|
if (!_voltageTopic.isEmpty()) {
|
||||||
MqttSettings.unsubscribe(_socTopic);
|
MqttSettings.unsubscribe(_voltageTopic);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!_socTopic.isEmpty()) {
|
||||||
|
MqttSettings.unsubscribe(_socTopic);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MqttBattery::onMqttMessage(espMqttClientTypes::MessageProperties const& properties,
|
std::optional<float> MqttBattery::getFloat(std::string const& src, char const* topic) {
|
||||||
char const* topic, uint8_t const* payload, size_t len, size_t index, size_t total)
|
float res = 0;
|
||||||
{
|
|
||||||
float soc = 0;
|
|
||||||
std::string value(reinterpret_cast<const char*>(payload), len);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
soc = std::stof(value);
|
res = std::stof(src);
|
||||||
}
|
}
|
||||||
catch(std::invalid_argument const& e) {
|
catch(std::invalid_argument const& e) {
|
||||||
MessageOutput.printf("MqttBattery: Cannot parse payload '%s' in topic '%s' as float\r\n",
|
MessageOutput.printf("MqttBattery: Cannot parse payload '%s' in topic '%s' as float\r\n",
|
||||||
value.c_str(), topic);
|
src.c_str(), topic);
|
||||||
return;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (soc < 0 || soc > 100) {
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MqttBattery::onMqttMessageSoC(espMqttClientTypes::MessageProperties const& properties,
|
||||||
|
char const* topic, uint8_t const* payload, size_t len, size_t index, size_t total)
|
||||||
|
{
|
||||||
|
auto soc = getFloat(std::string(reinterpret_cast<const char*>(payload), len), topic);
|
||||||
|
if (!soc.has_value()) { return; }
|
||||||
|
|
||||||
|
if (*soc < 0 || *soc > 100) {
|
||||||
MessageOutput.printf("MqttBattery: Implausible SoC '%.2f' in topic '%s'\r\n",
|
MessageOutput.printf("MqttBattery: Implausible SoC '%.2f' in topic '%s'\r\n",
|
||||||
soc, topic);
|
*soc, topic);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_stats->setSoC(static_cast<uint8_t>(soc));
|
_stats->setSoC(*soc, 0/*precision*/, millis());
|
||||||
|
|
||||||
if (_verboseLogging) {
|
if (_verboseLogging) {
|
||||||
MessageOutput.printf("MqttBattery: Updated SoC to %d from '%s'\r\n",
|
MessageOutput.printf("MqttBattery: Updated SoC to %d from '%s'\r\n",
|
||||||
static_cast<uint8_t>(soc), topic);
|
static_cast<uint8_t>(*soc), topic);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MqttBattery::onMqttMessageVoltage(espMqttClientTypes::MessageProperties const& properties,
|
||||||
|
char const* topic, uint8_t const* payload, size_t len, size_t index, size_t total)
|
||||||
|
{
|
||||||
|
auto voltage = getFloat(std::string(reinterpret_cast<const char*>(payload), len), topic);
|
||||||
|
if (!voltage.has_value()) { return; }
|
||||||
|
|
||||||
|
// since this project is revolving around Hoymiles microinverters, which can
|
||||||
|
// only handle up to 65V of input voltage at best, it is safe to assume that
|
||||||
|
// an even higher voltage is implausible.
|
||||||
|
if (*voltage < 0 || *voltage > 65) {
|
||||||
|
MessageOutput.printf("MqttBattery: Implausible voltage '%.2f' in topic '%s'\r\n",
|
||||||
|
*voltage, topic);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_stats->setVoltage(*voltage, millis());
|
||||||
|
|
||||||
|
if (_verboseLogging) {
|
||||||
|
MessageOutput.printf("MqttBattery: Updated voltage to %.2f from '%s'\r\n",
|
||||||
|
*voltage, topic);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -290,14 +290,15 @@ void PowerLimiterClass::loop()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (_verboseLogging) {
|
if (_verboseLogging) {
|
||||||
MessageOutput.printf("[DPL::loop] battery interface %s, SoC: %d %%, StartTH: %d %%, StopTH: %d %%, SoC age: %d s\r\n",
|
MessageOutput.printf("[DPL::loop] battery interface %s, SoC: %d %%, StartTH: %d %%, StopTH: %d %%, SoC age: %d s, ignore: %s\r\n",
|
||||||
(config.Battery.Enabled?"enabled":"disabled"),
|
(config.Battery.Enabled?"enabled":"disabled"),
|
||||||
Battery.getStats()->getSoC(),
|
Battery.getStats()->getSoC(),
|
||||||
config.PowerLimiter.BatterySocStartThreshold,
|
config.PowerLimiter.BatterySocStartThreshold,
|
||||||
config.PowerLimiter.BatterySocStopThreshold,
|
config.PowerLimiter.BatterySocStopThreshold,
|
||||||
Battery.getStats()->getSoCAgeSeconds());
|
Battery.getStats()->getSoCAgeSeconds(),
|
||||||
|
(config.PowerLimiter.IgnoreSoc?"yes":"no"));
|
||||||
|
|
||||||
float dcVoltage = _inverter->Statistics()->getChannelFieldValue(TYPE_DC, (ChannelNum_t)config.PowerLimiter.InverterChannelId, FLD_UDC);
|
auto dcVoltage = getBatteryVoltage(true/*log voltages only once per DPL loop*/);
|
||||||
MessageOutput.printf("[DPL::loop] dcVoltage: %.2f V, loadCorrectedVoltage: %.2f V, StartTH: %.2f V, StopTH: %.2f V\r\n",
|
MessageOutput.printf("[DPL::loop] dcVoltage: %.2f V, loadCorrectedVoltage: %.2f V, StartTH: %.2f V, StopTH: %.2f V\r\n",
|
||||||
dcVoltage, getLoadCorrectedVoltage(),
|
dcVoltage, getLoadCorrectedVoltage(),
|
||||||
config.PowerLimiter.VoltageStartThreshold,
|
config.PowerLimiter.VoltageStartThreshold,
|
||||||
@ -339,6 +340,46 @@ void PowerLimiterClass::loop()
|
|||||||
_calculationBackoffMs = _calculationBackoffMsDefault;
|
_calculationBackoffMs = _calculationBackoffMsDefault;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* determines the battery's voltage, trying multiple data providers. the most
|
||||||
|
* accurate data is expected to be delivered by a BMS, if it's available. more
|
||||||
|
* accurate and more recent than the inverter's voltage reading is the volage
|
||||||
|
* at the charge controller's output, if it's available. only as a fallback
|
||||||
|
* the voltage reported by the inverter is used.
|
||||||
|
*/
|
||||||
|
float PowerLimiterClass::getBatteryVoltage(bool log) {
|
||||||
|
if (!_inverter) {
|
||||||
|
// there should be no need to call this method if no target inverter is known
|
||||||
|
MessageOutput.println("DPL getBatteryVoltage: no inverter (programmer error)");
|
||||||
|
return 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto const& config = Configuration.get();
|
||||||
|
auto channel = static_cast<ChannelNum_t>(config.PowerLimiter.InverterChannelId);
|
||||||
|
float inverterVoltage = _inverter->Statistics()->getChannelFieldValue(TYPE_DC, channel, FLD_UDC);
|
||||||
|
float res = inverterVoltage;
|
||||||
|
|
||||||
|
float chargeControllerVoltage = -1;
|
||||||
|
if (VictronMppt.isDataValid()) {
|
||||||
|
res = chargeControllerVoltage = static_cast<float>(VictronMppt.getOutputVoltage());
|
||||||
|
}
|
||||||
|
|
||||||
|
float bmsVoltage = -1;
|
||||||
|
auto stats = Battery.getStats();
|
||||||
|
if (config.Battery.Enabled
|
||||||
|
&& stats->isVoltageValid()
|
||||||
|
&& stats->getVoltageAgeSeconds() < 60) {
|
||||||
|
res = bmsVoltage = stats->getVoltage();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (log) {
|
||||||
|
MessageOutput.printf("[DPL::getBatteryVoltage] BMS: %.2f V, MPPT: %.2f V, inverter: %.2f V, returning: %.2fV\r\n",
|
||||||
|
bmsVoltage, chargeControllerVoltage, inverterVoltage, res);
|
||||||
|
}
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* calculate the AC output power (limit) to set, such that the inverter uses
|
* calculate the AC output power (limit) to set, such that the inverter uses
|
||||||
* the given power on its DC side, i.e., adjust the power for the inverter's
|
* the given power on its DC side, i.e., adjust the power for the inverter's
|
||||||
@ -592,9 +633,8 @@ float PowerLimiterClass::getLoadCorrectedVoltage()
|
|||||||
|
|
||||||
CONFIG_T& config = Configuration.get();
|
CONFIG_T& config = Configuration.get();
|
||||||
|
|
||||||
auto channel = static_cast<ChannelNum_t>(config.PowerLimiter.InverterChannelId);
|
|
||||||
float acPower = _inverter->Statistics()->getChannelFieldValue(TYPE_AC, CH0, FLD_PAC);
|
float acPower = _inverter->Statistics()->getChannelFieldValue(TYPE_AC, CH0, FLD_PAC);
|
||||||
float dcVoltage = _inverter->Statistics()->getChannelFieldValue(TYPE_DC, channel, FLD_UDC);
|
float dcVoltage = getBatteryVoltage();
|
||||||
|
|
||||||
if (dcVoltage <= 0.0) {
|
if (dcVoltage <= 0.0) {
|
||||||
return 0.0;
|
return 0.0;
|
||||||
@ -608,11 +648,14 @@ bool PowerLimiterClass::testThreshold(float socThreshold, float voltThreshold,
|
|||||||
{
|
{
|
||||||
CONFIG_T& config = Configuration.get();
|
CONFIG_T& config = Configuration.get();
|
||||||
|
|
||||||
// prefer SoC provided through battery interface
|
// prefer SoC provided through battery interface, unless disabled by user
|
||||||
if (config.Battery.Enabled && socThreshold > 0.0
|
auto stats = Battery.getStats();
|
||||||
&& Battery.getStats()->isValid()
|
if (!config.PowerLimiter.IgnoreSoc
|
||||||
&& Battery.getStats()->getSoCAgeSeconds() < 60) {
|
&& config.Battery.Enabled
|
||||||
return compare(Battery.getStats()->getSoC(), socThreshold);
|
&& socThreshold > 0.0
|
||||||
|
&& stats->isSoCValid()
|
||||||
|
&& stats->getSoCAgeSeconds() < 60) {
|
||||||
|
return compare(stats->getSoC(), socThreshold);
|
||||||
}
|
}
|
||||||
|
|
||||||
// use voltage threshold as fallback
|
// use voltage threshold as fallback
|
||||||
|
|||||||
@ -136,7 +136,7 @@ void PylontechCanReceiver::loop()
|
|||||||
}
|
}
|
||||||
|
|
||||||
case 0x355: {
|
case 0x355: {
|
||||||
_stats->setSoC(static_cast<uint8_t>(this->readUnsignedInt16(rx_message.data)));
|
_stats->setSoC(static_cast<uint8_t>(this->readUnsignedInt16(rx_message.data)), 0/*precision*/, millis());
|
||||||
_stats->_stateOfHealth = this->readUnsignedInt16(rx_message.data + 2);
|
_stats->_stateOfHealth = this->readUnsignedInt16(rx_message.data + 2);
|
||||||
|
|
||||||
if (_verboseLogging) {
|
if (_verboseLogging) {
|
||||||
@ -147,13 +147,13 @@ void PylontechCanReceiver::loop()
|
|||||||
}
|
}
|
||||||
|
|
||||||
case 0x356: {
|
case 0x356: {
|
||||||
_stats->_voltage = this->scaleValue(this->readSignedInt16(rx_message.data), 0.01);
|
_stats->setVoltage(this->scaleValue(this->readSignedInt16(rx_message.data), 0.01), millis());
|
||||||
_stats->_current = this->scaleValue(this->readSignedInt16(rx_message.data + 2), 0.1);
|
_stats->_current = this->scaleValue(this->readSignedInt16(rx_message.data + 2), 0.1);
|
||||||
_stats->_temperature = this->scaleValue(this->readSignedInt16(rx_message.data + 4), 0.1);
|
_stats->_temperature = this->scaleValue(this->readSignedInt16(rx_message.data + 4), 0.1);
|
||||||
|
|
||||||
if (_verboseLogging) {
|
if (_verboseLogging) {
|
||||||
MessageOutput.printf("[Pylontech] voltage: %f current: %f temperature: %f\n",
|
MessageOutput.printf("[Pylontech] voltage: %f current: %f temperature: %f\n",
|
||||||
_stats->_voltage, _stats->_current, _stats->_temperature);
|
_stats->getVoltage(), _stats->_current, _stats->_temperature);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -282,12 +282,12 @@ void PylontechCanReceiver::dummyData()
|
|||||||
};
|
};
|
||||||
|
|
||||||
_stats->setManufacturer("Pylontech US3000C");
|
_stats->setManufacturer("Pylontech US3000C");
|
||||||
_stats->setSoC(42);
|
_stats->setSoC(42, 0/*precision*/, millis());
|
||||||
_stats->_chargeVoltage = dummyFloat(50);
|
_stats->_chargeVoltage = dummyFloat(50);
|
||||||
_stats->_chargeCurrentLimitation = dummyFloat(33);
|
_stats->_chargeCurrentLimitation = dummyFloat(33);
|
||||||
_stats->_dischargeCurrentLimitation = dummyFloat(12);
|
_stats->_dischargeCurrentLimitation = dummyFloat(12);
|
||||||
_stats->_stateOfHealth = 99;
|
_stats->_stateOfHealth = 99;
|
||||||
_stats->_voltage = 48.67;
|
_stats->setVoltage(48.67, millis());
|
||||||
_stats->_current = dummyFloat(-1);
|
_stats->_current = dummyFloat(-1);
|
||||||
_stats->_temperature = dummyFloat(20);
|
_stats->_temperature = dummyFloat(20);
|
||||||
|
|
||||||
|
|||||||
@ -137,3 +137,16 @@ double VictronMpptClass::getYieldDay() const
|
|||||||
|
|
||||||
return sum;
|
return sum;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
double VictronMpptClass::getOutputVoltage() const
|
||||||
|
{
|
||||||
|
double min = -1;
|
||||||
|
|
||||||
|
for (const auto& upController : _controllers) {
|
||||||
|
double volts = upController->getData()->V;
|
||||||
|
if (min == -1) { min = volts; }
|
||||||
|
min = std::min(min, volts);
|
||||||
|
}
|
||||||
|
|
||||||
|
return min;
|
||||||
|
}
|
||||||
|
|||||||
@ -39,7 +39,8 @@ void WebApiBatteryClass::onStatus(AsyncWebServerRequest* request)
|
|||||||
root["provider"] = config.Battery.Provider;
|
root["provider"] = config.Battery.Provider;
|
||||||
root["jkbms_interface"] = config.Battery.JkBmsInterface;
|
root["jkbms_interface"] = config.Battery.JkBmsInterface;
|
||||||
root["jkbms_polling_interval"] = config.Battery.JkBmsPollingInterval;
|
root["jkbms_polling_interval"] = config.Battery.JkBmsPollingInterval;
|
||||||
root["mqtt_topic"] = config.Battery.MqttTopic;
|
root["mqtt_soc_topic"] = config.Battery.MqttSocTopic;
|
||||||
|
root["mqtt_voltage_topic"] = config.Battery.MqttVoltageTopic;
|
||||||
|
|
||||||
response->setLength();
|
response->setLength();
|
||||||
request->send(response);
|
request->send(response);
|
||||||
@ -103,7 +104,8 @@ void WebApiBatteryClass::onAdminPost(AsyncWebServerRequest* request)
|
|||||||
config.Battery.Provider = root["provider"].as<uint8_t>();
|
config.Battery.Provider = root["provider"].as<uint8_t>();
|
||||||
config.Battery.JkBmsInterface = root["jkbms_interface"].as<uint8_t>();
|
config.Battery.JkBmsInterface = root["jkbms_interface"].as<uint8_t>();
|
||||||
config.Battery.JkBmsPollingInterval = root["jkbms_polling_interval"].as<uint8_t>();
|
config.Battery.JkBmsPollingInterval = root["jkbms_polling_interval"].as<uint8_t>();
|
||||||
strlcpy(config.Battery.MqttTopic, root["mqtt_topic"].as<String>().c_str(), sizeof(config.Battery.MqttTopic));
|
strlcpy(config.Battery.MqttSocTopic, root["mqtt_soc_topic"].as<String>().c_str(), sizeof(config.Battery.MqttSocTopic));
|
||||||
|
strlcpy(config.Battery.MqttVoltageTopic, root["mqtt_voltage_topic"].as<String>().c_str(), sizeof(config.Battery.MqttVoltageTopic));
|
||||||
|
|
||||||
WebApi.writeConfig(retMsg);
|
WebApi.writeConfig(retMsg);
|
||||||
|
|
||||||
|
|||||||
@ -45,6 +45,7 @@ void WebApiPowerLimiterClass::onStatus(AsyncWebServerRequest* request)
|
|||||||
root["target_power_consumption_hysteresis"] = config.PowerLimiter.TargetPowerConsumptionHysteresis;
|
root["target_power_consumption_hysteresis"] = config.PowerLimiter.TargetPowerConsumptionHysteresis;
|
||||||
root["lower_power_limit"] = config.PowerLimiter.LowerPowerLimit;
|
root["lower_power_limit"] = config.PowerLimiter.LowerPowerLimit;
|
||||||
root["upper_power_limit"] = config.PowerLimiter.UpperPowerLimit;
|
root["upper_power_limit"] = config.PowerLimiter.UpperPowerLimit;
|
||||||
|
root["ignore_soc"] = config.PowerLimiter.IgnoreSoc;
|
||||||
root["battery_soc_start_threshold"] = config.PowerLimiter.BatterySocStartThreshold;
|
root["battery_soc_start_threshold"] = config.PowerLimiter.BatterySocStartThreshold;
|
||||||
root["battery_soc_stop_threshold"] = config.PowerLimiter.BatterySocStopThreshold;
|
root["battery_soc_stop_threshold"] = config.PowerLimiter.BatterySocStopThreshold;
|
||||||
root["voltage_start_threshold"] = static_cast<int>(config.PowerLimiter.VoltageStartThreshold * 100 +0.5) / 100.0;
|
root["voltage_start_threshold"] = static_cast<int>(config.PowerLimiter.VoltageStartThreshold * 100 +0.5) / 100.0;
|
||||||
@ -133,6 +134,7 @@ void WebApiPowerLimiterClass::onAdminPost(AsyncWebServerRequest* request)
|
|||||||
config.PowerLimiter.TargetPowerConsumptionHysteresis = root["target_power_consumption_hysteresis"].as<int32_t>();
|
config.PowerLimiter.TargetPowerConsumptionHysteresis = root["target_power_consumption_hysteresis"].as<int32_t>();
|
||||||
config.PowerLimiter.LowerPowerLimit = root["lower_power_limit"].as<int32_t>();
|
config.PowerLimiter.LowerPowerLimit = root["lower_power_limit"].as<int32_t>();
|
||||||
config.PowerLimiter.UpperPowerLimit = root["upper_power_limit"].as<int32_t>();
|
config.PowerLimiter.UpperPowerLimit = root["upper_power_limit"].as<int32_t>();
|
||||||
|
config.PowerLimiter.IgnoreSoc = root["ignore_soc"].as<bool>();
|
||||||
config.PowerLimiter.BatterySocStartThreshold = root["battery_soc_start_threshold"].as<uint32_t>();
|
config.PowerLimiter.BatterySocStartThreshold = root["battery_soc_start_threshold"].as<uint32_t>();
|
||||||
config.PowerLimiter.BatterySocStopThreshold = root["battery_soc_stop_threshold"].as<uint32_t>();
|
config.PowerLimiter.BatterySocStopThreshold = root["battery_soc_stop_threshold"].as<uint32_t>();
|
||||||
config.PowerLimiter.VoltageStartThreshold = root["voltage_start_threshold"].as<float>();
|
config.PowerLimiter.VoltageStartThreshold = root["voltage_start_threshold"].as<float>();
|
||||||
|
|||||||
@ -595,17 +595,18 @@
|
|||||||
"LowerPowerLimit": "Unteres Leistungslimit",
|
"LowerPowerLimit": "Unteres Leistungslimit",
|
||||||
"UpperPowerLimit": "Oberes Leistungslimit",
|
"UpperPowerLimit": "Oberes Leistungslimit",
|
||||||
"PowerMeters": "Leistungsmesser",
|
"PowerMeters": "Leistungsmesser",
|
||||||
|
"IgnoreSoc": "Batterie SoC ignorieren",
|
||||||
"BatterySocStartThreshold": "Akku SoC - Start",
|
"BatterySocStartThreshold": "Akku SoC - Start",
|
||||||
"BatterySocStopThreshold": "Akku SoC - Stop",
|
"BatterySocStopThreshold": "Akku SoC - Stop",
|
||||||
"BatterySocSolarPassthroughStartThreshold": "Akku SoC - Start solar passthrough",
|
"BatterySocSolarPassthroughStartThreshold": "Akku SoC - Start solar passthrough",
|
||||||
"BatterySocSolarPassthroughStartThresholdHint": "Wenn der Batterie SOC über diesem Limit ist wird die Inverter Leistung entsprechend der Victron MPPT Leistung gesetzt (abzüglich Effizienzkorrekturfaktor). Kann verwendet werden um überschüssige Solarleistung an das Netz zu liefern wenn die Batterie voll ist.",
|
"BatterySocSolarPassthroughStartThresholdHint": "Wenn der Batterie SoC über diesem Limit ist wird die Inverter Leistung entsprechend der Victron MPPT Leistung gesetzt (abzüglich Effizienzkorrekturfaktor). Kann verwendet werden um überschüssige Solarleistung an das Netz zu liefern wenn die Batterie voll ist.",
|
||||||
"VoltageStartThreshold": "DC Spannung - Start",
|
"VoltageStartThreshold": "DC Spannung - Start",
|
||||||
"VoltageStopThreshold": "DC Spannung - Stop",
|
"VoltageStopThreshold": "DC Spannung - Stop",
|
||||||
"VoltageSolarPassthroughStartThreshold": "DC Spannung - Start Solar-Passthrough",
|
"VoltageSolarPassthroughStartThreshold": "DC Spannung - Start Solar-Passthrough",
|
||||||
"VoltageSolarPassthroughStopThreshold": "DC Spannung - Stop Solar-Passthrough",
|
"VoltageSolarPassthroughStopThreshold": "DC Spannung - Stop Solar-Passthrough",
|
||||||
"VoltageSolarPassthroughStartThresholdHint": "Wenn der Batteriespannung über diesem Limit ist wird die Inverter Leistung entsprechend der Victron MPPT Leistung gesetzt (abzüglich Effizienzkorrekturfaktor). Kann verwendet werden um überschüssige Solarleistung an das Netz zu liefern wenn die Batterie voll ist. Dieser Mode wird aktiv wenn das Start Spannungslimit überschritten wird und inaktiv wenn das Stop Spannungslimit unterschritten wird.",
|
"VoltageSolarPassthroughStartThresholdHint": "Wenn der Batteriespannung über diesem Limit ist wird die Inverter Leistung entsprechend der Victron MPPT Leistung gesetzt (abzüglich Effizienzkorrekturfaktor). Kann verwendet werden um überschüssige Solarleistung an das Netz zu liefern wenn die Batterie voll ist. Dieser Mode wird aktiv wenn das Start Spannungslimit überschritten wird und inaktiv wenn das Stop Spannungslimit unterschritten wird.",
|
||||||
"VoltageLoadCorrectionFactor": "DC Spannung - Lastkorrekturfaktor",
|
"VoltageLoadCorrectionFactor": "DC Spannung - Lastkorrekturfaktor",
|
||||||
"BatterySocInfo": "<b>Hinweis:</b> Die Akku SoC (State of Charge) Werte können nur benutzt werden, wenn die Batterie-Kommunikationsschnittstelle aktiviert ist. Wenn die Batterie innerhalb der letzten Minute keine Werte geschickt hat, werden als Fallback-Option die Spannungseinstellungen verwendet.",
|
"BatterySocInfo": "<b>Hinweis:</b> Die Akku SoC (State of Charge) Werte werden nur benutzt, wenn die Batterie-Kommunikationsschnittstelle innerhalb der letzten Minute gültige Werte geschickt hat. Andernfalls werden als Fallback-Option die Spannungseinstellungen verwendet.",
|
||||||
"InverterIsBehindPowerMeter": "Welchselrichter ist hinter Leistungsmesser",
|
"InverterIsBehindPowerMeter": "Welchselrichter ist hinter Leistungsmesser",
|
||||||
"Battery": "DC / Akku",
|
"Battery": "DC / Akku",
|
||||||
"VoltageLoadCorrectionInfo": "<b>Hinweis:</b> Wenn Leistung von der Batterie abgegeben wird, bricht normalerweise die Spannung etwas ein. Damit nicht vorzeitig der Wechelrichter ausgeschaltet wird sobald der \"Stop\"-Schwellenwert erreicht wird, wird der hier angegebene Korrekturfaktor mit einberechnet. Korrigierte Spannung = DC Spannung + (Aktuelle Leistung (W) * Korrekturfaktor).",
|
"VoltageLoadCorrectionInfo": "<b>Hinweis:</b> Wenn Leistung von der Batterie abgegeben wird, bricht normalerweise die Spannung etwas ein. Damit nicht vorzeitig der Wechelrichter ausgeschaltet wird sobald der \"Stop\"-Schwellenwert erreicht wird, wird der hier angegebene Korrekturfaktor mit einberechnet. Korrigierte Spannung = DC Spannung + (Aktuelle Leistung (W) * Korrekturfaktor).",
|
||||||
@ -621,10 +622,11 @@
|
|||||||
"Provider": "Datenanbieter",
|
"Provider": "Datenanbieter",
|
||||||
"ProviderPylontechCan": "Pylontech per CAN-Bus",
|
"ProviderPylontechCan": "Pylontech per CAN-Bus",
|
||||||
"ProviderJkBmsSerial": "Jikong (JK) BMS per serieller Verbindung",
|
"ProviderJkBmsSerial": "Jikong (JK) BMS per serieller Verbindung",
|
||||||
"ProviderMqtt": "State of Charge (SoC) Wert aus MQTT Broker",
|
"ProviderMqtt": "Batteriewerte aus MQTT Broker",
|
||||||
"ProviderVictron": "Victron SmartShunt per VE.Direct Schnittstelle",
|
"ProviderVictron": "Victron SmartShunt per VE.Direct Schnittstelle",
|
||||||
"MqttConfiguration": "MQTT Einstellungen",
|
"MqttConfiguration": "MQTT Einstellungen",
|
||||||
"MqttTopic": "SoC-Wert Topic",
|
"MqttSocTopic": "Topic für Batterie-SoC",
|
||||||
|
"MqttVoltageTopic": "Topic für Batteriespannung",
|
||||||
"JkBmsConfiguration": "JK BMS Einstellungen",
|
"JkBmsConfiguration": "JK BMS Einstellungen",
|
||||||
"JkBmsInterface": "Schnittstellentyp",
|
"JkBmsInterface": "Schnittstellentyp",
|
||||||
"JkBmsInterfaceUart": "TTL-UART an der MCU",
|
"JkBmsInterfaceUart": "TTL-UART an der MCU",
|
||||||
|
|||||||
@ -601,9 +601,7 @@
|
|||||||
"LowerPowerLimit": "Lower power limit",
|
"LowerPowerLimit": "Lower power limit",
|
||||||
"UpperPowerLimit": "Upper power limit",
|
"UpperPowerLimit": "Upper power limit",
|
||||||
"PowerMeters": "Power meter",
|
"PowerMeters": "Power meter",
|
||||||
"MqttTopicPowerMeter1": "MQTT topic - Power meter #1",
|
"IgnoreSoc": "Ignore Battery SoC",
|
||||||
"MqttTopicPowerMeter2": "MQTT topic - Power meter #2 (optional)",
|
|
||||||
"MqttTopicPowerMeter3": "MQTT topic - Power meter #3 (optional)",
|
|
||||||
"BatterySocStartThreshold": "Battery SoC - Start threshold",
|
"BatterySocStartThreshold": "Battery SoC - Start threshold",
|
||||||
"BatterySocStopThreshold": "Battery SoC - Stop threshold",
|
"BatterySocStopThreshold": "Battery SoC - Stop threshold",
|
||||||
"BatterySocSolarPassthroughStartThreshold": "Battery SoC - Start threshold for full solar passthrough",
|
"BatterySocSolarPassthroughStartThreshold": "Battery SoC - Start threshold for full solar passthrough",
|
||||||
@ -614,7 +612,7 @@
|
|||||||
"VoltageSolarPassthroughStopThreshold": "DC Voltage - Stop threshold for full solar passthrough",
|
"VoltageSolarPassthroughStopThreshold": "DC Voltage - Stop threshold for full solar passthrough",
|
||||||
"VoltageSolarPassthroughStartThresholdHint": "Inverter power is set according to Victron MPPT power (minus efficiency factors) when full solar passthrough is active. Use this if you like to supply excess power to the grid when battery is full. This is started when battery voltage goes over this limit and stopped if voltage drops below stop limit.",
|
"VoltageSolarPassthroughStartThresholdHint": "Inverter power is set according to Victron MPPT power (minus efficiency factors) when full solar passthrough is active. Use this if you like to supply excess power to the grid when battery is full. This is started when battery voltage goes over this limit and stopped if voltage drops below stop limit.",
|
||||||
"VoltageLoadCorrectionFactor": "DC Voltage - Load correction factor",
|
"VoltageLoadCorrectionFactor": "DC Voltage - Load correction factor",
|
||||||
"BatterySocInfo": "<b>Hint:</b> The battery SoC (State of Charge) values can only be used if the battery communication interface is enabled. If the battery has not reported any SoC updates in the last minute, the voltage thresholds will be used as fallback.",
|
"BatterySocInfo": "<b>Hint:</b> The battery SoC (State of Charge) values are only used if the battery communication interface reported SoC updates in the last minute. Otherwise the voltage thresholds will be used as fallback.",
|
||||||
"InverterIsBehindPowerMeter": "Inverter is behind Power meter",
|
"InverterIsBehindPowerMeter": "Inverter is behind Power meter",
|
||||||
"Battery": "DC / Battery",
|
"Battery": "DC / Battery",
|
||||||
"VoltageLoadCorrectionInfo": "<b>Hint:</b> When the power output is higher, the voltage is usually decreasing. In order to not stop the inverter too early (Stop treshold), a power factor can be specified here to correct this. Corrected voltage = DC Voltage + (Current power * correction factor).",
|
"VoltageLoadCorrectionInfo": "<b>Hint:</b> When the power output is higher, the voltage is usually decreasing. In order to not stop the inverter too early (Stop treshold), a power factor can be specified here to correct this. Corrected voltage = DC Voltage + (Current power * correction factor).",
|
||||||
@ -630,10 +628,11 @@
|
|||||||
"Provider": "Data Provider",
|
"Provider": "Data Provider",
|
||||||
"ProviderPylontechCan": "Pylontech using CAN bus",
|
"ProviderPylontechCan": "Pylontech using CAN bus",
|
||||||
"ProviderJkBmsSerial": "Jikong (JK) BMS using serial connection",
|
"ProviderJkBmsSerial": "Jikong (JK) BMS using serial connection",
|
||||||
"ProviderMqtt": "State of Charge (SoC) value from MQTT broker",
|
"ProviderMqtt": "Battery data from MQTT broker",
|
||||||
"ProviderVictron": "Victron SmartShunt using VE.Direct interface",
|
"ProviderVictron": "Victron SmartShunt using VE.Direct interface",
|
||||||
"MqttConfiguration": "MQTT Settings",
|
"MqttConfiguration": "MQTT Settings",
|
||||||
"MqttTopic": "SoC value topic",
|
"MqttSocTopic": "SoC value topic",
|
||||||
|
"MqttVoltageTopic": "Voltage value topic",
|
||||||
"JkBmsConfiguration": "JK BMS Settings",
|
"JkBmsConfiguration": "JK BMS Settings",
|
||||||
"JkBmsInterface": "Interface Type",
|
"JkBmsInterface": "Interface Type",
|
||||||
"JkBmsInterfaceUart": "TTL-UART on MCU",
|
"JkBmsInterfaceUart": "TTL-UART on MCU",
|
||||||
|
|||||||
@ -546,10 +546,11 @@
|
|||||||
"Provider": "Data Provider",
|
"Provider": "Data Provider",
|
||||||
"ProviderPylontechCan": "Pylontech using CAN bus",
|
"ProviderPylontechCan": "Pylontech using CAN bus",
|
||||||
"ProviderJkBmsSerial": "Jikong (JK) BMS using serial connection",
|
"ProviderJkBmsSerial": "Jikong (JK) BMS using serial connection",
|
||||||
"ProviderMqtt": "State of Charge (SoC) value from MQTT broker",
|
"ProviderMqtt": "Battery data from MQTT broker",
|
||||||
"ProviderVictron": "Victron SmartShunt using VE.Direct interface",
|
"ProviderVictron": "Victron SmartShunt using VE.Direct interface",
|
||||||
"MqttConfiguration": "MQTT Settings",
|
"MqttConfiguration": "MQTT Settings",
|
||||||
"MqttTopic": "SoC value topic",
|
"MqttSocTopic": "SoC value topic",
|
||||||
|
"MqttVoltageTopic": "Voltage value topic",
|
||||||
"JkBmsConfiguration": "JK BMS Settings",
|
"JkBmsConfiguration": "JK BMS Settings",
|
||||||
"JkBmsInterface": "Interface Type",
|
"JkBmsInterface": "Interface Type",
|
||||||
"JkBmsInterfaceUart": "TTL-UART on MCU",
|
"JkBmsInterfaceUart": "TTL-UART on MCU",
|
||||||
@ -648,9 +649,7 @@
|
|||||||
"LowerPowerLimit": "Lower power limit",
|
"LowerPowerLimit": "Lower power limit",
|
||||||
"UpperPowerLimit": "Upper power limit",
|
"UpperPowerLimit": "Upper power limit",
|
||||||
"PowerMeters": "Power meter",
|
"PowerMeters": "Power meter",
|
||||||
"MqttTopicPowerMeter1": "MQTT topic - Power meter #1",
|
"IgnoreSoc": "Ignore Battery SoC",
|
||||||
"MqttTopicPowerMeter2": "MQTT topic - Power meter #2 (optional)",
|
|
||||||
"MqttTopicPowerMeter3": "MQTT topic - Power meter #3 (optional)",
|
|
||||||
"BatterySocStartThreshold": "Battery SoC - Start threshold",
|
"BatterySocStartThreshold": "Battery SoC - Start threshold",
|
||||||
"BatterySocStopThreshold": "Battery SoC - Stop threshold",
|
"BatterySocStopThreshold": "Battery SoC - Stop threshold",
|
||||||
"BatterySocSolarPassthroughStartThreshold": "Battery SoC - Start threshold for full solar passthrough",
|
"BatterySocSolarPassthroughStartThreshold": "Battery SoC - Start threshold for full solar passthrough",
|
||||||
@ -661,7 +660,7 @@
|
|||||||
"VoltageSolarPassthroughStopThreshold": "DC Voltage - Stop threshold for full solar passthrough",
|
"VoltageSolarPassthroughStopThreshold": "DC Voltage - Stop threshold for full solar passthrough",
|
||||||
"VoltageSolarPassthroughStartThresholdHint": "Inverter power is set according to Victron MPPT power (minus efficiency factors) when full solar passthrough is active. Use this if you like to supply excess power to the grid when battery is full. This is started when battery voltage goes over this limit and stopped if voltage drops below stop limit.",
|
"VoltageSolarPassthroughStartThresholdHint": "Inverter power is set according to Victron MPPT power (minus efficiency factors) when full solar passthrough is active. Use this if you like to supply excess power to the grid when battery is full. This is started when battery voltage goes over this limit and stopped if voltage drops below stop limit.",
|
||||||
"VoltageLoadCorrectionFactor": "DC Voltage - Load correction factor",
|
"VoltageLoadCorrectionFactor": "DC Voltage - Load correction factor",
|
||||||
"BatterySocInfo": "<b>Hint:</b> The battery SoC (State of Charge) values can only be used if the battery communication interface is enabled. If the battery has not reported any SoC updates in the last minute, the voltage thresholds will be used as fallback.",
|
"BatterySocInfo": "<b>Hint:</b> The battery SoC (State of Charge) values are only used if the battery communication interface reported SoC updates in the last minute. Otherwise the voltage thresholds will be used as fallback.",
|
||||||
"InverterIsBehindPowerMeter": "Inverter is behind Power meter",
|
"InverterIsBehindPowerMeter": "Inverter is behind Power meter",
|
||||||
"Battery": "DC / Battery",
|
"Battery": "DC / Battery",
|
||||||
"VoltageLoadCorrectionInfo": "<b>Hint:</b> When the power output is higher, the voltage is usually decreasing. In order to not stop the inverter too early (Stop treshold), a power factor can be specified here to correct this. Corrected voltage = DC Voltage + (Current power * correction factor)."
|
"VoltageLoadCorrectionInfo": "<b>Hint:</b> When the power output is higher, the voltage is usually decreasing. In order to not stop the inverter too early (Stop treshold), a power factor can be specified here to correct this. Corrected voltage = DC Voltage + (Current power * correction factor)."
|
||||||
|
|||||||
@ -4,5 +4,6 @@ export interface BatteryConfig {
|
|||||||
provider: number;
|
provider: number;
|
||||||
jkbms_interface: number;
|
jkbms_interface: number;
|
||||||
jkbms_polling_interval: number;
|
jkbms_polling_interval: number;
|
||||||
mqtt_topic: string;
|
mqtt_soc_topic: string;
|
||||||
|
mqtt_voltage_topic: string;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,6 +11,7 @@ export interface PowerLimiterConfig {
|
|||||||
target_power_consumption_hysteresis: number;
|
target_power_consumption_hysteresis: number;
|
||||||
lower_power_limit: number;
|
lower_power_limit: number;
|
||||||
upper_power_limit: number;
|
upper_power_limit: number;
|
||||||
|
ignore_soc: boolean;
|
||||||
battery_soc_start_threshold: number;
|
battery_soc_start_threshold: number;
|
||||||
battery_soc_stop_threshold: number;
|
battery_soc_stop_threshold: number;
|
||||||
voltage_start_threshold: number;
|
voltage_start_threshold: number;
|
||||||
|
|||||||
@ -53,11 +53,21 @@
|
|||||||
:text="$t('batteryadmin.MqttConfiguration')" textVariant="text-bg-primary" addSpace>
|
:text="$t('batteryadmin.MqttConfiguration')" textVariant="text-bg-primary" addSpace>
|
||||||
<div class="row mb-3">
|
<div class="row mb-3">
|
||||||
<label class="col-sm-2 col-form-label">
|
<label class="col-sm-2 col-form-label">
|
||||||
{{ $t('batteryadmin.MqttTopic') }}
|
{{ $t('batteryadmin.MqttSocTopic') }}
|
||||||
</label>
|
</label>
|
||||||
<div class="col-sm-10">
|
<div class="col-sm-10">
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<input type="text" class="form-control" v-model="batteryConfigList.mqtt_topic" />
|
<input type="text" class="form-control" v-model="batteryConfigList.mqtt_soc_topic" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row mb-3">
|
||||||
|
<label class="col-sm-2 col-form-label">
|
||||||
|
{{ $t('batteryadmin.MqttVoltageTopic') }}
|
||||||
|
</label>
|
||||||
|
<div class="col-sm-10">
|
||||||
|
<div class="input-group">
|
||||||
|
<input type="text" class="form-control" v-model="batteryConfigList.mqtt_voltage_topic" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -142,7 +142,12 @@
|
|||||||
<CardElement :text="$t('powerlimiteradmin.Battery')" textVariant="text-bg-primary" add-space
|
<CardElement :text="$t('powerlimiteradmin.Battery')" textVariant="text-bg-primary" add-space
|
||||||
v-show="powerLimiterConfigList.enabled"
|
v-show="powerLimiterConfigList.enabled"
|
||||||
>
|
>
|
||||||
<div class="row mb-3">
|
<InputElement
|
||||||
|
:label="$t('powerlimiteradmin.IgnoreSoc')"
|
||||||
|
v-model="powerLimiterConfigList.ignore_soc"
|
||||||
|
type="checkbox"/>
|
||||||
|
|
||||||
|
<div class="row mb-3" v-show="!powerLimiterConfigList.ignore_soc">
|
||||||
<label for="batterySocStartThreshold" class="col-sm-2 col-form-label">{{ $t('powerlimiteradmin.BatterySocStartThreshold') }}:</label>
|
<label for="batterySocStartThreshold" class="col-sm-2 col-form-label">{{ $t('powerlimiteradmin.BatterySocStartThreshold') }}:</label>
|
||||||
<div class="col-sm-10">
|
<div class="col-sm-10">
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
@ -154,7 +159,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row mb-3">
|
<div class="row mb-3" v-show="!powerLimiterConfigList.ignore_soc">
|
||||||
<label for="batterySocStopThreshold" class="col-sm-2 col-form-label">{{ $t('powerlimiteradmin.BatterySocStopThreshold') }}</label>
|
<label for="batterySocStopThreshold" class="col-sm-2 col-form-label">{{ $t('powerlimiteradmin.BatterySocStopThreshold') }}</label>
|
||||||
<div class="col-sm-10">
|
<div class="col-sm-10">
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
@ -166,7 +171,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row mb-3" v-show="powerLimiterConfigList.solar_passthrough_enabled">
|
<div class="row mb-3" v-show="powerLimiterConfigList.solar_passthrough_enabled && !powerLimiterConfigList.ignore_soc">
|
||||||
<label for="batterySocSolarPassthroughStartThreshold" class="col-sm-2 col-form-label">{{ $t('powerlimiteradmin.BatterySocSolarPassthroughStartThreshold') }}
|
<label for="batterySocSolarPassthroughStartThreshold" class="col-sm-2 col-form-label">{{ $t('powerlimiteradmin.BatterySocSolarPassthroughStartThreshold') }}
|
||||||
<BIconInfoCircle v-tooltip :title="$t('powerlimiteradmin.BatterySocSolarPassthroughStartThresholdHint')" />
|
<BIconInfoCircle v-tooltip :title="$t('powerlimiteradmin.BatterySocSolarPassthroughStartThresholdHint')" />
|
||||||
</label>
|
</label>
|
||||||
@ -180,7 +185,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="alert alert-secondary" role="alert" v-html="$t('powerlimiteradmin.BatterySocInfo')"></div>
|
<div class="alert alert-secondary" role="alert" v-html="$t('powerlimiteradmin.BatterySocInfo')" v-show="!powerLimiterConfigList.ignore_soc"></div>
|
||||||
|
|
||||||
<div class="row mb-3">
|
<div class="row mb-3">
|
||||||
<label for="inputVoltageStartThreshold" class="col-sm-2 col-form-label">{{ $t('powerlimiteradmin.VoltageStartThreshold') }}:</label>
|
<label for="inputVoltageStartThreshold" class="col-sm-2 col-form-label">{{ $t('powerlimiteradmin.VoltageStartThreshold') }}:</label>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user