Skip to content

Commit

Permalink
Merge pull request #2156 from Blackymas/dev
Browse files Browse the repository at this point in the history
Update v4.3.9
  • Loading branch information
edwardtfn committed Jun 18, 2024
2 parents abc586c + ff3e5a3 commit 2ef4756
Show file tree
Hide file tree
Showing 14 changed files with 100 additions and 121 deletions.
4 changes: 2 additions & 2 deletions components/nspanel_ha_blueprint/upload_tft.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// upload_tft.cpp

#ifdef NSPANEL_HA_BLUEPRINT_ADDON_UPLOAD_TFT
// #ifdef NSPANEL_HA_BLUEPRINT_ADDON_UPLOAD_TFT

#include "upload_tft.h"

Expand Down Expand Up @@ -29,4 +29,4 @@ namespace nspanel_ha_blueprint {

} // namespace nspanel_ha_blueprint

#endif // NSPANEL_HA_BLUEPRINT_ADDON_UPLOAD_TFT
// #endif // NSPANEL_HA_BLUEPRINT_ADDON_UPLOAD_TFT
4 changes: 2 additions & 2 deletions components/nspanel_ha_blueprint/upload_tft.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#pragma once

#ifdef NSPANEL_HA_BLUEPRINT_ADDON_UPLOAD_TFT
// #ifdef NSPANEL_HA_BLUEPRINT_ADDON_UPLOAD_TFT

#include <string>

Expand Down Expand Up @@ -31,4 +31,4 @@ namespace nspanel_ha_blueprint {

} // namespace nspanel_ha_blueprint

#endif // NSPANEL_HA_BLUEPRINT_ADDON_UPLOAD_TFT
// #endif // NSPANEL_HA_BLUEPRINT_ADDON_UPLOAD_TFT
8 changes: 4 additions & 4 deletions esphome/nspanel_esphome_addon_ble_tracker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
#####################################################################################################
---

esphome:
platformio_options:
build_flags:
- -D NSPANEL_HA_BLUEPRINT_ADDON_BLE_TRACKER
substitutions:
##### DON'T CHANGE THIS ######
NSPANEL_HA_BLUEPRINT_ADDON_BLE_TRACKER: "true"
##############################

esp32_ble:
id: ble_component
Expand Down
10 changes: 5 additions & 5 deletions esphome/nspanel_esphome_addon_bluetooth_proxy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
#####################################################################################################
---

substitutions:
##### DON'T CHANGE THIS ######
NSPANEL_HA_BLUEPRINT_ADDON_BLUETOOTH_PROXY: "true"
##############################

bluetooth_proxy:
id: ble_proxy

esphome:
platformio_options:
build_flags:
- -D NSPANEL_HA_BLUEPRINT_ADDON_BLUETOOTH_PROXY

packages:
climate_base_package: !include nspanel_esphome_addon_ble_tracker.yaml

Expand Down
60 changes: 28 additions & 32 deletions esphome/nspanel_esphome_addon_climate_base.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,9 @@ substitutions:
addon_climate_cool: "false"
addon_climate_heat: "false"
addon_climate_dual: "false"
NSPANEL_HA_BLUEPRINT_ADDON_CLIMATE_BASE: "true"
##############################

esphome:
platformio_options:
build_flags:
- -D NSPANEL_HA_BLUEPRINT_ADDON_CLIMATE_BASE

