OpenDTU/include/MqttHandleInverter.h
Thomas Basler d4c838a16e BREAKING CHANGE: Prometheus API!
Added additional field to the prometheus api which identifies a channel by it's type. That means that e.g. channel 0  exists for type AC and DC.

This commit also introduces a additional field in the statistics byte assignment table. This field identifies whether a channel is on the AC or DC side. MQTT and WebAPI is still compatible with the previous design.
2023-02-06 19:51:10 +01:00

40 lines
1.0 KiB
C++

// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include "Configuration.h"
#include <Hoymiles.h>
#include <espMqttClient.h>
class MqttHandleInverterClass {
public:
void init();
void loop();
static String getTopic(std::shared_ptr<InverterAbstract> inv, ChannelType_t type, ChannelNum_t channel, FieldId_t fieldId);
private:
void publishField(std::shared_ptr<InverterAbstract> inv, ChannelType_t type, ChannelNum_t channel, FieldId_t fieldId);
void onMqttMessage(const espMqttClientTypes::MessageProperties& properties, const char* topic, const uint8_t* payload, size_t len, size_t index, size_t total);
uint32_t _lastPublishStats[INV_MAX_COUNT];
uint32_t _lastPublish;
FieldId_t _publishFields[14] = {
FLD_UDC,
FLD_IDC,
FLD_PDC,
FLD_YD,
FLD_YT,
FLD_UAC,
FLD_IAC,
FLD_PAC,
FLD_F,
FLD_T,
FLD_PF,
FLD_EFF,
FLD_IRR,
FLD_PRA
};
};
extern MqttHandleInverterClass MqttHandleInverter;