Files
AI-on-the-edge-device/code/components/jomjol_mqtt/server_mqtt.h
CaCO3 a1a77ae5d9 Improve MQTT (#2091)
* moved functions

* use hostname as default MQTT maintopic if parameter is not set

* use hostname as default MQTT client ID

* Only send Homassistant Discovery and Static Topics on the first connect. Retry in next round if any topic failed

* .

* add missing return code usage

* send maintopic/connection on every round like the system topics

---------

Co-authored-by: CaCO3 <caco@ruinelli.ch>
2023-02-27 18:26:46 +01:00

26 lines
746 B
C++

#ifdef ENABLE_MQTT
#pragma once
#ifndef SERVERMQTT_H
#define SERVERMQTT_H
#include "ClassFlowDefineTypes.h"
void SetHomeassistantDiscoveryEnabled(bool enabled);
void mqttServer_setParameter(std::vector<NumberPost*>* _NUMBERS, int interval, float roundInterval);
void mqttServer_setMeterType(std::string meterType, std::string valueUnit, std::string timeUnit,std::string rateUnit);
void setMqtt_Server_Retain(bool SetRetainFlag);
void mqttServer_setMainTopic( std::string maintopic);
std::string mqttServer_getMainTopic();
void register_server_mqtt_uri(httpd_handle_t server);
bool publishSystemData();
std::string getTimeUnit(void);
void GotConnected(std::string maintopic, bool SetRetainFlag);
#endif //SERVERMQTT_H
#endif //ENABLE_MQTT