More restructuring

This commit is contained in:
Gunnar Skjold
2022-09-03 14:03:15 +02:00
parent 493c4b4337
commit 584c7b1154
29 changed files with 253 additions and 19 deletions

View File

@@ -0,0 +1,38 @@
#ifndef _HOMEASSISTANTMQTTHANDLER_H
#define _HOMEASSISTANTMQTTHANDLER_H
#include "AmsMqttHandler.h"
class HomeAssistantMqttHandler : public AmsMqttHandler {
public:
HomeAssistantMqttHandler(MQTTClient* mqtt, char* buf, const char* clientId, const char* topic, HwTools* hw) : AmsMqttHandler(mqtt, buf) {
this->clientId = clientId;
this->topic = String(topic);
this->hw = hw;
};
bool publish(AmsData* data, AmsData* previousState, EnergyAccounting* ea);
bool publishTemperatures(AmsConfiguration*, HwTools*);
bool publishPrices(EntsoeApi*);
bool publishSystem(HwTools*);
private:
static const uint8_t sensors = 17;
String haTopic = "homeassistant/sensor/";
String haName = "AMS reader";
#if defined(ESP32)
String haModel = "ESP32";
#elif defined(ESP8266)
String haModel = "ESP8266";
#endif
String haManuf = "AmsToMqttBridge";
bool autodiscoverInit = false;
String clientId;
String topic;
HwTools* hw;
uint8_t sequence = 0, listType = 0;
};
#endif