Report ESPHome version on event call
This will allow version based blueprint
This commit is contained in:
@@ -62,6 +62,7 @@ esphome:
|
|||||||
- lambda: |-
|
- lambda: |-
|
||||||
set_timezone->execute(id(mui_timezone).c_str());
|
set_timezone->execute(id(mui_timezone).c_str());
|
||||||
if (isnan(blueprint_status->raw_state)) blueprint_status->publish_state(0);
|
if (isnan(blueprint_status->raw_state)) blueprint_status->publish_state(0);
|
||||||
|
version_esphome->publish_state("${version}");
|
||||||
device_name->publish_state("${name}");
|
device_name->publish_state("${name}");
|
||||||
notification_label->publish_state("");
|
notification_label->publish_state("");
|
||||||
notification_text->publish_state("");
|
notification_text->publish_state("");
|
||||||
@@ -342,7 +343,6 @@ api:
|
|||||||
screensaver_time_font: int # Specifies the font id for the screensaver time display.
|
screensaver_time_font: int # Specifies the font id for the screensaver time display.
|
||||||
screensaver_time_color: int[] # RGB color for the screensaver time display, e.g., [165, 42, 42] for reddish-brown.
|
screensaver_time_color: int[] # RGB color for the screensaver time display, e.g., [165, 42, 42] for reddish-brown.
|
||||||
decimal_separator: string # The char to be used as decimal separator.
|
decimal_separator: string # The char to be used as decimal separator.
|
||||||
# bytes_per_char: init
|
|
||||||
then:
|
then:
|
||||||
- if:
|
- if:
|
||||||
condition:
|
condition:
|
||||||
@@ -358,7 +358,6 @@ api:
|
|||||||
screensaver_time_font: !lambda return screensaver_time_font;
|
screensaver_time_font: !lambda return screensaver_time_font;
|
||||||
screensaver_time_color: !lambda return screensaver_time_color;
|
screensaver_time_color: !lambda return screensaver_time_color;
|
||||||
decimal_separator: !lambda return decimal_separator;
|
decimal_separator: !lambda return decimal_separator;
|
||||||
# bytes_per_char: !lambda return bytes_per_char;
|
|
||||||
- script.wait: global_settings
|
- script.wait: global_settings
|
||||||
- lambda: blueprint_status->publish_state(int(blueprint_status->raw_state) | (1 << 5));
|
- lambda: blueprint_status->publish_state(int(blueprint_status->raw_state) | (1 << 5));
|
||||||
|
|
||||||
@@ -807,6 +806,14 @@ api:
|
|||||||
- lambda: |-
|
- lambda: |-
|
||||||
if (component == "is_climate") id(is_climate) = val;
|
if (component == "is_climate") id(is_climate) = val;
|
||||||
|
|
||||||
|
- service: set_int
|
||||||
|
variables:
|
||||||
|
component: string
|
||||||
|
val: int
|
||||||
|
then:
|
||||||
|
- lambda: |-
|
||||||
|
if (component == "bytes_per_char") id(mui_bytes_per_char) = val;
|
||||||
|
|
||||||
- service: set_string
|
- service: set_string
|
||||||
variables:
|
variables:
|
||||||
component: string
|
component: string
|
||||||
@@ -1659,6 +1666,7 @@ switch:
|
|||||||
esphome::api::CustomAPIDevice ha_event;
|
esphome::api::CustomAPIDevice ha_event;
|
||||||
ha_event.fire_homeassistant_event("esphome.nspanel_ha_blueprint", {
|
ha_event.fire_homeassistant_event("esphome.nspanel_ha_blueprint", {
|
||||||
{"device_name", device_name->state.c_str()},
|
{"device_name", device_name->state.c_str()},
|
||||||
|
{"esphome_version", "${version}"},
|
||||||
{"type", "notification_changed"},
|
{"type", "notification_changed"},
|
||||||
{"component", "notification_unread"},
|
{"component", "notification_unread"},
|
||||||
{"action", "turn_on"}
|
{"action", "turn_on"}
|
||||||
@@ -1668,6 +1676,7 @@ switch:
|
|||||||
esphome::api::CustomAPIDevice ha_event;
|
esphome::api::CustomAPIDevice ha_event;
|
||||||
ha_event.fire_homeassistant_event("esphome.nspanel_ha_blueprint", {
|
ha_event.fire_homeassistant_event("esphome.nspanel_ha_blueprint", {
|
||||||
{"device_name", device_name->state.c_str()},
|
{"device_name", device_name->state.c_str()},
|
||||||
|
{"esphome_version", "${version}"},
|
||||||
{"type", "notification_changed"},
|
{"type", "notification_changed"},
|
||||||
{"component", "notification_unread"},
|
{"component", "notification_unread"},
|
||||||
{"action", "turn_off"}
|
{"action", "turn_off"}
|
||||||
@@ -1818,6 +1827,7 @@ text_sensor:
|
|||||||
esphome::api::CustomAPIDevice ha_event;
|
esphome::api::CustomAPIDevice ha_event;
|
||||||
ha_event.fire_homeassistant_event("esphome.nspanel_ha_blueprint", {
|
ha_event.fire_homeassistant_event("esphome.nspanel_ha_blueprint", {
|
||||||
{"device_name", device_name->state.c_str()},
|
{"device_name", device_name->state.c_str()},
|
||||||
|
{"esphome_version", "${version}"},
|
||||||
{"type", "notification_changed"},
|
{"type", "notification_changed"},
|
||||||
{"component", "notification_label"},
|
{"component", "notification_label"},
|
||||||
{"action", "new_value"}
|
{"action", "new_value"}
|
||||||
@@ -1831,6 +1841,7 @@ text_sensor:
|
|||||||
esphome::api::CustomAPIDevice ha_event;
|
esphome::api::CustomAPIDevice ha_event;
|
||||||
ha_event.fire_homeassistant_event("esphome.nspanel_ha_blueprint", {
|
ha_event.fire_homeassistant_event("esphome.nspanel_ha_blueprint", {
|
||||||
{"device_name", device_name->state.c_str()},
|
{"device_name", device_name->state.c_str()},
|
||||||
|
{"esphome_version", "${version}"},
|
||||||
{"type", "notification_changed"},
|
{"type", "notification_changed"},
|
||||||
{"component", "notification_text"},
|
{"component", "notification_text"},
|
||||||
{"action", "new_value"}
|
{"action", "new_value"}
|
||||||
@@ -1865,6 +1876,7 @@ text_sensor:
|
|||||||
} else if (page == "light" or page == "climate") { // Generic event
|
} else if (page == "light" or page == "climate") { // Generic event
|
||||||
ha_event.fire_homeassistant_event("esphome.nspanel_ha_blueprint", {
|
ha_event.fire_homeassistant_event("esphome.nspanel_ha_blueprint", {
|
||||||
{"device_name", device_name->state.c_str()},
|
{"device_name", device_name->state.c_str()},
|
||||||
|
{"esphome_version", "${version}"},
|
||||||
{"type", "generic"},
|
{"type", "generic"},
|
||||||
{"page", page.c_str()},
|
{"page", page.c_str()},
|
||||||
{"component", component.c_str()},
|
{"component", component.c_str()},
|
||||||
@@ -1914,6 +1926,7 @@ text_sensor:
|
|||||||
ha_event.fire_homeassistant_event("esphome.nspanel_ha_blueprint",
|
ha_event.fire_homeassistant_event("esphome.nspanel_ha_blueprint",
|
||||||
{
|
{
|
||||||
{"device_name", device_name->state.c_str()},
|
{"device_name", device_name->state.c_str()},
|
||||||
|
{"esphome_version", "${version}"},
|
||||||
{"type", "service_call"},
|
{"type", "service_call"},
|
||||||
{"service", "light.turn_on"},
|
{"service", "light.turn_on"},
|
||||||
{"key", "rgb_color"},
|
{"key", "rgb_color"},
|
||||||
@@ -1948,6 +1961,16 @@ text_sensor:
|
|||||||
- lambda: |-
|
- lambda: |-
|
||||||
check_versions->execute();
|
check_versions->execute();
|
||||||
|
|
||||||
|
- id: version_esphome
|
||||||
|
name: Version ESPHome
|
||||||
|
platform: template
|
||||||
|
entity_category: diagnostic
|
||||||
|
icon: mdi:tag-text-outline
|
||||||
|
internal: false
|
||||||
|
update_interval: never
|
||||||
|
lambda: |-
|
||||||
|
return {"${version}"};
|
||||||
|
|
||||||
- id: version_tft
|
- id: version_tft
|
||||||
name: Version TFT
|
name: Version TFT
|
||||||
platform: nextion
|
platform: nextion
|
||||||
@@ -1973,6 +1996,7 @@ script:
|
|||||||
ha_event.fire_homeassistant_event("esphome.nspanel_ha_blueprint",
|
ha_event.fire_homeassistant_event("esphome.nspanel_ha_blueprint",
|
||||||
{
|
{
|
||||||
{"device_name", device_name->state.c_str()},
|
{"device_name", device_name->state.c_str()},
|
||||||
|
{"esphome_version", "${version}"},
|
||||||
{"type", "boot"},
|
{"type", "boot"},
|
||||||
{"step", "start"}
|
{"step", "start"}
|
||||||
});
|
});
|
||||||
@@ -1988,6 +2012,7 @@ script:
|
|||||||
ha_event.fire_homeassistant_event("esphome.nspanel_ha_blueprint",
|
ha_event.fire_homeassistant_event("esphome.nspanel_ha_blueprint",
|
||||||
{
|
{
|
||||||
{"device_name", device_name->state.c_str()},
|
{"device_name", device_name->state.c_str()},
|
||||||
|
{"esphome_version", "${version}"},
|
||||||
{"type", "boot"},
|
{"type", "boot"},
|
||||||
{"step", "timeout"}
|
{"step", "timeout"}
|
||||||
});
|
});
|
||||||
@@ -2051,6 +2076,7 @@ script:
|
|||||||
ha_event.fire_homeassistant_event("esphome.nspanel_ha_blueprint",
|
ha_event.fire_homeassistant_event("esphome.nspanel_ha_blueprint",
|
||||||
{
|
{
|
||||||
{"device_name", device_name->state.c_str()},
|
{"device_name", device_name->state.c_str()},
|
||||||
|
{"esphome_version", "${version}"},
|
||||||
{"type", "version"},
|
{"type", "version"},
|
||||||
{"tft", version_tft->state.c_str()},
|
{"tft", version_tft->state.c_str()},
|
||||||
{"esphome", "${version}"},
|
{"esphome", "${version}"},
|
||||||
@@ -2121,7 +2147,6 @@ script:
|
|||||||
screensaver_time_font: int
|
screensaver_time_font: int
|
||||||
screensaver_time_color: int32_t[]
|
screensaver_time_color: int32_t[]
|
||||||
decimal_separator: string
|
decimal_separator: string
|
||||||
# bytes_per_char: int
|
|
||||||
then:
|
then:
|
||||||
- lambda: |-
|
- lambda: |-
|
||||||
if (!id(is_uploading_tft)) {
|
if (!id(is_uploading_tft)) {
|
||||||
@@ -2133,7 +2158,6 @@ script:
|
|||||||
// MUI strings
|
// MUI strings
|
||||||
id(mui_please_confirm_global) = mui_please_confirm;
|
id(mui_please_confirm_global) = mui_please_confirm;
|
||||||
id(mui_unavailable_global) = mui_unavailable;
|
id(mui_unavailable_global) = mui_unavailable;
|
||||||
// id(mui_bytes_per_char) = bytes_per_char;
|
|
||||||
|
|
||||||
// Screen saver page (sleep)
|
// Screen saver page (sleep)
|
||||||
id(screensaver_display_time) = screensaver_time;
|
id(screensaver_display_time) = screensaver_time;
|
||||||
@@ -2177,6 +2201,7 @@ script:
|
|||||||
ha_event.fire_homeassistant_event("esphome.nspanel_ha_blueprint",
|
ha_event.fire_homeassistant_event("esphome.nspanel_ha_blueprint",
|
||||||
{
|
{
|
||||||
{"device_name", device_name->state.c_str()},
|
{"device_name", device_name->state.c_str()},
|
||||||
|
{"esphome_version", "${version}"},
|
||||||
{"type", "button_click"},
|
{"type", "button_click"},
|
||||||
{"page", page},
|
{"page", page},
|
||||||
{"component", component},
|
{"component", component},
|
||||||
@@ -2197,6 +2222,7 @@ script:
|
|||||||
ha_event.fire_homeassistant_event("esphome.nspanel_ha_blueprint",
|
ha_event.fire_homeassistant_event("esphome.nspanel_ha_blueprint",
|
||||||
{
|
{
|
||||||
{"device_name", device_name->state.c_str()},
|
{"device_name", device_name->state.c_str()},
|
||||||
|
{"esphome_version", "${version}"},
|
||||||
{"type", "service_call"},
|
{"type", "service_call"},
|
||||||
{"service", service},
|
{"service", service},
|
||||||
{"key", key},
|
{"key", key},
|
||||||
@@ -2305,6 +2331,7 @@ script:
|
|||||||
ha_event.fire_homeassistant_event("esphome.nspanel_ha_blueprint",
|
ha_event.fire_homeassistant_event("esphome.nspanel_ha_blueprint",
|
||||||
{
|
{
|
||||||
{"device_name", device_name->state.c_str()},
|
{"device_name", device_name->state.c_str()},
|
||||||
|
{"esphome_version", "${version}"},
|
||||||
{"type", "boot"},
|
{"type", "boot"},
|
||||||
{"step", "nextion_init"}
|
{"step", "nextion_init"}
|
||||||
});
|
});
|
||||||
@@ -2412,6 +2439,7 @@ script:
|
|||||||
ha_event.fire_homeassistant_event("esphome.nspanel_ha_blueprint",
|
ha_event.fire_homeassistant_event("esphome.nspanel_ha_blueprint",
|
||||||
{
|
{
|
||||||
{"device_name", device_name->state.c_str()},
|
{"device_name", device_name->state.c_str()},
|
||||||
|
{"esphome_version", "${version}"},
|
||||||
{"type", "page_changed"},
|
{"type", "page_changed"},
|
||||||
{"page", current_page->state.c_str()},
|
{"page", current_page->state.c_str()},
|
||||||
{"entity", detailed_entity->state.c_str()}
|
{"entity", detailed_entity->state.c_str()}
|
||||||
|
|||||||
Reference in New Issue
Block a user