Add default object_id_generator for mqtt (#3389)

This commit is contained in:
Jesse Hills 2022-04-14 11:25:31 +12:00 committed by GitHub
parent b4a86ce6cf
commit 047c18eac0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View file

@ -556,7 +556,12 @@ void MQTTClientComponent::disable_last_will() { this->last_will_.topic = ""; }
void MQTTClientComponent::disable_discovery() { void MQTTClientComponent::disable_discovery() {
this->discovery_info_ = MQTTDiscoveryInfo{ this->discovery_info_ = MQTTDiscoveryInfo{
.prefix = "", .retain = false, .clean = false, .unique_id_generator = MQTT_LEGACY_UNIQUE_ID_GENERATOR}; .prefix = "",
.retain = false,
.clean = false,
.unique_id_generator = MQTT_LEGACY_UNIQUE_ID_GENERATOR,
.object_id_generator = MQTT_NONE_OBJECT_ID_GENERATOR,
};
} }
void MQTTClientComponent::on_shutdown() { void MQTTClientComponent::on_shutdown() {
if (!this->shutdown_message_.topic.empty()) { if (!this->shutdown_message_.topic.empty()) {

View file

@ -277,6 +277,7 @@ class MQTTClientComponent : public Component {
.retain = true, .retain = true,
.clean = false, .clean = false,
.unique_id_generator = MQTT_LEGACY_UNIQUE_ID_GENERATOR, .unique_id_generator = MQTT_LEGACY_UNIQUE_ID_GENERATOR,
.object_id_generator = MQTT_NONE_OBJECT_ID_GENERATOR,
}; };
std::string topic_prefix_{}; std::string topic_prefix_{};
MQTTMessage log_message_; MQTTMessage log_message_;