hooked to LiveView instead of MQTT

This commit is contained in:
Ralf Bauer 2023-06-05 22:27:31 +02:00
parent 5f1664ad6b
commit d6b8f260fb
2 changed files with 4 additions and 2 deletions

View File

@ -10,7 +10,6 @@
#include "WebApi_database.h" #include "WebApi_database.h"
MqttHandleInverterTotalClass MqttHandleInverterTotal; MqttHandleInverterTotalClass MqttHandleInverterTotal;
WebApiDatabaseClass database;
void MqttHandleInverterTotalClass::init() void MqttHandleInverterTotalClass::init()
{ {
@ -34,6 +33,5 @@ void MqttHandleInverterTotalClass::loop()
_lastPublish.set(Configuration.get().Mqtt_PublishInterval * 1000); _lastPublish.set(Configuration.get().Mqtt_PublishInterval * 1000);
database.write(Datastore.getTotalAcYieldTotalEnabled()); // write value to database
} }
} }

View File

@ -10,6 +10,8 @@
#include "defaults.h" #include "defaults.h"
#include <AsyncJson.h> #include <AsyncJson.h>
WebApiDatabaseClass database;
WebApiWsLiveClass::WebApiWsLiveClass() WebApiWsLiveClass::WebApiWsLiveClass()
: _ws("/livedata") : _ws("/livedata")
{ {
@ -164,6 +166,8 @@ void WebApiWsLiveClass::generateJsonResponse(JsonVariant& root)
addTotalField(totalObj, "YieldDay", Datastore.getTotalAcYieldDayEnabled(), "Wh", Datastore.getTotalAcYieldDayDigits()); addTotalField(totalObj, "YieldDay", Datastore.getTotalAcYieldDayEnabled(), "Wh", Datastore.getTotalAcYieldDayDigits());
addTotalField(totalObj, "YieldTotal", Datastore.getTotalAcYieldTotalEnabled(), "kWh", Datastore.getTotalAcYieldTotalDigits()); addTotalField(totalObj, "YieldTotal", Datastore.getTotalAcYieldTotalEnabled(), "kWh", Datastore.getTotalAcYieldTotalDigits());
database.write(Datastore.getTotalAcYieldTotalEnabled()); // write value to database
JsonObject hintObj = root.createNestedObject("hints"); JsonObject hintObj = root.createNestedObject("hints");
struct tm timeinfo; struct tm timeinfo;
hintObj["time_sync"] = !getLocalTime(&timeinfo, 5); hintObj["time_sync"] = !getLocalTime(&timeinfo, 5);