Update ipem-six-c5-single-phase-six-channel.yaml

This commit is contained in:
Dave Williams | DitroniX | G8PUO
2026-06-20 18:06:06 +01:00
parent fbed08ec17
commit 2ec07dc6e8
@@ -24,8 +24,9 @@
# * github.com/DitroniX/IPEM-SIX-ESP32C5-ATM90E32-IoT-Mains-Power-Energy-Monitor/wiki # * github.com/DitroniX/IPEM-SIX-ESP32C5-ATM90E32-IoT-Mains-Power-Energy-Monitor/wiki
# * hackster.io/DitroniX/ipem-six-esp32c5-atm90e32-iot-mains-power-energy-monitor-e323bd # * hackster.io/DitroniX/ipem-six-esp32c5-atm90e32-iot-mains-power-energy-monitor-e323bd
# This YAML code has been created to show the features and functionality of IPEM SIX. # This YAML code has been created to show the features and functionality of IPEM SIX. This code has expanded to become an all encompassing ESPHome applicaition.
# IPEM SIX C5 is a professional 6-channel dual-bank energy monitoring device based on the ESP32-C5 platform and dual ATM90E32 energy measurement ICs. # IPEM SIX C5 is a professional 6-channel dual-bank energy monitoring device based on the ESP32-C5 platform and dual ATM90E32 energy measurement ICs.
# Initial code is for single phase and six current clamps. Multi-phase and Rogorski Coil integrations to flow.
esphome: esphome:
name: ipem-six-c5 name: ipem-six-c5
@@ -55,7 +56,22 @@ substitutions:
# ======================== MAINS CONFIG =========================== # ======================== MAINS CONFIG ===========================
line_frequency: "50Hz" # Change to "60Hz" for US/Canada/etc. line_frequency: "50Hz" # Change to "60Hz" for US/Canada/etc.
nominal_voltage: "230" # For status thresholds and comments line_voltage: "230V" # For status thresholds and comments
# line_frequency: "60Hz" # Change to "60Hz" for US/Canada/etc.
# line_voltage: "110" # For status thresholds and comments
# ===============================================================
# ======================== BOARD CONFIG ===========================
Phases: 1 # Baseline of this version of firmware. For later use.
Current_Inputs: 6 # Baseline of this version of firmware. For later use.
Current_Type: "CT" # Baseline of this version of firmware. For later use. CT / Rogowski
# ===============================================================
# ==================== ATM90E32 Registers ========================
gain_voltage_baseline: 38300 # Baseline for 240V 38300
gain_current_baseline: 64800 # Baseline for CT
gain_pga_baseline: 2X # Baseline for CT
# =============================================================== # ===============================================================
project: project:
@@ -250,6 +266,66 @@ text_sensor:
lambda: |- lambda: |-
return {"${board_rev}"}; return {"${board_rev}"};
- platform: template
name: "Line Voltage Setting"
entity_category: diagnostic
lambda: |-
return {"${line_voltage}"};
- platform: template
name: "Line Frequency Setting"
entity_category: diagnostic
lambda: |-
return {"${line_frequency}"};
- platform: template
name: "Gain Voltage"
entity_category: diagnostic
lambda: |-
return {"${gain_voltage_baseline}"};
- platform: template
name: "Gain Current"
entity_category: diagnostic
lambda: |-
return {"${gain_current_baseline}"};
- platform: template
name: "Gain PGA"
entity_category: diagnostic
lambda: |-
return {"${gain_pga_baseline}"};
- platform: template
name: "Phases"
icon: mdi:current-ac
entity_category: diagnostic
update_interval: 60s
lambda: |-
std::string config = "${phases_config}";
if (config == "1") {
return {"Single"};
} else if (config == "2") {
return {"Split"};
} else if (config == "3") {
return {"3-Phase"};
}
return {"Unknown"};
- platform: template
name: "Current Inputs"
entity_category: diagnostic
lambda: |-
return {"${Current_Inputs}"};
- platform: template
name: "Current Type"
entity_category: diagnostic
lambda: |-
return {"${Current_Type}"};
# ===================================================== # =====================================================
# IPEM SIX CHANNEL METADATA # IPEM SIX CHANNEL METADATA
# ===================================================== # =====================================================
@@ -375,29 +451,35 @@ text_sensor:
# VOLTAGE INFORMATION # VOLTAGE INFORMATION
# ===================================================== # =====================================================
# Mains Voltage range in the UK. # Example Mains Voltage range in the UK.
# 230V -6% / +10% # 230V -6% / +10%
# Low < 216V # Low < 216V
# Normal 216V - 253V # Normal 216V - 253V
# High > 253V # High > 253V
- platform: template - platform: template
name: "IPEM SIX Voltage Status" name: "IPEM SIX Voltage Status"
icon: mdi:sine-wave icon: mdi:flash
update_interval: 10s
lambda: |- lambda: |-
float volt = id(mains_voltage).state;
if (volt <= 10.0) return {"No Signal"};
if (id(mains_voltage).state < 216.0) std::string nom = "${nominal_voltage}";
return {"Low"};
if (id(mains_voltage).state > 253.0)
return {"High"};
if (nom == "230V") {
if (volt < 200.0) return {"Low"};
if (volt > 260.0) return {"High"};
if (volt < 210.0 || volt > 250.0) return {"Warning"};
}
else if (nom == "120V") {
if (volt < 100.0) return {"Low"};
if (volt > 135.0) return {"High"};
if (volt < 108.0 || volt > 127.0) return {"Warning"};
}
return {"Normal"}; return {"Normal"};
update_interval: 10s
# ===================================================== # =====================================================
# FREQUENCY INFORMATION # FREQUENCY INFORMATION
# ===================================================== # =====================================================
@@ -553,7 +635,7 @@ sensor:
id: bank_a id: bank_a
cs_pin: GPIO6 cs_pin: GPIO6
gain_pga: 2X gain_pga: ${gain_pga_baseline}
line_frequency: ${line_frequency} line_frequency: ${line_frequency}
phase_a: phase_a:
@@ -575,8 +657,8 @@ sensor:
power_factor: power_factor:
name: "Bank A 1 Power Factor" name: "Bank A 1 Power Factor"
gain_voltage: 38300 gain_voltage: ${gain_voltage_baseline}
gain_ct: 64800 gain_ct: ${gain_current_baseline}
phase_b: phase_b:
current: current:
@@ -587,8 +669,8 @@ sensor:
name: "Bank A 2 Power" name: "Bank A 2 Power"
id: bank_a_2_power id: bank_a_2_power
gain_voltage: 38300 gain_voltage: ${gain_voltage_baseline}
gain_ct: 64800 gain_ct: ${gain_current_baseline}
phase_c: phase_c:
current: current:
@@ -599,8 +681,8 @@ sensor:
name: "Bank A 3 Power" name: "Bank A 3 Power"
id: bank_a_3_power id: bank_a_3_power
gain_voltage: 38300 gain_voltage: ${gain_voltage_baseline}
gain_ct: 64800 gain_ct: ${gain_current_baseline}
frequency: frequency:
name: "IPEM SIX Frequency" name: "IPEM SIX Frequency"
@@ -621,7 +703,7 @@ sensor:
id: bank_b id: bank_b
cs_pin: GPIO7 cs_pin: GPIO7
gain_pga: 2X gain_pga: ${gain_pga_baseline}
line_frequency: ${line_frequency} line_frequency: ${line_frequency}
phase_a: phase_a:
@@ -633,8 +715,8 @@ sensor:
name: "Bank B 1 Power" name: "Bank B 1 Power"
id: bank_b_1_power id: bank_b_1_power
gain_voltage: 38300 gain_voltage: ${gain_voltage_baseline}
gain_ct: 64800 gain_ct: ${gain_current_baseline}
phase_b: phase_b:
current: current:
@@ -645,8 +727,8 @@ sensor:
name: "Bank B 2 Power" name: "Bank B 2 Power"
id: bank_b_2_power id: bank_b_2_power
gain_voltage: 38300 gain_voltage: ${gain_voltage_baseline}
gain_ct: 64800 gain_ct: ${gain_current_baseline}
phase_c: phase_c:
current: current:
@@ -657,8 +739,8 @@ sensor:
name: "Bank B 3 Power" name: "Bank B 3 Power"
id: bank_b_3_power id: bank_b_3_power
gain_voltage: 38300 gain_voltage: ${gain_voltage_baseline}
gain_ct: 64800 gain_ct: ${gain_current_baseline}
chip_temperature: chip_temperature:
name: "Bank B Temperature" name: "Bank B Temperature"