New event handler

This rebuild the engine to send events to Home Assistant
This commit is contained in:
Edward Firmo
2024-12-23 03:55:50 +01:00
parent bd4f6836c9
commit 4ea7f1ee57
7 changed files with 595 additions and 193 deletions

View File

@@ -27,7 +27,6 @@ substitutions:
packages:
# yamllint disable rule:colons
core_api: !include TX-Ultimate-Easy-ESPHome_core_api.yaml
core_hw_buttons: !include TX-Ultimate-Easy-ESPHome_core_hw_buttons.yaml
core_hw_leds: !include TX-Ultimate-Easy-ESPHome_core_hw_leds.yaml
core_hw_relays: !include TX-Ultimate-Easy-ESPHome_core_hw_relays.yaml
@@ -36,6 +35,12 @@ packages:
core_hw_vibration: !include TX-Ultimate-Easy-ESPHome_core_hw_vibration.yaml
# yamllint enable rule:colons
api:
id: api_server
on_client_connected:
then:
- script.execute: publish_device_info
button:
- id: bt_restart
name: Restart
@@ -82,13 +87,25 @@ ota:
psram:
script:
- id: api_send_ha_event_boot
mode: queued
parameters:
type: string
then:
- homeassistant.event:
event: esphome.tx_ultimate_easy
data:
device_name: !lambda return tx_device_name->state.c_str();
firmware: ${version}
domain: boot
type: !lambda return type.c_str();
- id: boot_done
mode: restart
then:
- script.execute:
id: send_event_to_ha
component: boot
event: done
id: api_send_ha_event_boot
type: done
- id: boot_initialize
mode: restart
@@ -98,9 +115,8 @@ script:
# - HW Relays
# - HW Touch
- script.execute:
id: send_event_to_ha
component: boot
event: start
id: api_send_ha_event_boot
type: start
- id: boot_sequence
mode: restart