1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-24 22:22:22 +01:00

Add option to suffix name with mac address (#1615)

* Add option to suffix name with mac address

* Rename and add to test file
This commit is contained in:
Jesse Hills
2021-03-18 09:22:48 +13:00
committed by GitHub
parent 7708b81ef5
commit faf577a9dd
3 changed files with 15 additions and 3 deletions

View File

@@ -37,8 +37,12 @@ namespace esphome {
class Application {
public:
void pre_setup(const std::string &name, const char *compilation_time) {
this->name_ = name;
void pre_setup(const std::string &name, const char *compilation_time, bool name_add_mac_suffix) {
if (name_add_mac_suffix) {
this->name_ = name + "_" + get_mac_address().substr(6);
} else {
this->name_ = name;
}
this->compilation_time_ = compilation_time;
global_preferences.begin();
}