climate:
- platform: thermostat
name: Thermostat
Expand Down Expand Up @@ -131,33 +127,33 @@ script:
const uint cooler_relay = ${cooler_relay};
const uint heater_relay = ${heater_relay};
ESP_LOGCONFIG(TAG, "Add-on climate:");
#ifdef NSPANEL_HA_BLUEPRINT_ADDON_CLIMATE_COOL
ESP_LOGCONFIG(TAG, " Cool: Enabled");
if (cooler_relay == 1 or cooler_relay == 2)
ESP_LOGCONFIG(TAG, " Relay: %u", cooler_relay);
else
ESP_LOGE(TAG, " Relay: %u", cooler_relay);
#endif
#ifdef NSPANEL_HA_BLUEPRINT_ADDON_CLIMATE_HEAT
ESP_LOGCONFIG(TAG, " Heat: Enabled");
if (heater_relay == 1 or heater_relay == 2)
ESP_LOGCONFIG(TAG, " Relay: %u", heater_relay);
else
ESP_LOGE(TAG, " Relay: %u", heater_relay);
#endif
#ifdef NSPANEL_HA_BLUEPRINT_ADDON_CLIMATE_DUAL
ESP_LOGCONFIG(TAG, " Dual: Enabled");
if (cooler_relay == 1 or cooler_relay == 2)
ESP_LOGCONFIG(TAG, " Relay (cooler): %u", cooler_relay);
else
ESP_LOGE(TAG, " Relay (cooler): %u", cooler_relay);
if (heater_relay == 1 or heater_relay == 2)
ESP_LOGCONFIG(TAG, " Relay (heater): %u", heater_relay);
else
ESP_LOGE(TAG, " Relay (heater): %u", heater_relay);
if (cooler_relay == heater_relay)
ESP_LOGE(TAG, " Double relay assignment");
#endif
if (${NSPANEL_HA_BLUEPRINT_ADDON_CLIMATE_COOL}) {
ESP_LOGCONFIG(TAG, " Cool: Enabled");
if (cooler_relay == 1 or cooler_relay == 2)
ESP_LOGCONFIG(TAG, " Relay: %u", cooler_relay);
else
ESP_LOGE(TAG, " Relay: %u", cooler_relay);
}
if (${NSPANEL_HA_BLUEPRINT_ADDON_CLIMATE_HEAT}) {
ESP_LOGCONFIG(TAG, " Heat: Enabled");
if (heater_relay == 1 or heater_relay == 2)
ESP_LOGCONFIG(TAG, " Relay: %u", heater_relay);
else
ESP_LOGE(TAG, " Relay: %u", heater_relay);
}
if (${NSPANEL_HA_BLUEPRINT_ADDON_CLIMATE_DUAL}) {
ESP_LOGCONFIG(TAG, " Dual: Enabled");
if (cooler_relay == 1 or cooler_relay == 2)
ESP_LOGCONFIG(TAG, " Relay (cooler): %u", cooler_relay);
else
ESP_LOGE(TAG, " Relay (cooler): %u", cooler_relay);
if (heater_relay == 1 or heater_relay == 2)
ESP_LOGCONFIG(TAG, " Relay (heater): %u", heater_relay);
else
ESP_LOGE(TAG, " Relay (heater): %u", heater_relay);
if (cooler_relay == heater_relay)
ESP_LOGE(TAG, " Double relay assignment");
}
}
- id: !extend init_hardware_climate
Expand Down
6 changes: 1 addition & 5 deletions esphome/nspanel_esphome_addon_climate_cool.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,9 @@ substitutions:

##### DO NOT CHANGE THIS #####
addon_climate_cool: "true"
NSPANEL_HA_BLUEPRINT_ADDON_CLIMATE_COOL: "true"
##############################

esphome:
platformio_options:
build_flags:
- -D NSPANEL_HA_BLUEPRINT_ADDON_CLIMATE_COOL

climate:
- id: !extend thermostat_embedded
min_cooling_off_time: ${min_off_time}s
Expand Down
6 changes: 1 addition & 5 deletions esphome/nspanel_esphome_addon_climate_dual.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,9 @@
substitutions:
##### DO NOT CHANGE THIS #####
addon_climate_dual: "true"
NSPANEL_HA_BLUEPRINT_ADDON_CLIMATE_DUAL: "true"
##############################

esphome:
platformio_options:
build_flags:
- -D NSPANEL_HA_BLUEPRINT_ADDON_CLIMATE_DUAL

climate:
- id: !extend thermostat_embedded
min_cooling_off_time: ${min_off_time}s
Expand Down
6 changes: 1 addition & 5 deletions esphome/nspanel_esphome_addon_climate_heat.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,9 @@ substitutions:

##### DO NOT CHANGE THIS #####
addon_climate_heat: "true"
NSPANEL_HA_BLUEPRINT_ADDON_CLIMATE_HEAT: "true"
##############################

esphome:
platformio_options:
build_flags:
- -D NSPANEL_HA_BLUEPRINT_ADDON_CLIMATE_HEAT

climate:
- id: !extend thermostat_embedded
min_heating_off_time: ${min_off_time}s
Expand Down
7 changes: 4 additions & 3 deletions esphome/nspanel_esphome_addon_cover.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ substitutions:
### Local cover defaults ###
interlock_wait_time: '250'

##### DON'T CHANGE THIS ######
NSPANEL_HA_BLUEPRINT_ADDON_COVER: "true"
##############################

esphome:
platformio_options:
build_flags:
- -D NSPANEL_HA_BLUEPRINT_ADDON_COVER
on_boot:
- priority: 700.29
then:
Expand Down
7 changes: 3 additions & 4 deletions esphome/nspanel_esphome_addon_upload_tft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,9 @@ substitutions:
nextion_update_url: "${nextion_update_base_url}/main/hmi/nspanel_blank.tft"
##############################################

