Publish HASS config when deleting, editing or adding a inverter
This commit is contained in:
parent
aaca7ad0b6
commit
8b66793779
@ -7,6 +7,7 @@
|
|||||||
#include "AsyncJson.h"
|
#include "AsyncJson.h"
|
||||||
#include "Configuration.h"
|
#include "Configuration.h"
|
||||||
#include "Hoymiles.h"
|
#include "Hoymiles.h"
|
||||||
|
#include "MqttHassPublishing.h"
|
||||||
#include "helper.h"
|
#include "helper.h"
|
||||||
|
|
||||||
void WebApiInverterClass::init(AsyncWebServer* server)
|
void WebApiInverterClass::init(AsyncWebServer* server)
|
||||||
@ -143,6 +144,8 @@ void WebApiInverterClass::onInverterAdd(AsyncWebServerRequest* request)
|
|||||||
for (uint8_t c = 0; c < INV_MAX_CHAN_COUNT; c++) {
|
for (uint8_t c = 0; c < INV_MAX_CHAN_COUNT; c++) {
|
||||||
inv->Statistics()->setChannelMaxPower(c, inverter->MaxChannelPower[c]);
|
inv->Statistics()->setChannelMaxPower(c, inverter->MaxChannelPower[c]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MqttHassPublishing.publishConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebApiInverterClass::onInverterEdit(AsyncWebServerRequest* request)
|
void WebApiInverterClass::onInverterEdit(AsyncWebServerRequest* request)
|
||||||
@ -217,7 +220,6 @@ void WebApiInverterClass::onInverterEdit(AsyncWebServerRequest* request)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
INVERTER_CONFIG_T& inverter = Configuration.get().Inverter[root[F("id")].as<uint8_t>()];
|
INVERTER_CONFIG_T& inverter = Configuration.get().Inverter[root[F("id")].as<uint8_t>()];
|
||||||
|
|
||||||
char* t;
|
char* t;
|
||||||
@ -250,6 +252,8 @@ void WebApiInverterClass::onInverterEdit(AsyncWebServerRequest* request)
|
|||||||
for (uint8_t c = 0; c < INV_MAX_CHAN_COUNT; c++) {
|
for (uint8_t c = 0; c < INV_MAX_CHAN_COUNT; c++) {
|
||||||
inv->Statistics()->setChannelMaxPower(c, inverter.MaxChannelPower[c]);
|
inv->Statistics()->setChannelMaxPower(c, inverter.MaxChannelPower[c]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MqttHassPublishing.publishConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebApiInverterClass::onInverterDelete(AsyncWebServerRequest* request)
|
void WebApiInverterClass::onInverterDelete(AsyncWebServerRequest* request)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user