Ignore different patch versions
Change the versioning control to major and minor only, ignoring differences on the patch version. So components with different patch versions should be able to work with each other as soon the major and minor versions are the same. This same logic was implemented on the blueprint before the 4.0 release.
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
substitutions:
|
||||
|
||||
##### DON'T CHANGE THIS #####
|
||||
version: "4.0"
|
||||
version: "4.0.1dev"
|
||||
#############################
|
||||
|
||||
##### WIFI SETUP #####
|
||||
@@ -2202,15 +2202,37 @@ script:
|
||||
then:
|
||||
- wait_until:
|
||||
condition:
|
||||
- lambda: !lambda 'return (id(version_tft) == "${version}");'
|
||||
- lambda: !lambda 'return (id(version_blueprint) == "${version}");'
|
||||
- lambda: |-
|
||||
auto compareVersions = [](const char* version1, const char* version2) -> bool
|
||||
{
|
||||
int major1 = 0, minor1 = 0;
|
||||
int major2 = 0, minor2 = 0;
|
||||
|
||||
sscanf(version1, "%d.%d", &major1, &minor1);
|
||||
sscanf(version2, "%d.%d", &major2, &minor2);
|
||||
|
||||
return (major1 == major2) && (minor1 == minor2);
|
||||
};
|
||||
return (compareVersions("${version}", id(version_tft).c_str()) and compareVersions("${version}", id(version_blueprint).c_str()));
|
||||
#- lambda: !lambda 'return (id(version_tft) == "${version}");'
|
||||
#- lambda: !lambda 'return (id(version_blueprint) == "${version}");'
|
||||
timeout: 60s
|
||||
- lambda: |-
|
||||
auto compareVersions = [](const char* version1, const char* version2) -> bool
|
||||
{
|
||||
int major1 = 0, minor1 = 0;
|
||||
int major2 = 0, minor2 = 0;
|
||||
|
||||
sscanf(version1, "%d.%d", &major1, &minor1);
|
||||
sscanf(version2, "%d.%d", &major2, &minor2);
|
||||
|
||||
return (major1 == major2) && (minor1 == minor2);
|
||||
};
|
||||
ESP_LOGD("script.check_versions", "ESPHome version: ${version}");
|
||||
ESP_LOGD("script.check_versions", "TFT version: %s", id(version_tft).c_str());
|
||||
if (id(version_tft) != "${version}") ESP_LOGE("script.check_versions", "TFT version mismatch!");
|
||||
if (not compareVersions("${version}", id(version_tft).c_str())) ESP_LOGE("script.check_versions", "TFT version mismatch!");
|
||||
ESP_LOGD("script.check_versions", "Blueprint version: %s", id(version_blueprint).c_str());
|
||||
if (id(version_blueprint) != "${version}") ESP_LOGE("script.check_versions", "Blueprint version mismatch!");
|
||||
if (not compareVersions("${version}", id(version_blueprint).c_str())) ESP_LOGE("script.check_versions", "Blueprint version mismatch!");
|
||||
auto ha_event = new esphome::api::CustomAPIDevice();
|
||||
ha_event->fire_homeassistant_event("esphome.nspanel_ha_blueprint",
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user