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

Add area (zone) to esphome core config to be suggested through API and MQTT. (#5602)

Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
This commit is contained in:
Cossid
2023-10-26 17:38:52 -05:00
committed by GitHub
parent cfbf3681f3
commit bcfbcd9578
10 changed files with 31 additions and 3 deletions

View File

@@ -59,8 +59,8 @@ namespace esphome {
class Application {
public:
void pre_setup(const std::string &name, const std::string &friendly_name, const char *comment,
const char *compilation_time, bool name_add_mac_suffix) {
void pre_setup(const std::string &name, const std::string &friendly_name, const std::string &area,
const char *comment, const char *compilation_time, bool name_add_mac_suffix) {
arch_init();
this->name_add_mac_suffix_ = name_add_mac_suffix;
if (name_add_mac_suffix) {
@@ -74,6 +74,7 @@ class Application {
this->name_ = name;
this->friendly_name_ = friendly_name;
}
this->area_ = area;
this->comment_ = comment;
this->compilation_time_ = compilation_time;
}
@@ -160,6 +161,10 @@ class Application {
/// Get the friendly name of this Application set by pre_setup().
const std::string &get_friendly_name() const { return this->friendly_name_; }
/// Get the area of this Application set by pre_setup().
const std::string &get_area() const { return this->area_; }
/// Get the comment of this Application set by pre_setup().
std::string get_comment() const { return this->comment_; }
@@ -395,6 +400,7 @@ class Application {
std::string name_;
std::string friendly_name_;
std::string area_;
const char *comment_{nullptr};
const char *compilation_time_{nullptr};
bool name_add_mac_suffix_;