esphome:
name: dara-tes-esp
min_version: 2025.9.1
build_path: build/dara-tes-esp
esp32:
board: esp32dev
framework:
type: esp-idf
logger:
api:
ota:
- platform: esphome
wifi:
ssid: "Dara@Home"
password: "rejeki88"
manual_ip:
static_ip: 192.188.1.236
gateway: 192.188.1.1
subnet: 255.255.255.0
ap:
ssid: "ESP Fallback"
password: "fallback1234"
web_server:
port: 80
captive_portal:
# Komponen JK-BMS langsung dari GitHub (paling baru)
external_components:
- source: github://syssi/esphome-jk-bms@main
refresh: 0s
esp32_ble_tracker:
scan_parameters:
active: false
# GANTI MAC di sini
ble_client:
- mac_address: "C8:47:80:25:45:CF"
id: client0
# Protokol JK untuk HW baru
jk_bms_ble:
- ble_client_id: client0
protocol_version: JK02_32S
throttle: 8s
id: bms0
# --- I2C / OLED ---
i2c:
sda: GPIO21
scl: GPIO22
scan: true
font:
- id: font_14
file: "gfonts://Roboto"
size: 14
# =========================
# SENSORS
# =========================
sensor:
# DHT11 di GPIO4
- platform: dht
pin: GPIO4
model: DHT11
temperature:
name: "Suhu DHT11"
id: suhu
humidity:
name: "Kelembapan DHT11"
id: kelembapan
update_interval: 10s
# JK-BMS BLE (pakai jk_bms_ble_id di atas)
- platform: jk_bms_ble
jk_bms_ble_id: bms0
total_voltage:
name: "JK Total Voltage"
id: jk_total_voltage
# Nilai SOC dalam Ah (dipakai untuk kontrol)
capacity_remaining:
name: "JK SOC"
id: jk_soc
# Diagnostik ringkas
min_cell_voltage:
name: "JK Min Cell V"
max_cell_voltage:
name: "JK Max Cell V"
min_voltage_cell:
name: "JK Min Voltage Cell #"
max_voltage_cell:
name: "JK Max Voltage Cell #"
average_cell_voltage:
name: "JK Avg Cell V"
delta_cell_voltage:
name: "JK Delta Cell V"
# 15S sesuai pack
cell_voltage_1:
name: "JK Cell V1"
cell_voltage_2:
name: "JK Cell V2"
cell_voltage_3:
name: "JK Cell V3"
cell_voltage_4:
name: "JK Cell V4"
cell_voltage_5:
name: "JK Cell V5"
cell_voltage_6:
name: "JK Cell V6"
cell_voltage_7:
name: "JK Cell V7"
cell_voltage_8:
name: "JK Cell V8"
cell_voltage_9:
name: "JK Cell V9"
cell_voltage_10:
name: "JK Cell V10"
cell_voltage_11:
name: "JK Cell V11"
cell_voltage_12:
name: "JK Cell V12"
cell_voltage_13:
name: "JK Cell V13"
cell_voltage_14:
name: "JK Cell V14"
cell_voltage_15:
name: "JK Cell V15"
# =========================
# Kontrol -> GPIO32
# =========================
output:
- platform: gpio
pin: GPIO32
id: out_gpio32
switch:
- platform: output
name: "SOC Output GPIO32"
id: soc_output
output: out_gpio32
restore_mode: RESTORE_DEFAULT_OFF
- platform: template
name: "Auto Control by SOC"
id: auto_soc_enable
optimistic: true
restore_mode: RESTORE_DEFAULT_OFF
turn_on_action: []
turn_off_action: []
number:
# Ambang berbasis SOC (Ah)
- platform: template
name: "SOC Ah Min (ON)"
id: soc_ah_min_on
unit_of_measurement: "Ah"
min_value: 0
max_value: 100
step: 0.1
optimistic: true
restore_value: true
initial_value: 5.0
- platform: template
name: "SOC Ah Max (OFF)"
id: soc_ah_max_off
unit_of_measurement: "Ah"
min_value: 0
max_value: 100
step: 0.1
optimistic: true
restore_value: true
initial_value: 8.0
# Hysteresis berbasis SOC (Ah):
# - SOC(Ah) <= Min -> ON (GPIO32 HIGH)
# - SOC(Ah) >= Max -> OFF
interval:
- interval: 5s
then:
- if:
condition:
lambda: |-
return id(auto_soc_enable).state &&
id(jk_soc).has_state() && id(soc_ah_min_on).has_state() &&
(id(jk_soc).state <= id(soc_ah_min_on).state);
then:
- switch.turn_on: soc_output
- if:
condition:
lambda: |-
return id(auto_soc_enable).state &&
id(jk_soc).has_state() && id(soc_ah_max_off).has_state() &&
(id(jk_soc).state >= id(soc_ah_max_off).state);
then:
- switch.turn_off: soc_output
# --- OLED 0.96" ---
display:
- platform: ssd1306_i2c
model: "SSD1306 128x64"
address: 0x3C
update_interval: 5s
lambda: |-
it.clear();
it.printf(0, 0, id(font_14), "Hello World");
if (id(suhu).has_state()) it.printf(0, 16, id(font_14), "T: %.1f°C", id(suhu).state);
if (id(kelembapan).has_state()) it.printf(0, 32, id(font_14), "RH: %.1f%%", id(kelembapan).state);
if (id(jk_total_voltage).has_state()) it.printf(0, 48, id(font_14), "V: %.2fV", id(jk_total_voltage).state);
if (id(jk_soc).has_state()) it.printf(80, 48, id(font_14), "SOC: %.0f%%", id(jk_soc).state);
Comments
Post a Comment