implemented "patrix/json"
This commit is contained in:
parent
0cc55f3b87
commit
1836cfbe8a
@ -63,7 +63,7 @@ def do_main():
|
|||||||
|
|
||||||
if 1:
|
if 1:
|
||||||
# Add the description of the current git revision
|
# Add the description of the current git revision
|
||||||
lines += 'const char *__COMPILED_GIT_HASH__ = "%s";\n' % (get_build_version())
|
lines += 'const char *__COMPILED_GIT_HASH__ = "%s-patrix";\n' % (get_build_version())
|
||||||
|
|
||||||
updateFileIfChanged(targetfile, bytes(lines, "utf-8"))
|
updateFileIfChanged(targetfile, bytes(lines, "utf-8"))
|
||||||
|
|
||||||
|
|||||||
@ -32,6 +32,14 @@ void MqttHandleInverterTotalClass::loop()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float power = Datastore.getTotalAcPowerEnabled();
|
||||||
|
float energy = Datastore.getTotalAcYieldTotalEnabled();
|
||||||
|
if (!isnan(power) && !isnan(energy)) {
|
||||||
|
char buffer[200];
|
||||||
|
snprintf(buffer, sizeof buffer, R"({"timestamp": %ld, "energyProducedKWh": %f, "powerW": %f})", std::time(nullptr), energy, power);
|
||||||
|
MqttSettings.publish("patrix/json", buffer);
|
||||||
|
}
|
||||||
|
|
||||||
MqttSettings.publish("ac/power", String(Datastore.getTotalAcPowerEnabled(), Datastore.getTotalAcPowerDigits()));
|
MqttSettings.publish("ac/power", String(Datastore.getTotalAcPowerEnabled(), Datastore.getTotalAcPowerDigits()));
|
||||||
MqttSettings.publish("ac/yieldtotal", String(Datastore.getTotalAcYieldTotalEnabled(), Datastore.getTotalAcYieldTotalDigits()));
|
MqttSettings.publish("ac/yieldtotal", String(Datastore.getTotalAcYieldTotalEnabled(), Datastore.getTotalAcYieldTotalDigits()));
|
||||||
MqttSettings.publish("ac/yieldday", String(Datastore.getTotalAcYieldDayEnabled(), Datastore.getTotalAcYieldDayDigits()));
|
MqttSettings.publish("ac/yieldday", String(Datastore.getTotalAcYieldDayEnabled(), Datastore.getTotalAcYieldDayDigits()));
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user