feat(esphome): enable MQTT

This commit is contained in:
JJGadgets
2025-08-03 22:43:16 +08:00
parent 313a7dabc1
commit 29ea7a9353
6 changed files with 37 additions and 45 deletions

View File

@@ -21,8 +21,8 @@ esp32_ble_tracker:
scan_parameters:
continuous: False
active: True
interval: 320ms
window: 300ms
# interval: 320ms
# window: 300ms
esp32:
framework:
@@ -34,45 +34,3 @@ esp32:
CONFIG_BT_BLE_50_FEATURES_SUPPORTED: y
# Extend the watchdog timeout, so the device reboots if the device appears locked up for over 10 seconds.
CONFIG_ESP_TASK_WDT_TIMEOUT_S: "10"
# IRK
# external_components:
# - components: [irk_enrollment]
# source:
# type: git
# url: https://github.com/Foleychris/esphome-irk-enrollment
# ref: 418ac2907af1c0101e2f644a8114c23b8a1d61ba
# path: custom_components
#
# irk_enrollment:
# latest_irk:
# name: Latest IRK
#
# # Enable BLE functionality
# esp32_ble:
# # Set IO capability for pairing
# io_capability: keyboard_only
#
# # Enable BLE server
# esp32_ble_server:
# # Set device appearance to Heart Rate Sensor for better iOS visibility
# appearance: 0x0341
# # Add manufacturer data for better iOS visibility
# manufacturer_data: [0xFF, 0xFF, 0x01, 0x02]
# # Define BLE services
# services:
# - uuid: 0x180D # Heart Rate Service
# characteristics:
# - uuid: 0x2A37 # Heart Rate Measurement
# read: true
# notify: true
# value: "0600" # Initial value (flags + heart rate)
#
# - uuid: 0x180A # Device Information Service
# characteristics:
# - uuid: 0x2A29 # Manufacturer Name
# read: true
# value: "ESPHome"
# - uuid: 0x2A24 # Model Number
# read: true
# value: "IRK Collector"

View File

@@ -14,6 +14,12 @@ packages:
board: "$${board | default('lolin_s3_mini')}"
wifi: !include
file: ./.wifi.yaml
mqtt: !include
file: ./.mqtt.yaml
vars:
mqtt_username: !secret mqtt_cn105_username
mqtt_password: !secret mqtt_cn105_password
mqtt_prefix: "cn105/$${area_dns}"
# Mitsubishi CN105 air conditioner controller
external_components:

View File

@@ -0,0 +1,16 @@
---
mqtt:
broker: !secret mqtt_broker
port: !!int $${mqtt_port | default('8884')}
username: "$${mqtt_username}"
password: "$${mqtt_password}"
topic_prefix: "$${mqtt_prefix}"
certificate_authority: !secret mqtt_tls_ca
# skip_cert_cn_check: true # mbedTLS doesn't support wildcards as of 2025.7.2
discovery_unique_id_generator: mac
discovery_object_id_generator: device_name
idf_send_async: true
publish_nan_as_none: true
log_topic: null
birth_message:
will_message:

View File

@@ -6,6 +6,7 @@ configMapGenerator:
files:
- ./.common.yaml
- ./.wifi.yaml
- ./.mqtt.yaml
- ./.metadata.yaml
- ./.bluetooth-proxy.yaml
- ./.mitsubishi-cn105.yaml

View File

@@ -13,6 +13,10 @@ spec:
dataFrom:
- extract:
key: "ESPHome - ${CLUSTER_NAME}"
- extract:
key: "Mosquitto - ${CLUSTER_NAME}"
- extract:
key: "TLS - short-domain-tls - ${CLUSTER_NAME}"
target:
creationPolicy: Owner
deletionPolicy: Retain
@@ -24,3 +28,8 @@ spec:
wifi_ssid: "{{ .ESP_WIFI_SSID }}"
wifi_password: "{{ .ESP_WIFI_PASSWORD }}"
domain: "{{ .ESP_WIFI_DOMAIN }}"
mqtt_broker: "{{ .APP_DNS_MOSQUITTO }}"
mqtt_cn105_username: "{{ .X_EMQX_MQTT_ESPHOME_CN105_USERNAME }}"
mqtt_cn105_password: "{{ .X_EMQX_MQTT_ESPHOME_CN105_PASSWORD }}"
mqtt_tls_ca: |
{{ index . "tls-combined.pem" | b64dec | filterPEM "CERTIFICATE" | filterCertChain "intermediate" }}

View File

@@ -46,7 +46,7 @@ spec:
cpu: "5m"
memory: "512Mi"
limits:
cpu: "4"
cpu: "6"
memory: "4Gi"
service:
app:
@@ -88,6 +88,8 @@ spec:
path: /config/.common.yaml
- subPath: .wifi.yaml
path: /config/.wifi.yaml
- subPath: .mqtt.yaml
path: /config/.mqtt.yaml
- subPath: .metadata.yaml
path: /config/.metadata.yaml
- subPath: .bluetooth-proxy.yaml