Browse Source

isProducing readable with todo

pull/361/head
DanielR92 2 years ago
parent
commit
d6dfe6dc1a
  1. 17
      tools/esp8266/app.cpp

17
tools/esp8266/app.cpp

@ -412,22 +412,27 @@ void app::processPayload(bool retransmit) {
}
}
if(iv->isProducing(mTimestamp, rec)){
snprintf(topic, 32 + MAX_NAME_LENGTH, "%s/available_text", iv->name);
// Todo: make this section nice to read.
snprintf(topic, 32 + MAX_NAME_LENGTH, "%s/available_text", iv->name);
if(iv->isProducing(mTimestamp, rec))
{
snprintf(val, 32, DEF_MQTT_IV_MESSAGE_INVERTER_AVAIL_AND_PRODUCED);
mMqtt.sendMsg(topic, val);
snprintf(topic, 32 + MAX_NAME_LENGTH, "%s/available", iv->name);
snprintf(val, 32, "2");
mMqtt.sendMsg(topic, val);
} else {
snprintf(topic, 32 + MAX_NAME_LENGTH, "%s/available_text", iv->name);
snprintf(val, 32, DEF_MQTT_IV_MESSAGE_INVERTER_AVAIL_AND_NOT_PRODUCED);
mMqtt.sendMsg(topic, val);
snprintf(topic, 32 + MAX_NAME_LENGTH, "%s/available", iv->name);
snprintf(val, 32, "1");
mMqtt.sendMsg(topic, val);
}
mMqtt.sendMsg(topic, val);
snprintf(topic, 32 + MAX_NAME_LENGTH, "%s/last_success", iv->name);
snprintf(val, 48, "%i", iv->getLastTs(rec) * 1000);
mMqtt.sendMsg(topic, val);
@ -518,7 +523,7 @@ void app::cbMqtt(char* topic, byte* payload, unsigned int length) {
if (!iv->devControlRequest) // still pending
{
token = strtok(NULL, "/");
switch ( std::stoi(token) )
{
// Active Power Control

Loading…
Cancel
Save