Rename MqttPublishing to MqttHandleInverter
This commit is contained in:
parent
5dde17c56b
commit
723a2c6dbe
@ -6,7 +6,7 @@
|
||||
#include <Hoymiles.h>
|
||||
#include <memory>
|
||||
|
||||
class MqttPublishingClass {
|
||||
class MqttHandleInverterClass {
|
||||
public:
|
||||
void init();
|
||||
void loop();
|
||||
@ -37,4 +37,4 @@ private:
|
||||
};
|
||||
};
|
||||
|
||||
extern MqttPublishingClass MqttPublishing;
|
||||
extern MqttHandleInverterClass MqttHandleInverter;
|
||||
@ -3,7 +3,7 @@
|
||||
* Copyright (C) 2022 Thomas Basler and others
|
||||
*/
|
||||
#include "MqttHandleHass.h"
|
||||
#include "MqttPublishing.h"
|
||||
#include "MqttHandleInverter.h"
|
||||
#include "MqttSettings.h"
|
||||
#include "NetworkSettings.h"
|
||||
|
||||
@ -99,7 +99,7 @@ void MqttHandleHassClass::publishField(std::shared_ptr<InverterAbstract> inv, ui
|
||||
+ "/config";
|
||||
|
||||
if (!clear) {
|
||||
String stateTopic = MqttSettings.getPrefix() + MqttPublishing.getTopic(inv, channel, fieldType.fieldId);
|
||||
String stateTopic = MqttSettings.getPrefix() + MqttHandleInverter.getTopic(inv, channel, fieldType.fieldId);
|
||||
const char* devCls = deviceClasses[fieldType.deviceClsId];
|
||||
const char* stateCls = stateClasses[fieldType.stateClsId];
|
||||
|
||||
|
||||
@ -2,18 +2,18 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Thomas Basler and others
|
||||
*/
|
||||
#include "MqttPublishing.h"
|
||||
#include "MqttHandleInverter.h"
|
||||
#include "MqttSettings.h"
|
||||
#include "NetworkSettings.h"
|
||||
#include <ctime>
|
||||
|
||||
MqttPublishingClass MqttPublishing;
|
||||
MqttHandleInverterClass MqttHandleInverter;
|
||||
|
||||
void MqttPublishingClass::init()
|
||||
void MqttHandleInverterClass::init()
|
||||
{
|
||||
}
|
||||
|
||||
void MqttPublishingClass::loop()
|
||||
void MqttHandleInverterClass::loop()
|
||||
{
|
||||
if (!MqttSettings.getConnected() || !Hoymiles.getRadio()->isIdle()) {
|
||||
return;
|
||||
@ -102,7 +102,7 @@ void MqttPublishingClass::loop()
|
||||
}
|
||||
}
|
||||
|
||||
void MqttPublishingClass::publishField(std::shared_ptr<InverterAbstract> inv, uint8_t channel, uint8_t fieldId)
|
||||
void MqttHandleInverterClass::publishField(std::shared_ptr<InverterAbstract> inv, uint8_t channel, uint8_t fieldId)
|
||||
{
|
||||
String topic = getTopic(inv, channel, fieldId);
|
||||
if (topic == "") {
|
||||
@ -112,7 +112,7 @@ void MqttPublishingClass::publishField(std::shared_ptr<InverterAbstract> inv, ui
|
||||
MqttSettings.publish(topic, String(inv->Statistics()->getChannelFieldValue(channel, fieldId)));
|
||||
}
|
||||
|
||||
String MqttPublishingClass::getTopic(std::shared_ptr<InverterAbstract> inv, uint8_t channel, uint8_t fieldId)
|
||||
String MqttHandleInverterClass::getTopic(std::shared_ptr<InverterAbstract> inv, uint8_t channel, uint8_t fieldId)
|
||||
{
|
||||
if (!inv->Statistics()->hasChannelFieldValue(channel, fieldId)) {
|
||||
return String("");
|
||||
@ -5,7 +5,7 @@
|
||||
#include "Configuration.h"
|
||||
#include "Hoymiles.h"
|
||||
#include "MqttHandleHass.h"
|
||||
#include "MqttPublishing.h"
|
||||
#include "MqttHandleInverter.h"
|
||||
#include "MqttSettings.h"
|
||||
#include "NetworkSettings.h"
|
||||
#include "NtpSettings.h"
|
||||
@ -68,7 +68,7 @@ void setup()
|
||||
// Initialize MqTT
|
||||
Serial.print(F("Initialize MqTT... "));
|
||||
MqttSettings.init();
|
||||
MqttPublishing.init();
|
||||
MqttHandleInverter.init();
|
||||
MqttHandleHass.init();
|
||||
Serial.println(F("done"));
|
||||
|
||||
@ -133,7 +133,7 @@ void loop()
|
||||
yield();
|
||||
Hoymiles.loop();
|
||||
yield();
|
||||
MqttPublishing.loop();
|
||||
MqttHandleInverter.loop();
|
||||
yield();
|
||||
MqttHandleHass.loop();
|
||||
yield();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user