mirror of
				https://github.com/esphome/esphome.git
				synced 2025-11-03 16:41:50 +00:00 
			
		
		
		
	Compare commits
	
		
			2 Commits
		
	
	
		
			2025.2.2
			...
			jesserockz
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					cdce8bb9be | ||
| 
						 | 
					d64cfd18ed | 
@@ -213,6 +213,7 @@ message DeviceInfoResponse {
 | 
				
			|||||||
  // The esphome project details if set
 | 
					  // The esphome project details if set
 | 
				
			||||||
  string project_name = 8;
 | 
					  string project_name = 8;
 | 
				
			||||||
  string project_version = 9;
 | 
					  string project_version = 9;
 | 
				
			||||||
 | 
					  string project_manufacturer = 18;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  uint32 webserver_port = 10;
 | 
					  uint32 webserver_port = 10;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1429,7 +1429,7 @@ HelloResponse APIConnection::hello(const HelloRequest &msg) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  HelloResponse resp;
 | 
					  HelloResponse resp;
 | 
				
			||||||
  resp.api_version_major = 1;
 | 
					  resp.api_version_major = 1;
 | 
				
			||||||
  resp.api_version_minor = 10;
 | 
					  resp.api_version_minor = 11;
 | 
				
			||||||
  resp.server_info = App.get_name() + " (esphome v" ESPHOME_VERSION ")";
 | 
					  resp.server_info = App.get_name() + " (esphome v" ESPHOME_VERSION ")";
 | 
				
			||||||
  resp.name = App.get_name();
 | 
					  resp.name = App.get_name();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1479,7 +1479,13 @@ DeviceInfoResponse APIConnection::device_info(const DeviceInfoRequest &msg) {
 | 
				
			|||||||
  resp.has_deep_sleep = deep_sleep::global_has_deep_sleep;
 | 
					  resp.has_deep_sleep = deep_sleep::global_has_deep_sleep;
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
#ifdef ESPHOME_PROJECT_NAME
 | 
					#ifdef ESPHOME_PROJECT_NAME
 | 
				
			||||||
  resp.project_name = ESPHOME_PROJECT_NAME;
 | 
					  if (this->client_api_version_major_ > 1 ||
 | 
				
			||||||
 | 
					      (this->client_api_version_major_ == 1 && this->client_api_version_minor_ >= 11)) {
 | 
				
			||||||
 | 
					    resp.project_name = ESPHOME_PROJECT_NAME;
 | 
				
			||||||
 | 
					    resp.project_manufacturer = ESPHOME_PROJECT_MANUFACTURER;
 | 
				
			||||||
 | 
					  } else {
 | 
				
			||||||
 | 
					    resp.project_name = ESPHOME_PROJECT_MANUFACTURER "." ESPHOME_PROJECT_NAME;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
  resp.project_version = ESPHOME_PROJECT_VERSION;
 | 
					  resp.project_version = ESPHOME_PROJECT_VERSION;
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
#ifdef USE_WEBSERVER
 | 
					#ifdef USE_WEBSERVER
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -826,6 +826,10 @@ bool DeviceInfoResponse::decode_length(uint32_t field_id, ProtoLengthDelimited v
 | 
				
			|||||||
      this->project_version = value.as_string();
 | 
					      this->project_version = value.as_string();
 | 
				
			||||||
      return true;
 | 
					      return true;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					    case 18: {
 | 
				
			||||||
 | 
					      this->project_manufacturer = value.as_string();
 | 
				
			||||||
 | 
					      return true;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
    case 12: {
 | 
					    case 12: {
 | 
				
			||||||
      this->manufacturer = value.as_string();
 | 
					      this->manufacturer = value.as_string();
 | 
				
			||||||
      return true;
 | 
					      return true;
 | 
				
			||||||
@@ -852,6 +856,7 @@ void DeviceInfoResponse::encode(ProtoWriteBuffer buffer) const {
 | 
				
			|||||||
  buffer.encode_bool(7, this->has_deep_sleep);
 | 
					  buffer.encode_bool(7, this->has_deep_sleep);
 | 
				
			||||||
  buffer.encode_string(8, this->project_name);
 | 
					  buffer.encode_string(8, this->project_name);
 | 
				
			||||||
  buffer.encode_string(9, this->project_version);
 | 
					  buffer.encode_string(9, this->project_version);
 | 
				
			||||||
 | 
					  buffer.encode_string(18, this->project_manufacturer);
 | 
				
			||||||
  buffer.encode_uint32(10, this->webserver_port);
 | 
					  buffer.encode_uint32(10, this->webserver_port);
 | 
				
			||||||
  buffer.encode_uint32(11, this->legacy_bluetooth_proxy_version);
 | 
					  buffer.encode_uint32(11, this->legacy_bluetooth_proxy_version);
 | 
				
			||||||
  buffer.encode_uint32(15, this->bluetooth_proxy_feature_flags);
 | 
					  buffer.encode_uint32(15, this->bluetooth_proxy_feature_flags);
 | 
				
			||||||
@@ -901,6 +906,10 @@ void DeviceInfoResponse::dump_to(std::string &out) const {
 | 
				
			|||||||
  out.append("'").append(this->project_version).append("'");
 | 
					  out.append("'").append(this->project_version).append("'");
 | 
				
			||||||
  out.append("\n");
 | 
					  out.append("\n");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  out.append("  project_manufacturer: ");
 | 
				
			||||||
 | 
					  out.append("'").append(this->project_manufacturer).append("'");
 | 
				
			||||||
 | 
					  out.append("\n");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  out.append("  webserver_port: ");
 | 
					  out.append("  webserver_port: ");
 | 
				
			||||||
  sprintf(buffer, "%" PRIu32, this->webserver_port);
 | 
					  sprintf(buffer, "%" PRIu32, this->webserver_port);
 | 
				
			||||||
  out.append(buffer);
 | 
					  out.append(buffer);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -346,6 +346,7 @@ class DeviceInfoResponse : public ProtoMessage {
 | 
				
			|||||||
  bool has_deep_sleep{false};
 | 
					  bool has_deep_sleep{false};
 | 
				
			||||||
  std::string project_name{};
 | 
					  std::string project_name{};
 | 
				
			||||||
  std::string project_version{};
 | 
					  std::string project_version{};
 | 
				
			||||||
 | 
					  std::string project_manufacturer{};
 | 
				
			||||||
  uint32_t webserver_port{0};
 | 
					  uint32_t webserver_port{0};
 | 
				
			||||||
  uint32_t legacy_bluetooth_proxy_version{0};
 | 
					  uint32_t legacy_bluetooth_proxy_version{0};
 | 
				
			||||||
  uint32_t bluetooth_proxy_feature_flags{0};
 | 
					  uint32_t bluetooth_proxy_feature_flags{0};
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -463,6 +463,7 @@ CONF_MAGNITUDE = "magnitude"
 | 
				
			|||||||
CONF_MAINS_FILTER = "mains_filter"
 | 
					CONF_MAINS_FILTER = "mains_filter"
 | 
				
			||||||
CONF_MAKE_ID = "make_id"
 | 
					CONF_MAKE_ID = "make_id"
 | 
				
			||||||
CONF_MANUAL_IP = "manual_ip"
 | 
					CONF_MANUAL_IP = "manual_ip"
 | 
				
			||||||
 | 
					CONF_MANUFACTURER = "manufacturer"
 | 
				
			||||||
CONF_MANUFACTURER_ID = "manufacturer_id"
 | 
					CONF_MANUFACTURER_ID = "manufacturer_id"
 | 
				
			||||||
CONF_MASK_DISTURBER = "mask_disturber"
 | 
					CONF_MASK_DISTURBER = "mask_disturber"
 | 
				
			||||||
CONF_MAX_BRIGHTNESS = "max_brightness"
 | 
					CONF_MAX_BRIGHTNESS = "max_brightness"
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -19,6 +19,7 @@ from esphome.const import (
 | 
				
			|||||||
    CONF_FRIENDLY_NAME,
 | 
					    CONF_FRIENDLY_NAME,
 | 
				
			||||||
    CONF_INCLUDES,
 | 
					    CONF_INCLUDES,
 | 
				
			||||||
    CONF_LIBRARIES,
 | 
					    CONF_LIBRARIES,
 | 
				
			||||||
 | 
					    CONF_MANUFACTURER,
 | 
				
			||||||
    CONF_MIN_VERSION,
 | 
					    CONF_MIN_VERSION,
 | 
				
			||||||
    CONF_NAME,
 | 
					    CONF_NAME,
 | 
				
			||||||
    CONF_NAME_ADD_MAC_SUFFIX,
 | 
					    CONF_NAME_ADD_MAC_SUFFIX,
 | 
				
			||||||
@@ -96,10 +97,33 @@ def valid_include(value):
 | 
				
			|||||||
    return value
 | 
					    return value
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def valid_project_name(value: str):
 | 
					def _validate_project_info(config):
 | 
				
			||||||
    if value.count(".") != 1:
 | 
					    name = config[CONF_NAME]
 | 
				
			||||||
        raise cv.Invalid("project name needs to have a namespace")
 | 
					    dot_count = name.count(".")
 | 
				
			||||||
    return value
 | 
					    if CONF_MANUFACTURER not in config:
 | 
				
			||||||
 | 
					        if dot_count != 1:
 | 
				
			||||||
 | 
					            raise cv.Invalid(
 | 
				
			||||||
 | 
					                f"'{CONF_MANUFACTURER}' is a required option for [{CONF_PROJECT}]"
 | 
				
			||||||
 | 
					            )
 | 
				
			||||||
 | 
					        author, name = name.split(".", 1)
 | 
				
			||||||
 | 
					        config[CONF_MANUFACTURER] = author
 | 
				
			||||||
 | 
					        config[CONF_NAME] = name
 | 
				
			||||||
 | 
					        _LOGGER.warning(
 | 
				
			||||||
 | 
					            "Prefixing %s %s with %s namespace is deprecated and will be disallowed in a future release. "
 | 
				
			||||||
 | 
					            "Please see current documentation for the correct way to define the %s information.",
 | 
				
			||||||
 | 
					            CONF_PROJECT,
 | 
				
			||||||
 | 
					            CONF_NAME,
 | 
				
			||||||
 | 
					            CONF_MANUFACTURER,
 | 
				
			||||||
 | 
					            CONF_PROJECT,
 | 
				
			||||||
 | 
					        )
 | 
				
			||||||
 | 
					    elif dot_count != 0:
 | 
				
			||||||
 | 
					        author, name = name.split(".", 1)
 | 
				
			||||||
 | 
					        raise cv.Invalid(
 | 
				
			||||||
 | 
					            f"Remove {CONF_MANUFACTURER} namespace '{author}.' from the {CONF_PROJECT} {CONF_NAME}",
 | 
				
			||||||
 | 
					            path=[CONF_NAME],
 | 
				
			||||||
 | 
					        )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    return config
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if "ESPHOME_DEFAULT_COMPILE_PROCESS_LIMIT" in os.environ:
 | 
					if "ESPHOME_DEFAULT_COMPILE_PROCESS_LIMIT" in os.environ:
 | 
				
			||||||
@@ -110,7 +134,6 @@ if "ESPHOME_DEFAULT_COMPILE_PROCESS_LIMIT" in os.environ:
 | 
				
			|||||||
else:
 | 
					else:
 | 
				
			||||||
    _compile_process_limit_default = cv.UNDEFINED
 | 
					    _compile_process_limit_default = cv.UNDEFINED
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
CONF_ESP8266_RESTORE_FROM_FLASH = "esp8266_restore_from_flash"
 | 
					CONF_ESP8266_RESTORE_FROM_FLASH = "esp8266_restore_from_flash"
 | 
				
			||||||
CONFIG_SCHEMA = cv.All(
 | 
					CONFIG_SCHEMA = cv.All(
 | 
				
			||||||
    cv.Schema(
 | 
					    cv.Schema(
 | 
				
			||||||
@@ -145,20 +168,22 @@ CONFIG_SCHEMA = cv.All(
 | 
				
			|||||||
            cv.Optional(CONF_INCLUDES, default=[]): cv.ensure_list(valid_include),
 | 
					            cv.Optional(CONF_INCLUDES, default=[]): cv.ensure_list(valid_include),
 | 
				
			||||||
            cv.Optional(CONF_LIBRARIES, default=[]): cv.ensure_list(cv.string_strict),
 | 
					            cv.Optional(CONF_LIBRARIES, default=[]): cv.ensure_list(cv.string_strict),
 | 
				
			||||||
            cv.Optional(CONF_NAME_ADD_MAC_SUFFIX, default=False): cv.boolean,
 | 
					            cv.Optional(CONF_NAME_ADD_MAC_SUFFIX, default=False): cv.boolean,
 | 
				
			||||||
            cv.Optional(CONF_PROJECT): cv.Schema(
 | 
					            cv.Optional(CONF_PROJECT): cv.All(
 | 
				
			||||||
                {
 | 
					                cv.Schema(
 | 
				
			||||||
                    cv.Required(CONF_NAME): cv.All(
 | 
					                    {
 | 
				
			||||||
                        cv.string_strict, valid_project_name
 | 
					                        cv.Optional(CONF_MANUFACTURER): cv.string_strict,
 | 
				
			||||||
                    ),
 | 
					                        cv.Required(CONF_NAME): cv.string_strict,
 | 
				
			||||||
                    cv.Required(CONF_VERSION): cv.string_strict,
 | 
					                        cv.Required(CONF_VERSION): cv.string_strict,
 | 
				
			||||||
                    cv.Optional(CONF_ON_UPDATE): automation.validate_automation(
 | 
					                        cv.Optional(CONF_ON_UPDATE): automation.validate_automation(
 | 
				
			||||||
                        {
 | 
					                            {
 | 
				
			||||||
                            cv.GenerateID(CONF_TRIGGER_ID): cv.declare_id(
 | 
					                                cv.GenerateID(CONF_TRIGGER_ID): cv.declare_id(
 | 
				
			||||||
                                ProjectUpdateTrigger
 | 
					                                    ProjectUpdateTrigger
 | 
				
			||||||
                            ),
 | 
					                                ),
 | 
				
			||||||
                        }
 | 
					                            }
 | 
				
			||||||
                    ),
 | 
					                        ),
 | 
				
			||||||
                }
 | 
					                    }
 | 
				
			||||||
 | 
					                ),
 | 
				
			||||||
 | 
					                _validate_project_info,
 | 
				
			||||||
            ),
 | 
					            ),
 | 
				
			||||||
            cv.Optional(CONF_MIN_VERSION, default=ESPHOME_VERSION): cv.All(
 | 
					            cv.Optional(CONF_MIN_VERSION, default=ESPHOME_VERSION): cv.All(
 | 
				
			||||||
                cv.version_number, cv.validate_esphome_version
 | 
					                cv.version_number, cv.validate_esphome_version
 | 
				
			||||||
@@ -394,6 +419,7 @@ async def to_code(config):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    if project_conf := config.get(CONF_PROJECT):
 | 
					    if project_conf := config.get(CONF_PROJECT):
 | 
				
			||||||
        cg.add_define("ESPHOME_PROJECT_NAME", project_conf[CONF_NAME])
 | 
					        cg.add_define("ESPHOME_PROJECT_NAME", project_conf[CONF_NAME])
 | 
				
			||||||
 | 
					        cg.add_define("ESPHOME_PROJECT_AUTHOR", project_conf[CONF_MANUFACTURER])
 | 
				
			||||||
        cg.add_define("ESPHOME_PROJECT_VERSION", project_conf[CONF_VERSION])
 | 
					        cg.add_define("ESPHOME_PROJECT_VERSION", project_conf[CONF_VERSION])
 | 
				
			||||||
        cg.add_define("ESPHOME_PROJECT_VERSION_30", project_conf[CONF_VERSION][:29])
 | 
					        cg.add_define("ESPHOME_PROJECT_VERSION_30", project_conf[CONF_VERSION][:29])
 | 
				
			||||||
        for conf in project_conf.get(CONF_ON_UPDATE, []):
 | 
					        for conf in project_conf.get(CONF_ON_UPDATE, []):
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -10,6 +10,7 @@
 | 
				
			|||||||
// Informative flags
 | 
					// Informative flags
 | 
				
			||||||
#define ESPHOME_BOARD "dummy_board"
 | 
					#define ESPHOME_BOARD "dummy_board"
 | 
				
			||||||
#define ESPHOME_PROJECT_NAME "dummy project"
 | 
					#define ESPHOME_PROJECT_NAME "dummy project"
 | 
				
			||||||
 | 
					#define ESPHOME_PROJECT_MANUFACTURER "ESPHome"
 | 
				
			||||||
#define ESPHOME_PROJECT_VERSION "v2"
 | 
					#define ESPHOME_PROJECT_VERSION "v2"
 | 
				
			||||||
#define ESPHOME_PROJECT_VERSION_30 "v2"
 | 
					#define ESPHOME_PROJECT_VERSION_30 "v2"
 | 
				
			||||||
#define ESPHOME_VARIANT "ESP32"
 | 
					#define ESPHOME_VARIANT "ESP32"
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user