esphome:
platformio_options:
build_flags:
- -D NSPANEL_HA_BLUEPRINT_ADDON_UPLOAD_TFT
##### DON'T CHANGE THIS ######
NSPANEL_HA_BLUEPRINT_ADDON_UPLOAD_TFT: "true"
##############################

# yamllint disable rule:comments-indentation
api:
Expand Down
7 changes: 3 additions & 4 deletions esphome/nspanel_esphome_advanced.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@ substitutions:
web_password: ${wifi_password}
##############################

esphome:
platformio_options:
build_flags:
- -D NSPANEL_HA_BLUEPRINT_ADVANCED
##### DON'T CHANGE THIS ######
NSPANEL_HA_BLUEPRINT_ADVANCED: "true"
##############################

button:
- name: Exit reparse
Expand Down
82 changes: 38 additions & 44 deletions esphome/nspanel_esphome_core.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,21 @@ substitutions:
temp_units: "°C"
invalid_cooldown: "100ms"
bytes_per_char: "1"
##############################

##### DON'T CHANGE THIS ######
version: "4.3.9.dev1"
NSPANEL_HA_BLUEPRINT_CORE: "true"
NSPANEL_HA_BLUEPRINT_ADVANCED: "false"
NSPANEL_HA_BLUEPRINT_ADDON_BLE_TRACKER: "false"
NSPANEL_HA_BLUEPRINT_ADDON_BLUETOOTH_PROXY: "false"
NSPANEL_HA_BLUEPRINT_ADDON_UPLOAD_TFT: "false"
NSPANEL_HA_BLUEPRINT_ADDON_CLIMATE_BASE: "false"
NSPANEL_HA_BLUEPRINT_ADDON_CLIMATE_COOL: "false"
NSPANEL_HA_BLUEPRINT_ADDON_CLIMATE_DUAL: "false"
NSPANEL_HA_BLUEPRINT_ADDON_CLIMATE_HEAT: "false"
NSPANEL_HA_BLUEPRINT_PREBUILT: "false"
NSPANEL_HA_BLUEPRINT_PREBUILT_WALL_DISPLAY: "false"
##############################

