forked from tbnobody/OpenDTU
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMqttHandleInverter.h
40 lines (33 loc) · 1.01 KB
/
MqttHandleInverter.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// 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_Q
};
};
extern MqttHandleInverterClass MqttHandleInverter;