From a65cd9cdfb50897bd458b45c1e735850aeec0c09 Mon Sep 17 00:00:00 2001 From: JJGadgets Date: Sun, 20 Jul 2025 16:29:01 +0800 Subject: [PATCH] feat: add ESPHome --- .../deploy/apps/esphome/app/config/.bluetooth-proxy.yaml | 1 + kube/deploy/apps/esphome/app/config/.common.yaml | 8 ++------ kube/deploy/apps/esphome/app/config/.metadata.yaml | 1 + .../apps/esphome/app/config/.mitsubishi-cn105.yaml | 7 ++++--- kube/deploy/apps/esphome/app/config/jj-room-ac.yaml | 9 ++++++++- .../apps/esphome/app/config/master-bedroom-ac.yaml | 9 ++++++++- .../apps/esphome/app/config/metadata/esphome-name.yaml | 8 +------- 7 files changed, 25 insertions(+), 18 deletions(-) diff --git a/kube/deploy/apps/esphome/app/config/.bluetooth-proxy.yaml b/kube/deploy/apps/esphome/app/config/.bluetooth-proxy.yaml index 4fbd0e7e..a2960374 100644 --- a/kube/deploy/apps/esphome/app/config/.bluetooth-proxy.yaml +++ b/kube/deploy/apps/esphome/app/config/.bluetooth-proxy.yaml @@ -1,3 +1,4 @@ +--- # Bluetooth Proxy bluetooth_proxy: active: true diff --git a/kube/deploy/apps/esphome/app/config/.common.yaml b/kube/deploy/apps/esphome/app/config/.common.yaml index 318bc984..07a0b4ba 100644 --- a/kube/deploy/apps/esphome/app/config/.common.yaml +++ b/kube/deploy/apps/esphome/app/config/.common.yaml @@ -1,6 +1,4 @@ -.substitutions: &subs !include { file: "./.metadata.yaml", vars: { area: "$${area}", name: "$${name}" } } substitutions: - <<: *subs system_name: > ${AREA_DNS}-${NAME_DNS} device_description: "$${description}" @@ -11,12 +9,10 @@ substitutions: esphome: name: "$${area_dns}-$${name_dns}" - #!include { file: "./metadata/esphome-name.yaml", vars: { area: "$${area}", name: "$${name}" } } - comment: "$${device_description}" - friendly_name: "$${friendly_name}" + comment: "$${description}" + friendly_name: "$${area} - $${name}" area: id: "$${area_id}" - #!include { file: "./metadata/area-id.yaml", vars: { area: "$${area}" } } name: "$${area}" esp32: diff --git a/kube/deploy/apps/esphome/app/config/.metadata.yaml b/kube/deploy/apps/esphome/app/config/.metadata.yaml index fd13fe17..b4b7aa8c 100644 --- a/kube/deploy/apps/esphome/app/config/.metadata.yaml +++ b/kube/deploy/apps/esphome/app/config/.metadata.yaml @@ -1,3 +1,4 @@ +--- area_dns: > $${area | replace("'s", "") | replace("_", "-") | replace(" - ", "-") | replace(" ", "-") | lower} area_id: > diff --git a/kube/deploy/apps/esphome/app/config/.mitsubishi-cn105.yaml b/kube/deploy/apps/esphome/app/config/.mitsubishi-cn105.yaml index 7f11de28..084b45f8 100644 --- a/kube/deploy/apps/esphome/app/config/.mitsubishi-cn105.yaml +++ b/kube/deploy/apps/esphome/app/config/.mitsubishi-cn105.yaml @@ -1,9 +1,10 @@ --- -.substitutions: &subs !include { file: "./.metadata.yaml", vars: { area: "$${area}", name: &name "AC - CN105" } } substitutions: - <<: *subs area: "$${area}" - name: *name + name: "$${name}" + area_id: "$${area_id}" + area_dns: "$${area_dns}" + name_dns: "$${name_dns}" description: "Mitsubishi CN105 compatible ESP32 serial air conditioner controller for $${area}" packages: common: !include diff --git a/kube/deploy/apps/esphome/app/config/jj-room-ac.yaml b/kube/deploy/apps/esphome/app/config/jj-room-ac.yaml index 989d96af..bf96c350 100644 --- a/kube/deploy/apps/esphome/app/config/jj-room-ac.yaml +++ b/kube/deploy/apps/esphome/app/config/jj-room-ac.yaml @@ -1,6 +1,13 @@ --- +.substitutions: &subs !include + file: "./.metadata.yaml" + vars: + area: &area "JJ's Room" + name: &name "AC - CN105" substitutions: - area: "JJ's Room" + <<: *subs + area: *area + name: *name packages: - !include ./.mitsubishi-cn105.yaml - !include ./.bluetooth-proxy.yaml diff --git a/kube/deploy/apps/esphome/app/config/master-bedroom-ac.yaml b/kube/deploy/apps/esphome/app/config/master-bedroom-ac.yaml index 58142bbd..50a871da 100644 --- a/kube/deploy/apps/esphome/app/config/master-bedroom-ac.yaml +++ b/kube/deploy/apps/esphome/app/config/master-bedroom-ac.yaml @@ -1,6 +1,13 @@ --- +.substitutions: &subs !include + file: "./.metadata.yaml" + vars: + area: &area "Master Bedroom" + name: &name "AC - CN105" substitutions: - area: "Master Bedroom" + <<: *subs + area: *area + name: *name packages: - !include ./.mitsubishi-cn105.yaml - !include ./.bluetooth-proxy.yaml diff --git a/kube/deploy/apps/esphome/app/config/metadata/esphome-name.yaml b/kube/deploy/apps/esphome/app/config/metadata/esphome-name.yaml index 258230a1..6cfc6c87 100644 --- a/kube/deploy/apps/esphome/app/config/metadata/esphome-name.yaml +++ b/kube/deploy/apps/esphome/app/config/metadata/esphome-name.yaml @@ -1,7 +1 @@ -AREA_DNS: > - $${area | replace("'s", "") | replace("_", "-") | replace(" - ", "-") | replace(" ", "-") | lower} -AREA_ID: > - $${area | replace("'", "_") | replace(" - ", "-") | replace(" ", "-") | replace("-", "_") | lower} -NAME_DNS: > - $${name | replace("_", "-") | replace(" - ", "-") | replace(" ", "-") | lower} - +$${name | replace("_", "-") | replace(" - ", "-") | replace(" ", "-") | lower}