##### External components #####
Expand Down Expand Up @@ -1774,22 +1787,23 @@ text_sensor:
return {"${name}"};
filters:
- lambda: |-
#ifdef NSPANEL_HA_BLUEPRINT_PREBUILT
std::string suffix = "00ERROR"; // Default suffix in case of an error
uint8_t mac[6] = {0,0,0,0,0,0};
if (esp_read_mac(mac, ESP_MAC_WIFI_STA) == ESP_OK) {
suffix.clear(); // Clear the default error suffix
for (int i = 3; i < 6; ++i) { // Use last 3 bytes of MAC
char hex[3];
snprintf(hex, sizeof(hex), "%02X", mac[i]);
suffix += hex;
std::string raw_name;
if (${NSPANEL_HA_BLUEPRINT_PREBUILT}) {
std::string suffix = "00ERROR"; // Default suffix in case of an error
uint8_t mac[6] = {0,0,0,0,0,0};
if (esp_read_mac(mac, ESP_MAC_WIFI_STA) == ESP_OK) {
suffix.clear(); // Clear the default error suffix
for (int i = 3; i < 6; ++i) { // Use last 3 bytes of MAC
char hex[3];
snprintf(hex, sizeof(hex), "%02X", mac[i]);
suffix += hex;
}
}
// Proceed with suffix (either MAC-based or default error indicator)
raw_name = (x + "-" + suffix);
} else {
raw_name = x;
}
// Proceed with suffix (either MAC-based or default error indicator)
const std::string raw_name = (x + "-" + suffix);
#else
const std::string raw_name = x;
#endif
std::string result;
bool last_was_underscore = false;
Expand Down Expand Up @@ -2264,36 +2278,16 @@ script:
else
ESP_LOGCONFIG(TAG, " TFT: %s", version_tft->state.c_str());
ESP_LOGCONFIG(TAG, "Packages:");
#ifdef NSPANEL_HA_BLUEPRINT_CORE
ESP_LOGCONFIG(TAG, " - Core");
#endif
#ifdef NSPANEL_HA_BLUEPRINT_ADVANCED
ESP_LOGCONFIG(TAG, " - Advanced");
#endif
#ifdef NSPANEL_HA_BLUEPRINT_ADDON_BLUETOOTH_PROXY
ESP_LOGCONFIG(TAG, " - Bluetooth Proxy");
#endif
#ifdef NSPANEL_HA_BLUEPRINT_ADDON_UPLOAD_TFT
ESP_LOGCONFIG(TAG, " - Upload TFT");
#endif
#ifdef NSPANEL_HA_BLUEPRINT_ADDON_CLIMATE_BASE
ESP_LOGCONFIG(TAG, " - Climate - Base");
#endif
#ifdef NSPANEL_HA_BLUEPRINT_ADDON_CLIMATE_COOL
ESP_LOGCONFIG(TAG, " - Climate - Cool");
#endif
#ifdef NSPANEL_HA_BLUEPRINT_ADDON_CLIMATE_DUAL
ESP_LOGCONFIG(TAG, " - Climate - Dual");
#endif
#ifdef NSPANEL_HA_BLUEPRINT_ADDON_CLIMATE_HEAT
ESP_LOGCONFIG(TAG, " - Climate - Heat");
#endif
#ifdef NSPANEL_HA_BLUEPRINT_PREBUILT
ESP_LOGCONFIG(TAG, " - Pre-built");
#endif
#ifdef NSPANEL_HA_BLUEPRINT_PREBUILT_WALL_DISPLAY
ESP_LOGCONFIG(TAG, " - Pre-built (Wall Display)");
#endif
if (${NSPANEL_HA_BLUEPRINT_CORE}) ESP_LOGCONFIG(TAG, " - Core");
if (${NSPANEL_HA_BLUEPRINT_ADVANCED}) ESP_LOGCONFIG(TAG, " - Advanced");
if (${NSPANEL_HA_BLUEPRINT_ADDON_BLUETOOTH_PROXY}) ESP_LOGCONFIG(TAG, " - Bluetooth Proxy");
if (${NSPANEL_HA_BLUEPRINT_ADDON_UPLOAD_TFT}) ESP_LOGCONFIG(TAG, " - Upload TFT");
if (${NSPANEL_HA_BLUEPRINT_ADDON_CLIMATE_BASE}) ESP_LOGCONFIG(TAG, " - Climate - Base");
if (${NSPANEL_HA_BLUEPRINT_ADDON_CLIMATE_COOL}) ESP_LOGCONFIG(TAG, " - Climate - Cool");
if (${NSPANEL_HA_BLUEPRINT_ADDON_CLIMATE_DUAL}) ESP_LOGCONFIG(TAG, " - Climate - Dual");
if (${NSPANEL_HA_BLUEPRINT_ADDON_CLIMATE_HEAT}) ESP_LOGCONFIG(TAG, " - Climate - Heat");
if (${NSPANEL_HA_BLUEPRINT_PREBUILT}) ESP_LOGCONFIG(TAG, " - Pre-built");
if (${NSPANEL_HA_BLUEPRINT_PREBUILT_WALL_DISPLAY}) ESP_LOGCONFIG(TAG, " - Pre-built (Wall Display)");
#if defined(USE_BLUETOOTH_PROXY) || defined(USE_WEBSERVER) || defined(USE_CAPTIVE_PORTAL)
ESP_LOGCONFIG(TAG, "Components:");
#ifdef USE_ESP32_BLE_SERVER
Expand Down
7 changes: 4 additions & 3 deletions prebuilt/nspanel_esphome_prebuilt.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ substitutions:
wifi_ssid: nspanel
wifi_password: NSPanel_Blueprint

##### DON'T CHANGE THIS ######
NSPANEL_HA_BLUEPRINT_PREBUILT: "true"
##############################

##### External components #####
external_components:
- source: github://oarcher/esphome@ota_http_legacy # Remove this and update min ver when PR#5586 is released
Expand Down Expand Up @@ -74,9 +78,6 @@ esp32_ble_server:

esphome:
name_add_mac_suffix: true
platformio_options:
build_flags:
- -D NSPANEL_HA_BLUEPRINT_PREBUILT

improv_serial:
id: serial_improv
Expand Down
7 changes: 4 additions & 3 deletions prebuilt/wall_display.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ substitutions:
temp_max: "26" # Max supported temperature is 80°F
temp_step: "0.5" # Temperature granularity is 1°F

##### DON'T CHANGE THIS ######
NSPANEL_HA_BLUEPRINT_PREBUILT_WALL_DISPLAY: "true"
##############################

packages:
prebuilt_package: !include nspanel_esphome_prebuilt.yaml
climate_heat: !include ../esphome/nspanel_esphome_addon_climate_heat.yaml
Expand All @@ -26,9 +30,6 @@ dashboard_import:
esphome:
project:
name: esphome.Wall_Display
platformio_options:
build_flags:
- -D NSPANEL_HA_BLUEPRINT_PREBUILT_WALL_DISPLAY

text:
- id: !extend fw_url
Expand Down

0 comments on commit 2ef4756

Please sign in to comment.