mirror of
https://github.com/outbackdingo/Biohazard.git
synced 2026-01-28 10:18:26 +00:00
feat: add ESPHome
This commit is contained in:
@@ -1,29 +1,3 @@
|
||||
---
|
||||
substitutions:
|
||||
area: "$${area}"
|
||||
name: "AC - CN105"
|
||||
description: "Mitsubishi CN105 compatible ESP32 serial air conditioner controller for $${area}"
|
||||
packages:
|
||||
common: !include
|
||||
file: ./common.yaml
|
||||
wifi: !include
|
||||
file: ./wifi.yaml
|
||||
|
||||
# Mitsubishi CN105 air conditioner controller
|
||||
external_components:
|
||||
- source: github://echavet/MitsubishiCN105ESPHome
|
||||
climate: # Climate entity config
|
||||
- platform: cn105
|
||||
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
|
||||
baud_rate: 2400
|
||||
tx_pin: GPIO17
|
||||
rx_pin: GPIO16
|
||||
|
||||
# Bluetooth Proxy
|
||||
bluetooth_proxy:
|
||||
active: true
|
||||
@@ -42,14 +16,8 @@ api:
|
||||
# then:
|
||||
# - esp32_ble_tracker.stop_scan:
|
||||
|
||||
# Optimizations
|
||||
logger:
|
||||
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:
|
||||
type: esp-idf # This is important: the default "arduino" framework does not perform well.
|
||||
sdkconfig_options:
|
||||
# @grigi found in testing that these options resulted in better responsiveness.
|
||||
# BLE 4.2 is supported by ALL ESP32 boards that have bluetooth, the original and derivatives.
|
||||
@@ -58,7 +26,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"
|
||||
|
||||
# Enable esphome OTA updates
|
||||
ota:
|
||||
- platform: esphome
|
||||
62
kube/deploy/apps/esphome/app/config/.common.yaml
Normal file
62
kube/deploy/apps/esphome/app/config/.common.yaml
Normal file
@@ -0,0 +1,62 @@
|
||||
.substitutions: &subs !include { file: "./.metadata.yaml", vars: { area: "$${area}", name: "$${name}" } }
|
||||
substitutions:
|
||||
<<: *subs
|
||||
system_name: >
|
||||
${AREA_DNS}-${NAME_DNS}
|
||||
device_description: "$${description}"
|
||||
friendly_name: "$${area} - $${name}"
|
||||
board: "$${board | default('esp32-s3-devkitc-1')}"
|
||||
framework: "$${framework | default('esp-idf')}" # This is important: the default "arduino" framework does not perform well.
|
||||
log: "$${log | default('INFO')}"
|
||||
|
||||
esphome:
|
||||
name: "$${area_dns}-$${name_dns}"
|
||||
#!include { file: "./metadata/esphome-name.yaml", vars: { area: "$${area}", name: "$${name}" } }
|
||||
comment: "$${device_description}"
|
||||
friendly_name: "$${friendly_name}"
|
||||
area:
|
||||
id: "$${area_id}"
|
||||
#!include { file: "./metadata/area-id.yaml", vars: { area: "$${area}" } }
|
||||
name: "$${area}"
|
||||
|
||||
esp32:
|
||||
board: "$${board}"
|
||||
framework:
|
||||
type: "$${framework}"
|
||||
|
||||
api: {}
|
||||
|
||||
ota: # Enable esphome OTA updates
|
||||
- platform: esphome
|
||||
|
||||
binary_sensor:
|
||||
- platform: status
|
||||
id: "status_sensor"
|
||||
name: Status
|
||||
entity_category: diagnostic
|
||||
|
||||
button:
|
||||
- platform: restart
|
||||
name: Restart
|
||||
id: "restart_button"
|
||||
icon: mdi:restart
|
||||
entity_category: config
|
||||
|
||||
sensor:
|
||||
- platform: uptime
|
||||
type: seconds
|
||||
id: "uptime_sensor"
|
||||
name: Uptime
|
||||
entity_category: diagnostic
|
||||
update_interval: 60s
|
||||
|
||||
time:
|
||||
- platform: sntp
|
||||
id: time_sntp
|
||||
timezone: "Asia/Singapore"
|
||||
update_interval: 6h
|
||||
|
||||
# Optimizations
|
||||
logger:
|
||||
level: "$${log}"
|
||||
baud_rate: 0 # 0 Enables logging, but disables serial-port logging to free CPU and memory
|
||||
6
kube/deploy/apps/esphome/app/config/.metadata.yaml
Normal file
6
kube/deploy/apps/esphome/app/config/.metadata.yaml
Normal file
@@ -0,0 +1,6 @@
|
||||
area_dns: >
|
||||
$${area | replace("'s", "") | replace("_", "-") | replace(" - ", "-") | replace(" ", "-") | lower}
|
||||
area_id: >
|
||||
$${area | replace("'", "_") | replace(" - ", "-") | replace(" ", "-") | replace("-", "_") | lower}
|
||||
name_dns: >
|
||||
$${name | replace("_", "-") | replace(" - ", "-") | replace(" ", "-") | lower}
|
||||
27
kube/deploy/apps/esphome/app/config/.mitsubishi-cn105.yaml
Normal file
27
kube/deploy/apps/esphome/app/config/.mitsubishi-cn105.yaml
Normal file
@@ -0,0 +1,27 @@
|
||||
---
|
||||
.substitutions: &subs !include { file: "./.metadata.yaml", vars: { area: "$${area}", name: &name "AC - CN105" } }
|
||||
substitutions:
|
||||
<<: *subs
|
||||
area: "$${area}"
|
||||
name: *name
|
||||
description: "Mitsubishi CN105 compatible ESP32 serial air conditioner controller for $${area}"
|
||||
packages:
|
||||
common: !include
|
||||
file: ./.common.yaml
|
||||
wifi: !include
|
||||
file: ./.wifi.yaml
|
||||
|
||||
# Mitsubishi CN105 air conditioner controller
|
||||
external_components:
|
||||
- source: github://echavet/MitsubishiCN105ESPHome
|
||||
climate: # Climate entity config
|
||||
- platform: cn105
|
||||
id: "aircon_$${area_id}"
|
||||
#!include { file: "./metadata/area-id.yaml", vars: { area: "$${area}", prefix: "aircon_" } }
|
||||
name: "Air Conditioner - $${area}"
|
||||
update_interval: 2s # update interval can be adjusted after a first run and logs monitoring
|
||||
uart:
|
||||
id: HP_UART
|
||||
baud_rate: 2400
|
||||
tx_pin: GPIO17
|
||||
rx_pin: GPIO16
|
||||
@@ -1,8 +1,4 @@
|
||||
---
|
||||
substitutions:
|
||||
wifi_db_id: wifi_signal_db
|
||||
wifi_percent_id: wifi_signal_percent
|
||||
|
||||
wifi:
|
||||
domain: .esp.dhcp.internal
|
||||
ssid: !secret wifi_ssid
|
||||
@@ -13,14 +9,14 @@ wifi:
|
||||
sensor:
|
||||
- platform: wifi_signal # Reports the WiFi signal strength in dB
|
||||
name: WiFi Signal dB
|
||||
id: $${wifi_db_id}
|
||||
id: &src wifi_signal_db
|
||||
update_interval: 60s
|
||||
entity_category: diagnostic
|
||||
|
||||
- platform: copy # Reports the WiFi signal strength in %
|
||||
source_id: $${wifi_db_id}
|
||||
source_id: *src
|
||||
name: WiFi Signal Percent
|
||||
id: $${wifi_percent_id}
|
||||
id: wifi_signal_percent
|
||||
filters:
|
||||
- lambda: return min(max(2 * (x + 100.0), 0.0), 100.0);
|
||||
unit_of_measurement: "%"
|
||||
@@ -1,45 +0,0 @@
|
||||
substitutions:
|
||||
system_name: >
|
||||
${AREA_DNS}-${NAME_DNS}
|
||||
device_description: "$${description}"
|
||||
friendly_name: "$${area} - $${name}"
|
||||
|
||||
status_id: status_sensor
|
||||
restart_id: restart_button
|
||||
uptime_id: uptime_sensor
|
||||
|
||||
esphome:
|
||||
name: "$${system_name}"
|
||||
comment: "$${device_description}"
|
||||
friendly_name: "$${friendly_name}"
|
||||
area:
|
||||
id: >
|
||||
${AREA_ID}
|
||||
name: "$${area}"
|
||||
|
||||
binary_sensor:
|
||||
- platform: status
|
||||
id: "$${status_id}"
|
||||
name: Status
|
||||
entity_category: diagnostic
|
||||
|
||||
button:
|
||||
- platform: restart
|
||||
name: Restart
|
||||
id: "$${restart_id}"
|
||||
icon: mdi:restart
|
||||
entity_category: config
|
||||
|
||||
sensor:
|
||||
- platform: uptime
|
||||
type: seconds
|
||||
id: "$${uptime_id}"
|
||||
name: Uptime
|
||||
entity_category: diagnostic
|
||||
update_interval: 60s
|
||||
|
||||
time:
|
||||
- platform: sntp
|
||||
id: time_sntp
|
||||
timezone: "Asia/Singapore"
|
||||
update_interval: 6h
|
||||
@@ -1,4 +1,6 @@
|
||||
---
|
||||
substitutions:
|
||||
area: "JJ's Room"
|
||||
packages: !include ./mitsubishi-cn105-bt-proxy.yaml
|
||||
packages:
|
||||
- !include ./.mitsubishi-cn105.yaml
|
||||
- !include ./.bluetooth-proxy.yaml
|
||||
|
||||
@@ -4,9 +4,11 @@ kind: Kustomization
|
||||
configMapGenerator:
|
||||
- name: esphome-config
|
||||
files:
|
||||
- ./common.yaml
|
||||
- ./wifi.yaml
|
||||
- ./mitsubishi-cn105-bt-proxy.yaml
|
||||
- ./.common.yaml
|
||||
- ./.wifi.yaml
|
||||
- ./.metadata.yaml
|
||||
- ./.bluetooth-proxy.yaml
|
||||
- ./.mitsubishi-cn105.yaml
|
||||
- ./jj-room-ac.yaml
|
||||
- ./master-bedroom-ac.yaml
|
||||
generatorOptions:
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
---
|
||||
substitutions:
|
||||
area: "Master Bedroom"
|
||||
packages: !include ./mitsubishi-cn105-bt-proxy.yaml
|
||||
packages:
|
||||
- !include ./.mitsubishi-cn105.yaml
|
||||
- !include ./.bluetooth-proxy.yaml
|
||||
|
||||
Reference in New Issue
Block a user