Rebuild esphome::api::CustomAPIDevice declarations
To reduce chances of a memory leak
This commit is contained in:
@@ -1702,8 +1702,8 @@ text_sensor:
|
||||
if (not (component == "currentpage" and (page == "screensaver" or page == "home"))) timer_reset_all->execute(page.c_str());
|
||||
std::string value = doc["value"];
|
||||
std::string entity = detailed_entity->state.c_str(); // doc["entity"];
|
||||
auto ha_event = new esphome::api::CustomAPIDevice();
|
||||
ha_event->fire_homeassistant_event("esphome.nspanel_ha_blueprint",
|
||||
esphome::api::CustomAPIDevice ha_event;
|
||||
ha_event.fire_homeassistant_event("esphome.nspanel_ha_blueprint",
|
||||
{
|
||||
{"type", "generic"},
|
||||
{"page", page},
|
||||
@@ -1861,8 +1861,8 @@ script:
|
||||
if (not compare_versions("${version}", id(version_blueprint)))
|
||||
ESP_LOGE("script.check_versions", "Blueprint version mismatch!");
|
||||
|
||||
auto ha_event = new esphome::api::CustomAPIDevice();
|
||||
ha_event->fire_homeassistant_event("esphome.nspanel_ha_blueprint",
|
||||
esphome::api::CustomAPIDevice ha_event;
|
||||
ha_event.fire_homeassistant_event("esphome.nspanel_ha_blueprint",
|
||||
{
|
||||
{"type", "version"},
|
||||
{"tft", version_tft->state.c_str()},
|
||||
@@ -2019,8 +2019,8 @@ script:
|
||||
- lambda: |-
|
||||
if (id(is_uploading_tft)) ha_button->stop();
|
||||
timer_reset_all->execute(page.c_str());
|
||||
auto ha_event = new esphome::api::CustomAPIDevice();
|
||||
ha_event->fire_homeassistant_event("esphome.nspanel_ha_blueprint",
|
||||
esphome::api::CustomAPIDevice ha_event;
|
||||
ha_event.fire_homeassistant_event("esphome.nspanel_ha_blueprint",
|
||||
{
|
||||
{"type", "button_click"},
|
||||
{"page", page},
|
||||
@@ -2039,8 +2039,8 @@ script:
|
||||
- lambda: |-
|
||||
if (!id(is_uploading_tft)) {
|
||||
if (service != "" and not service.empty()) {
|
||||
auto ha_event = new esphome::api::CustomAPIDevice();
|
||||
ha_event->fire_homeassistant_event("esphome.nspanel_ha_blueprint",
|
||||
esphome::api::CustomAPIDevice ha_event;
|
||||
ha_event.fire_homeassistant_event("esphome.nspanel_ha_blueprint",
|
||||
{
|
||||
{"type", "service_call"},
|
||||
{"service", service},
|
||||
@@ -2166,8 +2166,8 @@ script:
|
||||
timer_reset_all->execute(page.c_str());
|
||||
|
||||
// Report new page to Home Assistant
|
||||
auto ha_event = new esphome::api::CustomAPIDevice();
|
||||
ha_event->fire_homeassistant_event("esphome.nspanel_ha_blueprint",
|
||||
esphome::api::CustomAPIDevice ha_event;
|
||||
ha_event.fire_homeassistant_event("esphome.nspanel_ha_blueprint",
|
||||
{
|
||||
{"type", "page_changed"},
|
||||
{"page", page.c_str()},
|
||||
@@ -2693,8 +2693,8 @@ script:
|
||||
- lambda: !lambda return (api_server->is_connected());
|
||||
then: # API connected
|
||||
- lambda: |-
|
||||
auto ha_event = new esphome::api::CustomAPIDevice();
|
||||
ha_event->fire_homeassistant_event("esphome.nspanel_ha_blueprint",
|
||||
esphome::api::CustomAPIDevice ha_event;
|
||||
ha_event.fire_homeassistant_event("esphome.nspanel_ha_blueprint",
|
||||
{
|
||||
{"type", "boot"},
|
||||
{"step", "start"}
|
||||
@@ -2712,8 +2712,8 @@ script:
|
||||
disp1->send_command_printf("brightness_sleep=%i", int(display_sleep_brightness->state));
|
||||
nextion_init->publish_state(disp1->is_setup());
|
||||
if (api_server->is_connected() and disp1->is_setup()) {
|
||||
auto ha_event = new esphome::api::CustomAPIDevice();
|
||||
ha_event->fire_homeassistant_event("esphome.nspanel_ha_blueprint",
|
||||
esphome::api::CustomAPIDevice ha_event;
|
||||
ha_event.fire_homeassistant_event("esphome.nspanel_ha_blueprint",
|
||||
{
|
||||
{"type", "boot"},
|
||||
{"step", "nextion_init"}
|
||||
|
||||
Reference in New Issue
Block a user