2022-07-15 18:05:58 +02:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2022-06-15 21:37:25 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
2022-06-15 21:50:49 +02:00
|
|
|
#include "Configuration.h"
|
2022-06-15 21:37:25 +02:00
|
|
|
#include <Arduino.h>
|
|
|
|
|
#include <Hoymiles.h>
|
|
|
|
|
#include <memory>
|
|
|
|
|
|
|
|
|
|
class MqttPublishingClass {
|
|
|
|
|
public:
|
|
|
|
|
void init();
|
|
|
|
|
void loop();
|
|
|
|
|
|
|
|
|
|
private:
|
2022-07-18 19:13:58 +02:00
|
|
|
void publishField(std::shared_ptr<InverterAbstract> inv, uint8_t channel, uint8_t fieldId);
|
|
|
|
|
String getTopic(std::shared_ptr<InverterAbstract> inv, uint8_t channel, uint8_t fieldId);
|
2022-06-15 21:50:49 +02:00
|
|
|
|
|
|
|
|
uint32_t _lastPublishStats[INV_MAX_COUNT];
|
2022-06-15 22:15:02 +02:00
|
|
|
uint32_t _lastPublish;
|
2022-07-18 19:13:58 +02:00
|
|
|
|
|
|
|
|
uint8_t _publishFields[13] = {
|
|
|
|
|
FLD_UDC,
|
|
|
|
|
FLD_IDC,
|
|
|
|
|
FLD_PDC,
|
|
|
|
|
FLD_YD,
|
|
|
|
|
FLD_YT,
|
|
|
|
|
FLD_UAC,
|
|
|
|
|
FLD_IAC,
|
|
|
|
|
FLD_PAC,
|
|
|
|
|
FLD_F,
|
|
|
|
|
FLD_T,
|
|
|
|
|
FLD_PCT,
|
|
|
|
|
FLD_EFF,
|
|
|
|
|
FLD_IRR
|
|
|
|
|
};
|
2022-06-15 21:37:25 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
extern MqttPublishingClass MqttPublishing;
|