10 static const char *
const TAG =
"mqtt.custom";
17 return this->
publish(topic, str);
21 sprintf(buffer,
"%d", value);
22 return this->
publish(topic, buffer);
bool is_connected()
Check whether the MQTT client is currently connected and messages can be published.
std::string value_accuracy_to_string(float value, int8_t accuracy_decimals)
Create a string from a value and an accuracy in decimals.
bool publish(const std::string &topic, const std::string &payload, uint8_t qos=0, bool retain=false)
Publish an MQTT message with the given payload and QoS and retain settings.
MQTTClientComponent * global_mqtt_client
bool publish_json(const std::string &topic, const json::json_build_t &f, uint8_t qos, bool retain)
Publish a JSON-encoded MQTT message with the given Quality of Service and retain settings.
bool publish(const MQTTMessage &message)
Publish a MQTTMessage.
std::function< void(JsonObject)> json_build_t
Callback function typedef for building JsonObjects.
bool publish_json(const std::string &topic, const json::json_build_t &f, uint8_t qos=0, bool retain=false)
Construct and send a JSON MQTT message.
Implementation of SPI Controller mode.