Expose sensors to HA
This commit is contained in:
@@ -21,22 +21,12 @@ button:
|
|||||||
icon: mdi:file-sync
|
icon: mdi:file-sync
|
||||||
id: tft_reparse_off
|
id: tft_reparse_off
|
||||||
entity_category: config
|
entity_category: config
|
||||||
|
internal: False
|
||||||
|
disabled_by_default: true
|
||||||
on_press:
|
on_press:
|
||||||
- logger.log: "Button pressed: Exit reparse"
|
- logger.log: "Button pressed: Exit reparse"
|
||||||
- script.execute: exit_reparse
|
- script.execute: exit_reparse
|
||||||
|
|
||||||
##### UPDATE TFT BLANK DISPLAY #####
|
|
||||||
- name: ${name} Update TFT display (blank)
|
|
||||||
platform: template
|
|
||||||
icon: mdi:file-sync
|
|
||||||
id: tft_update_blank
|
|
||||||
entity_category: config
|
|
||||||
on_press:
|
|
||||||
- lambda: |-
|
|
||||||
static const char *const TAG = "button.tft_update_blank";
|
|
||||||
ESP_LOGD(TAG, "Button pressed: Update TFT display (blank)");
|
|
||||||
upload_tft->execute("${nextion_blank_url}");
|
|
||||||
|
|
||||||
captive_portal:
|
captive_portal:
|
||||||
|
|
||||||
sensor:
|
sensor:
|
||||||
@@ -70,7 +60,9 @@ text_sensor:
|
|||||||
##### ESPhome version used to compile the app #####
|
##### ESPhome version used to compile the app #####
|
||||||
- name: ${name} ESPhome Version
|
- name: ${name} ESPhome Version
|
||||||
platform: version
|
platform: version
|
||||||
disabled_by_default: true
|
disabled_by_default: false
|
||||||
|
internal: false
|
||||||
|
icon: mdi:tag-text-outline
|
||||||
|
|
||||||
- platform: wifi_info
|
- platform: wifi_info
|
||||||
ip_address:
|
ip_address:
|
||||||
|
|||||||
@@ -109,8 +109,7 @@ time:
|
|||||||
- seconds: 0
|
- seconds: 0
|
||||||
then:
|
then:
|
||||||
- script.execute: refresh_datetime
|
- script.execute: refresh_datetime
|
||||||
- minutes: /5
|
- seconds: 30
|
||||||
seconds: 30
|
|
||||||
then:
|
then:
|
||||||
- script.execute: watchdog
|
- script.execute: watchdog
|
||||||
|
|
||||||
@@ -1682,9 +1681,9 @@ text_sensor:
|
|||||||
entity_category: diagnostic
|
entity_category: diagnostic
|
||||||
icon: mdi:tag-text-outline
|
icon: mdi:tag-text-outline
|
||||||
internal: false
|
internal: false
|
||||||
|
update_interval: never
|
||||||
lambda: |-
|
lambda: |-
|
||||||
return {"unknown"};
|
return {"unknown"};
|
||||||
update_interval: never
|
|
||||||
on_value:
|
on_value:
|
||||||
- lambda: |-
|
- lambda: |-
|
||||||
static const char *const TAG = "text_sensor.version_blueprint";
|
static const char *const TAG = "text_sensor.version_blueprint";
|
||||||
@@ -1703,6 +1702,7 @@ text_sensor:
|
|||||||
entity_category: diagnostic
|
entity_category: diagnostic
|
||||||
icon: mdi:tag-text-outline
|
icon: mdi:tag-text-outline
|
||||||
internal: false
|
internal: false
|
||||||
|
update_interval: never
|
||||||
lambda: |-
|
lambda: |-
|
||||||
return {"${version}"};
|
return {"${version}"};
|
||||||
on_value:
|
on_value:
|
||||||
@@ -1724,6 +1724,7 @@ text_sensor:
|
|||||||
entity_category: diagnostic
|
entity_category: diagnostic
|
||||||
icon: mdi:tag-text-outline
|
icon: mdi:tag-text-outline
|
||||||
internal: false
|
internal: false
|
||||||
|
update_interval: never
|
||||||
on_value:
|
on_value:
|
||||||
- lambda: |-
|
- lambda: |-
|
||||||
static const char *const TAG = "text_sensor.version_tft";
|
static const char *const TAG = "text_sensor.version_tft";
|
||||||
@@ -1788,24 +1789,13 @@ script:
|
|||||||
ESP_LOGD(TAG, "Blueprint version: %s", version_blueprint->state.c_str());
|
ESP_LOGD(TAG, "Blueprint version: %s", version_blueprint->state.c_str());
|
||||||
if (not compareVersions("${version}", version_blueprint->state.c_str())) ESP_LOGE(TAG, "Blueprint version mismatch!");
|
if (not compareVersions("${version}", version_blueprint->state.c_str())) ESP_LOGE(TAG, "Blueprint version mismatch!");
|
||||||
|
|
||||||
std::string framework = "unknown";
|
|
||||||
#ifdef ARDUINO
|
|
||||||
framework = "arduino";
|
|
||||||
#elif defined(USE_ESP_IDF)
|
|
||||||
framework = "esp-idf";
|
|
||||||
#endif
|
|
||||||
ESP_LOGD(TAG, "Framework: %s", framework.c_str());
|
|
||||||
ESP_LOGD(TAG, "Baud rate: %" PRIu32, id(tf_uart).get_baud_rate());
|
|
||||||
|
|
||||||
auto ha_event = new esphome::api::CustomAPIDevice();
|
auto ha_event = new esphome::api::CustomAPIDevice();
|
||||||
ha_event->fire_homeassistant_event("esphome.nspanel_ha_blueprint",
|
ha_event->fire_homeassistant_event("esphome.nspanel_ha_blueprint",
|
||||||
{
|
{
|
||||||
{"type", "version"},
|
{"type", "version"},
|
||||||
{"tft", version_tft->state.c_str()},
|
{"tft", version_tft->state.c_str()},
|
||||||
{"esphome", "${version}"},
|
{"esphome", "${version}"},
|
||||||
{"blueprint", version_blueprint->state.c_str()},
|
{"blueprint", version_blueprint->state.c_str()}
|
||||||
{"framework", framework.c_str()},
|
|
||||||
{"baud_rate", to_string(id(tf_uart).get_baud_rate())}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
- id: display_embedded_temp
|
- id: display_embedded_temp
|
||||||
@@ -3208,8 +3198,14 @@ script:
|
|||||||
ESP_LOGI(TAG, " Version: ${version}");
|
ESP_LOGI(TAG, " Version: ${version}");
|
||||||
// Report framework
|
// Report framework
|
||||||
#ifdef ARDUINO
|
#ifdef ARDUINO
|
||||||
|
size_t total_heap_size = ESP.getHeapSize();
|
||||||
|
size_t free_heap_size = ESP.getFreeHeap();
|
||||||
|
ESP_LOGI(TAG, " Heap: %zu bytes (%d%%)", free_heap_size, int(round(((float)free_heap_size / total_heap_size) * 100.0f)));
|
||||||
ESP_LOGI(TAG, " Framework: arduino");
|
ESP_LOGI(TAG, " Framework: arduino");
|
||||||
#elif defined(USE_ESP_IDF)
|
#elif defined(USE_ESP_IDF)
|
||||||
|
size_t total_heap_size = heap_caps_get_total_size(MALLOC_CAP_DEFAULT);
|
||||||
|
size_t free_heap_size = esp_get_free_heap_size();
|
||||||
|
ESP_LOGI(TAG, " Heap: %zu bytes (%d%%)", free_heap_size, int(round(((float)free_heap_size / total_heap_size) * 100.0f)));
|
||||||
ESP_LOGI(TAG, " Framework: esp-idf");
|
ESP_LOGI(TAG, " Framework: esp-idf");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
---
|
---
|
||||||
packages:
|
packages:
|
||||||
core_package: !include advanced/esphome/nspanel_esphome_core.yaml
|
core_package: !include advanced/esphome/nspanel_esphome_core.yaml
|
||||||
|
#advanced_package: !include advanced/esphome/nspanel_esphome_advanced.yaml
|
||||||
upload_tft_package: !include advanced/esphome/nspanel_esphome_addon_upload_tft.yaml
|
upload_tft_package: !include advanced/esphome/nspanel_esphome_addon_upload_tft.yaml
|
||||||
...
|
...
|
||||||
|
|||||||
Reference in New Issue
Block a user