mirror of
https://github.com/esphome/esphome.git
synced 2025-10-26 04:33:47 +00:00
Merge branch 'helper_for_name_suffix' into integration
This commit is contained in:
@@ -217,8 +217,7 @@ bool ESP32BLE::ble_setup_() {
|
||||
if (this->name_.has_value()) {
|
||||
name = this->name_.value();
|
||||
if (App.is_name_add_mac_suffix_enabled()) {
|
||||
name += "-";
|
||||
name += get_mac_address().substr(6);
|
||||
name = make_name_with_suffix(name, '-', get_mac_address().substr(6));
|
||||
}
|
||||
} else {
|
||||
name = App.get_name();
|
||||
|
||||
@@ -691,7 +691,7 @@ void EthernetComponent::set_manual_ip(const ManualIP &manual_ip) { this->manual_
|
||||
|
||||
std::string EthernetComponent::get_use_address() const {
|
||||
if (this->use_address_.empty()) {
|
||||
return App.get_name() + ".local";
|
||||
return make_name_with_suffix(App.get_name(), '.', "local");
|
||||
}
|
||||
return this->use_address_;
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ static const char *const TAG = "mqtt";
|
||||
|
||||
MQTTClientComponent::MQTTClientComponent() {
|
||||
global_mqtt_client = this;
|
||||
this->credentials_.client_id = App.get_name() + "-" + get_mac_address();
|
||||
this->credentials_.client_id = make_name_with_suffix(App.get_name(), '-', get_mac_address());
|
||||
}
|
||||
|
||||
// Connection
|
||||
|
||||
@@ -267,7 +267,7 @@ network::IPAddress WiFiComponent::get_dns_address(int num) {
|
||||
}
|
||||
std::string WiFiComponent::get_use_address() const {
|
||||
if (this->use_address_.empty()) {
|
||||
return App.get_name() + ".local";
|
||||
return make_name_with_suffix(App.get_name(), '.', "local");
|
||||
}
|
||||
return this->use_address_;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user