Add device_name to events

This commit is contained in:
Edward Firmo
2024-03-14 22:41:41 +01:00
parent 79363673d3
commit c0a0d2b96b

View File

@@ -1691,6 +1691,7 @@ text_sensor:
esphome::api::CustomAPIDevice ha_event;
ha_event.fire_homeassistant_event("esphome.nspanel_ha_blueprint",
{
{"device_name", device_name->state.c_str()},
{"type", "generic"},
{"page", page},
{"component", component},
@@ -1738,6 +1739,7 @@ text_sensor:
} else if (page == "light" or page == "climate") { // Generic event
esphome::api::CustomAPIDevice ha_event;
ha_event.fire_homeassistant_event("esphome.nspanel_ha_blueprint", {
{"device_name", device_name->state.c_str()},
{"type", "generic"},
{"page", page},
{"event", event},
@@ -1850,6 +1852,7 @@ script:
esphome::api::CustomAPIDevice ha_event;
ha_event.fire_homeassistant_event("esphome.nspanel_ha_blueprint",
{
{"device_name", device_name->state.c_str()},
{"type", "version"},
{"tft", version_tft->state.c_str()},
{"esphome", "${version}"},
@@ -2010,6 +2013,7 @@ script:
esphome::api::CustomAPIDevice ha_event;
ha_event.fire_homeassistant_event("esphome.nspanel_ha_blueprint",
{
{"device_name", device_name->state.c_str()},
{"type", "button_click"},
{"page", page},
{"component", component},
@@ -2030,6 +2034,7 @@ script:
esphome::api::CustomAPIDevice ha_event;
ha_event.fire_homeassistant_event("esphome.nspanel_ha_blueprint",
{
{"device_name", device_name->state.c_str()},
{"type", "service_call"},
{"service", service},
{"key", key},
@@ -2157,6 +2162,7 @@ script:
esphome::api::CustomAPIDevice ha_event;
ha_event.fire_homeassistant_event("esphome.nspanel_ha_blueprint",
{
{"device_name", device_name->state.c_str()},
{"type", "page_changed"},
{"page", page.c_str()},
{"entity", detailed_entity->state.c_str()}
@@ -2678,6 +2684,7 @@ script:
esphome::api::CustomAPIDevice ha_event;
ha_event.fire_homeassistant_event("esphome.nspanel_ha_blueprint",
{
{"device_name", device_name->state.c_str()},
{"type", "boot"},
{"step", "start"}
});
@@ -2697,6 +2704,7 @@ script:
esphome::api::CustomAPIDevice ha_event;
ha_event.fire_homeassistant_event("esphome.nspanel_ha_blueprint",
{
{"device_name", device_name->state.c_str()},
{"type", "boot"},
{"step", "nextion_init"}
});