74class Mqtt :
public ProtocolLayer {
79 void onInit()
override;
80 bool onLoadConfig()
override;
81 bool verifyConfig()
override;
82 bool isEnabled()
override;
85 bool isNetworkRestartRequested()
override;
86 uint32_t getConnectionFailTime()
override;
87 bool isConnectionError()
override;
88 bool isConnecting()
override;
89 void publish(
const char *topic,
93 bool ignorePrefix =
false);
94 void publishInt(
const char *topic,
98 void publishBool(
const char *topic,
102 void publishOnOff(
const char *topic,
bool payload,
int qos,
int retain);
103 void publishOpenClosed(
const char *topic,
bool payload,
int qos,
int retain);
104 void publishDouble(
const char *topic,
109 void publishColor(
const char *topic,
115 void publishChannelState(
int channel);
116 void publishExtendedChannelState(
int channel);
117 void subscribeChannel(
int channel);
118 void subscribe(
const char *topic,
int qos = -1);
119 bool isUpdatePending()
override;
120 bool isRegisteredAndReady()
override;
121 void notifyConfigChange(
int channelNumber)
override;
123 void sendActionTrigger(uint8_t channelNumber, uint32_t actionId)
override;
124 void sendChannelValueChanged(uint8_t channelNumber, int8_t *value,
125 unsigned char offline, uint32_t validityTimeSec)
override;
126 void sendExtendedChannelValueChanged(uint8_t channelNumber,
129 bool processData(
const char *topic,
const char *payload);
130 void processRelayRequest(
const char *topic,
133 void processRGBWRequest(
const char *topic,
136 void processRGBRequest(
const char *topic,
139 void processDimmerRequest(
const char *topic,
142 void processHVACRequest(
const char *topic,
145 void processRollerShutterRequest(
const char *topic,
150 void generateClientId(
char result[MQTT_CLIENTID_MAX_SIZE]);
151 void generateObjectId(
char result[30],
int channelNumber,
int subId);
152 MqttTopic getHADiscoveryTopic(
const char *sensor,
char *objectId);
153 void publishDeviceStatus(
bool onRegistration =
false);
154 void publishHADiscovery(
int channel);
171 void publishHADiscoveryEMParameter(
172 Supla::Element *element,
int parameterId,
const char *parameterName,
173 const char *units, Supla::Protocol::HAStateClass stateClass,
174 Supla::Protocol::HADeviceClass deviceClass);
175 const char *getActionTriggerType(uint8_t actionIdx);
176 bool isActionTriggerEnabled(
Supla::Channel *ch, uint8_t actionIdx);
177 virtual void publishImp(
const char *topic,
181 virtual void subscribeImp(
const char *topic,
int qos) = 0;
182 const char *getStateClassStr(Supla::Protocol::HAStateClass stateClass);
183 const char *getDeviceClassStr(Supla::Protocol::HADeviceClass deviceClass);
185 const char *getRelayChannelName(
int channelFunction)
const;
186 const char *getBinarySensorChannelName(
int channelFunction)
const;
188 bool isPayloadOn(
const char *);
189 bool isOpenClosedBinarySensorFunction(
int channelFunction)
const;
191 char server[SUPLA_SERVER_NAME_MAXSIZE] = {};
193 char user[MQTT_USERNAME_MAX_SIZE] = {};
194 char password[MQTT_PASSWORD_MAX_SIZE] = {};
195 char hostname[32] = {};
199 bool retainCfg =
false;
201 bool connecting =
false;
202 bool connected =
false;
204 char *prefix =
nullptr;
207 int channelsCount = 0;
214 int buttonNumber = 0;
215 uint8_t configChangedBit[8] = {};