From dce4efbfcd39e80670bbacf2fa80516201b2b2cf Mon Sep 17 00:00:00 2001 From: JJGadgets Date: Fri, 18 Jul 2025 10:15:05 +0800 Subject: [PATCH] feat: add ESPHome --- .../deploy/apps/esphome/app/config/jj-room-ac.yaml | 9 +++++++++ .../apps/esphome/app/config/kustomization.yaml | 3 ++- .../apps/esphome/app/config/living-room-ac.yaml | 7 ------- kube/deploy/apps/esphome/app/config/metadata.yaml | 12 ++++++++++++ .../app/config/mitsubishi-cn105-bt-proxy.yaml | 14 ++++++++------ 5 files changed, 31 insertions(+), 14 deletions(-) create mode 100644 kube/deploy/apps/esphome/app/config/jj-room-ac.yaml delete mode 100644 kube/deploy/apps/esphome/app/config/living-room-ac.yaml create mode 100644 kube/deploy/apps/esphome/app/config/metadata.yaml diff --git a/kube/deploy/apps/esphome/app/config/jj-room-ac.yaml b/kube/deploy/apps/esphome/app/config/jj-room-ac.yaml new file mode 100644 index 00000000..b51728b5 --- /dev/null +++ b/kube/deploy/apps/esphome/app/config/jj-room-ac.yaml @@ -0,0 +1,9 @@ +--- +substitutions: + area: "JJ's Room" + name: "AC - CN105" +packages: + cn105: !include + file: ./metadata.yaml + vars: + include: ./mitsubishi-cn105-bt-proxy.yaml diff --git a/kube/deploy/apps/esphome/app/config/kustomization.yaml b/kube/deploy/apps/esphome/app/config/kustomization.yaml index 125021f5..e29daa1d 100644 --- a/kube/deploy/apps/esphome/app/config/kustomization.yaml +++ b/kube/deploy/apps/esphome/app/config/kustomization.yaml @@ -6,7 +6,8 @@ configMapGenerator: files: - ./common.yaml - ./wifi.yaml + - ./metadata.yaml - ./mitsubishi-cn105-bt-proxy.yaml - - ./living-room-ac.yaml + - ./jj-room-ac.yaml generatorOptions: disableNameSuffixHash: true # Reloader diff --git a/kube/deploy/apps/esphome/app/config/living-room-ac.yaml b/kube/deploy/apps/esphome/app/config/living-room-ac.yaml deleted file mode 100644 index dab32e9b..00000000 --- a/kube/deploy/apps/esphome/app/config/living-room-ac.yaml +++ /dev/null @@ -1,7 +0,0 @@ ---- -substitutions: - area_id: master_bedroom - area_name: "Master Bedroom" -packages: - cn105: !include - file: ./mitsubishi-cn105-bt-proxy.yaml diff --git a/kube/deploy/apps/esphome/app/config/metadata.yaml b/kube/deploy/apps/esphome/app/config/metadata.yaml new file mode 100644 index 00000000..c74701cd --- /dev/null +++ b/kube/deploy/apps/esphome/app/config/metadata.yaml @@ -0,0 +1,12 @@ +--- +substitutions: + include: "$${include}" + area_name: "$${area}" + area_dns: > + $${area | replace("'s", "") | replace("_", "-") | replace(" - ", "-") | replace(" ", "-") | lower} + area_id: > + $${area | replace("'", "_") | replace(" - ", "-") | replace(" ", "-") | replace("-", "_") | lower} + name_dns: > + $${name | replace("_", "-") | replace(" - ", "-") | replace(" ", "-") | lower} + +packages: !include "$${include}" diff --git a/kube/deploy/apps/esphome/app/config/mitsubishi-cn105-bt-proxy.yaml b/kube/deploy/apps/esphome/app/config/mitsubishi-cn105-bt-proxy.yaml index 703d31c5..31035423 100644 --- a/kube/deploy/apps/esphome/app/config/mitsubishi-cn105-bt-proxy.yaml +++ b/kube/deploy/apps/esphome/app/config/mitsubishi-cn105-bt-proxy.yaml @@ -1,9 +1,11 @@ --- substitutions: area: "$${area}" - name: "AC CN105" - friendly_name: "Air Conditioner" - description: "Mitsubishi CN105 compatible ESP32 serial air conditioner controller for $${area_name}" + area_id: "$${area_id}" + area_dns: "$${area_dns}" + name: "$${name}" + name_dns: "$${name_dns}" + description: "Mitsubishi CN105 compatible ESP32 serial air conditioner controller for $${area}" packages: common: !include file: ./common.yaml @@ -15,8 +17,8 @@ external_components: - source: github://echavet/MitsubishiCN105ESPHome climate: # Climate entity config - platform: cn105 - id: aircon_$${area_id} - name: "Air Conditioner - $${area_name}" + id: "aircon_$${area_id}" + name: "Air Conditioner - $${area}" update_interval: 2s # update interval can be adjusted after a first run and logs monitoring uart: id: HP_UART @@ -44,8 +46,8 @@ api: # Optimizations logger: - baud_rate: 0 # 0 Enables logging, but disables serial-port logging to free CPU and memory level: INFO + baud_rate: 0 # 0 Enables logging, but disables serial-port logging to free CPU and memory esp32: board: esp32-s3-devkitc-1 framework: