Merge branch 'development'
This commit is contained in:
commit
a1d0dad128
4
.github/workflows/build.yml
vendored
4
.github/workflows/build.yml
vendored
@ -32,7 +32,7 @@ jobs:
|
|||||||
|
|
||||||
- uses: actions/setup-python@v4
|
- uses: actions/setup-python@v4
|
||||||
with:
|
with:
|
||||||
python-version: "3.x"
|
python-version: "3.9"
|
||||||
|
|
||||||
- name: Install PlatformIO
|
- name: Install PlatformIO
|
||||||
run: |
|
run: |
|
||||||
@ -77,7 +77,7 @@ jobs:
|
|||||||
- name: Set up Python
|
- name: Set up Python
|
||||||
uses: actions/setup-python@v4
|
uses: actions/setup-python@v4
|
||||||
with:
|
with:
|
||||||
python-version: "3.x"
|
python-version: "3.9"
|
||||||
|
|
||||||
- name: Install PlatformIO
|
- name: Install PlatformIO
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@ -129,6 +129,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void processReceivedParameters();
|
void processReceivedParameters();
|
||||||
|
void _setValue(float in, uint8_t parameterType);
|
||||||
|
|
||||||
TaskHandle_t _HuaweiCanCommunicationTaskHdl = NULL;
|
TaskHandle_t _HuaweiCanCommunicationTaskHdl = NULL;
|
||||||
bool _initialized = false;
|
bool _initialized = false;
|
||||||
|
|||||||
@ -297,7 +297,7 @@ void HuaweiCanClass::loop()
|
|||||||
// Set voltage limit in periodic intervals
|
// Set voltage limit in periodic intervals
|
||||||
if ( _nextAutoModePeriodicIntMillis < millis()) {
|
if ( _nextAutoModePeriodicIntMillis < millis()) {
|
||||||
MessageOutput.printf("[HuaweiCanClass::loop] Periodically setting voltage limit: %f \r\n", config.Huawei_Auto_Power_Voltage_Limit);
|
MessageOutput.printf("[HuaweiCanClass::loop] Periodically setting voltage limit: %f \r\n", config.Huawei_Auto_Power_Voltage_Limit);
|
||||||
setValue(config.Huawei_Auto_Power_Voltage_Limit, HUAWEI_ONLINE_VOLTAGE);
|
_setValue(config.Huawei_Auto_Power_Voltage_Limit, HUAWEI_ONLINE_VOLTAGE);
|
||||||
_nextAutoModePeriodicIntMillis = millis() + 60000;
|
_nextAutoModePeriodicIntMillis = millis() + 60000;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -319,7 +319,7 @@ void HuaweiCanClass::loop()
|
|||||||
|
|
||||||
if (inverter != nullptr) {
|
if (inverter != nullptr) {
|
||||||
if(inverter->isProducing()) {
|
if(inverter->isProducing()) {
|
||||||
setValue(0.0, HUAWEI_ONLINE_CURRENT);
|
_setValue(0.0, HUAWEI_ONLINE_CURRENT);
|
||||||
// Don't run auto mode for a second now. Otherwise we may send too much over the CAN bus
|
// Don't run auto mode for a second now. Otherwise we may send too much over the CAN bus
|
||||||
_autoModeBlockedTillMillis = millis() + 1000;
|
_autoModeBlockedTillMillis = millis() + 1000;
|
||||||
MessageOutput.printf("[HuaweiCanClass::loop] Inverter is active, disable\r\n");
|
MessageOutput.printf("[HuaweiCanClass::loop] Inverter is active, disable\r\n");
|
||||||
@ -349,7 +349,7 @@ void HuaweiCanClass::loop()
|
|||||||
_autoPowerEnabledCounter--;
|
_autoPowerEnabledCounter--;
|
||||||
if (_autoPowerEnabledCounter == 0) {
|
if (_autoPowerEnabledCounter == 0) {
|
||||||
_autoPowerEnabled = false;
|
_autoPowerEnabled = false;
|
||||||
setValue(0, HUAWEI_ONLINE_CURRENT);
|
_setValue(0, HUAWEI_ONLINE_CURRENT);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -366,20 +366,27 @@ void HuaweiCanClass::loop()
|
|||||||
float outputCurrent = efficiency * (newPowerLimit / _rp.output_voltage);
|
float outputCurrent = efficiency * (newPowerLimit / _rp.output_voltage);
|
||||||
MessageOutput.printf("[HuaweiCanClass::loop] Output current %f \r\n", outputCurrent);
|
MessageOutput.printf("[HuaweiCanClass::loop] Output current %f \r\n", outputCurrent);
|
||||||
_autoPowerEnabled = true;
|
_autoPowerEnabled = true;
|
||||||
setValue(outputCurrent, HUAWEI_ONLINE_CURRENT);
|
_setValue(outputCurrent, HUAWEI_ONLINE_CURRENT);
|
||||||
|
|
||||||
// Don't run auto mode some time to allow for output stabilization after issuing a new value
|
// Don't run auto mode some time to allow for output stabilization after issuing a new value
|
||||||
_autoModeBlockedTillMillis = millis() + 2 * HUAWEI_DATA_REQUEST_INTERVAL_MS;
|
_autoModeBlockedTillMillis = millis() + 2 * HUAWEI_DATA_REQUEST_INTERVAL_MS;
|
||||||
} else {
|
} else {
|
||||||
// requested PL is below minium. Set current to 0
|
// requested PL is below minium. Set current to 0
|
||||||
_autoPowerEnabled = false;
|
_autoPowerEnabled = false;
|
||||||
setValue(0.0, HUAWEI_ONLINE_CURRENT);
|
_setValue(0.0, HUAWEI_ONLINE_CURRENT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void HuaweiCanClass::setValue(float in, uint8_t parameterType)
|
void HuaweiCanClass::setValue(float in, uint8_t parameterType)
|
||||||
|
{
|
||||||
|
if (_mode != HUAWEI_MODE_AUTO_INT) {
|
||||||
|
_setValue(in, parameterType);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void HuaweiCanClass::_setValue(float in, uint8_t parameterType)
|
||||||
{
|
{
|
||||||
|
|
||||||
const CONFIG_T& config = Configuration.get();
|
const CONFIG_T& config = Configuration.get();
|
||||||
@ -391,7 +398,7 @@ void HuaweiCanClass::setValue(float in, uint8_t parameterType)
|
|||||||
uint16_t value;
|
uint16_t value;
|
||||||
|
|
||||||
if (in < 0) {
|
if (in < 0) {
|
||||||
MessageOutput.printf("[HuaweiCanClass::setValue] Error: Tried to set voltage/current to negative value %f \r\n", in);
|
MessageOutput.printf("[HuaweiCanClass::_setValue] Error: Tried to set voltage/current to negative value %f \r\n", in);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start PSU if needed
|
// Start PSU if needed
|
||||||
@ -435,7 +442,7 @@ void HuaweiCanClass::setMode(uint8_t mode) {
|
|||||||
|
|
||||||
if (_mode == HUAWEI_MODE_AUTO_INT && mode != HUAWEI_MODE_AUTO_INT) {
|
if (_mode == HUAWEI_MODE_AUTO_INT && mode != HUAWEI_MODE_AUTO_INT) {
|
||||||
_autoPowerEnabled = false;
|
_autoPowerEnabled = false;
|
||||||
setValue(0, HUAWEI_ONLINE_CURRENT);
|
_setValue(0, HUAWEI_ONLINE_CURRENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mode == HUAWEI_MODE_AUTO_EXT || mode == HUAWEI_MODE_AUTO_INT) {
|
if(mode == HUAWEI_MODE_AUTO_EXT || mode == HUAWEI_MODE_AUTO_INT) {
|
||||||
|
|||||||
@ -69,7 +69,7 @@ void MqttHandleVedirectHassClass::publishConfig()
|
|||||||
publishSensor("Battery voltage", NULL, "V", "voltage", "measurement", "V");
|
publishSensor("Battery voltage", NULL, "V", "voltage", "measurement", "V");
|
||||||
publishSensor("Battery current", NULL, "I", "current", "measurement", "A");
|
publishSensor("Battery current", NULL, "I", "current", "measurement", "A");
|
||||||
publishSensor("Battery power (calculated)", NULL, "P", "power", "measurement", "W");
|
publishSensor("Battery power (calculated)", NULL, "P", "power", "measurement", "W");
|
||||||
publishSensor("Battery efficiency (calculated)", NULL, "E", "efficiency", "measurement", "%");
|
publishSensor("Battery efficiency (calculated)", NULL, "E", NULL, "measurement", "%");
|
||||||
|
|
||||||
// panel info
|
// panel info
|
||||||
publishSensor("Panel voltage", NULL, "VPV", "voltage", "measurement", "V");
|
publishSensor("Panel voltage", NULL, "VPV", "voltage", "measurement", "V");
|
||||||
|
|||||||
@ -50,7 +50,7 @@ void WebApiHuaweiClass::getJsonData(JsonObject& root) {
|
|||||||
root[F("input_temp")]["u"] = "°C";
|
root[F("input_temp")]["u"] = "°C";
|
||||||
root[F("output_temp")]["v"] = rp->output_temp;
|
root[F("output_temp")]["v"] = rp->output_temp;
|
||||||
root[F("output_temp")]["u"] = "°C";
|
root[F("output_temp")]["u"] = "°C";
|
||||||
root[F("efficiency")]["v"] = rp->efficiency;
|
root[F("efficiency")]["v"] = rp->efficiency * 100;
|
||||||
root[F("efficiency")]["u"] = "%";
|
root[F("efficiency")]["u"] = "%";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -96,7 +96,7 @@ void WebApiWsHuaweiLiveClass::generateJsonResponse(JsonVariant& root)
|
|||||||
root[F("input_temp")]["u"] = "°C";
|
root[F("input_temp")]["u"] = "°C";
|
||||||
root[F("output_temp")]["v"] = rp->output_temp;
|
root[F("output_temp")]["v"] = rp->output_temp;
|
||||||
root[F("output_temp")]["u"] = "°C";
|
root[F("output_temp")]["u"] = "°C";
|
||||||
root[F("efficiency")]["v"] = rp->efficiency;
|
root[F("efficiency")]["v"] = rp->efficiency * 100;
|
||||||
root[F("efficiency")]["u"] = "%";
|
root[F("efficiency")]["u"] = "%";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -70,7 +70,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">{{ $t('huawei.efficiency') }}</th>
|
<th scope="row">{{ $t('huawei.efficiency') }}</th>
|
||||||
<td style="text-align: right">{{ huaweiData.efficiency.v.toFixed(3) }}</td>
|
<td style="text-align: right">{{ huaweiData.efficiency.v.toFixed(1) }}</td>
|
||||||
<td>{{ huaweiData.efficiency.u }}</td>
|
<td>{{ huaweiData.efficiency.u }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|||||||
Binary file not shown.
Loading…
Reference in New Issue
Block a user