Refactor official Nuki MQTT support. Move offical-specific code into sepereate class. (#470)
* move offical related members to seperate class * remove static references * add buildMqttPath and comparePrefixedPath methods to NukiOfficial * make offMqttPath private * fix references and syntax errors * move nuki official publish state update check to NukiNetworkLock * make _disableNonJSON private * make NukiOfficial members private * move _offCommand to NukiWrapper * make offCommandExecutedTs private * make offTopics privte * fix nuki publisher reference not set * use NukiPublisher in NukiNetworkOpener * fix build updater * fix pl_off and stat_off strings
This commit is contained in:
25
src/NukiPublisher.h
Normal file
25
src/NukiPublisher.h
Normal file
@@ -0,0 +1,25 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include "NukiNetwork.h"
|
||||
|
||||
class NukiPublisher
|
||||
{
|
||||
public:
|
||||
NukiPublisher(NukiNetwork* _network, const char* mqttPath);
|
||||
|
||||
void publishFloat(const char* topic, const float value, bool retain, const uint8_t precision = 2);
|
||||
void publishInt(const char* topic, const int value, bool retain);
|
||||
void publishUInt(const char* topic, const unsigned int value, bool retain);
|
||||
void publishULong(const char* topic, const unsigned long value, bool retain);
|
||||
void publishLongLong(const char* topic, int64_t value, bool retain);
|
||||
void publishBool(const char* topic, const bool value, bool retain);
|
||||
bool publishString(const char* topic, const String& value, bool retain);
|
||||
bool publishString(const char* topic, const std::string& value, bool retain);
|
||||
bool publishString(const char* topic, const char* value, bool retain);
|
||||
|
||||
private:
|
||||
NukiNetwork* _network;
|
||||
const char* _mqttPath;
|
||||
|
||||
};
|
||||
Reference in New Issue
Block a user