WebApi update to include power values
This commit is contained in:
parent
75a59f5d1d
commit
3861ab89f1
@ -7,6 +7,8 @@
|
|||||||
#include "MessageOutput.h"
|
#include "MessageOutput.h"
|
||||||
#include "WebApi.h"
|
#include "WebApi.h"
|
||||||
#include "Battery.h"
|
#include "Battery.h"
|
||||||
|
#include "Huawei_can.h"
|
||||||
|
#include "PowerMeter.h"
|
||||||
#include "VeDirectFrameHandler.h"
|
#include "VeDirectFrameHandler.h"
|
||||||
#include "defaults.h"
|
#include "defaults.h"
|
||||||
#include <AsyncJson.h>
|
#include <AsyncJson.h>
|
||||||
@ -197,10 +199,17 @@ void WebApiWsLiveClass::generateJsonResponse(JsonVariant& root)
|
|||||||
|
|
||||||
JsonObject huaweiObj = root.createNestedObject("huawei");
|
JsonObject huaweiObj = root.createNestedObject("huawei");
|
||||||
huaweiObj[F("enabled")] = Configuration.get().Huawei_Enabled;
|
huaweiObj[F("enabled")] = Configuration.get().Huawei_Enabled;
|
||||||
|
const RectifierParameters_t * rp = HuaweiCan.get();
|
||||||
|
addTotalField(huaweiObj, "Power", rp->output_power, "W", 2);
|
||||||
|
|
||||||
JsonObject batteryObj = root.createNestedObject("battery");
|
JsonObject batteryObj = root.createNestedObject("battery");
|
||||||
batteryObj[F("enabled")] = Configuration.get().Battery_Enabled;
|
batteryObj[F("enabled")] = Configuration.get().Battery_Enabled;
|
||||||
addTotalField(batteryObj, "soc", Battery.stateOfCharge, "%", 0);
|
addTotalField(batteryObj, "soc", Battery.stateOfCharge, "%", 0);
|
||||||
|
|
||||||
|
JsonObject powerMeterObj = root.createNestedObject("power_meter");
|
||||||
|
powerMeterObj[F("enabled")] = Configuration.get().PowerMeter_Enabled;
|
||||||
|
addTotalField(powerMeterObj, "Power", PowerMeter.getPowerTotal(), "W", 1);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebApiWsLiveClass::addField(JsonObject& root, uint8_t idx, std::shared_ptr<InverterAbstract> inv, ChannelType_t type, ChannelNum_t channel, FieldId_t fieldId, String topic)
|
void WebApiWsLiveClass::addField(JsonObject& root, uint8_t idx, std::shared_ptr<InverterAbstract> inv, ChannelType_t type, ChannelNum_t channel, FieldId_t fieldId, String topic)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user