Device name from App

This commit is contained in:
Edward Firmo
2024-12-20 21:23:28 +01:00
parent 55cde35d31
commit 8f4a2a9402
2 changed files with 17 additions and 12 deletions

View File

@@ -89,11 +89,18 @@ script:
- id: boot_done - id: boot_done
mode: restart mode: restart
then: then:
- lambda: send_event_to_ha->execute("boot", "done"); - script.execute:
id: send_event_to_ha
component: boot
event: done
- id: boot_initialize - id: boot_initialize
mode: restart mode: restart
then: # There's nothing here so far then:
- script.execute:
id: send_event_to_ha
component: boot
event: start
# Extended by: # Extended by:
# - HW Buttons # - HW Buttons
# - HW Relays # - HW Relays
@@ -109,7 +116,7 @@ script:
then: then:
- lambda: |- - lambda: |-
tx_fw_version->publish_state("${version}"); tx_fw_version->publish_state("${version}");
tx_device_name->publish_state("${name}"); tx_device_name->publish_state(App.get_name().c_str());
select: select:
- id: sl_tx_model_format - id: sl_tx_model_format

View File

@@ -31,13 +31,11 @@ script:
component: string component: string
event: string event: string
then: then:
- lambda: |- - homeassistant.event:
esphome::api::CustomAPIDevice ha_event; event: esphome.tx_ultimate_easy
ha_event.fire_homeassistant_event("esphome.tx_ultimate_easy", data:
{ device_name: !lambda return tx_device_name->state.c_str();
{"device_name", tx_device_name->state.c_str()}, firmware: ${version}
{"firmware", "${version}"}, component: !lambda return component.c_str();
{"component", component}, event: !lambda return event.c_str();
{"event", event},
});
... ...