162 lines
4.0 KiB
YAML
162 lines
4.0 KiB
YAML
substitutions:
|
|
friendly_name: "Home Energy Monitor"
|
|
device_name: home-energy-monitor
|
|
update_time: 10s
|
|
# SCT-013-000 (100A/50mA) calibration value
|
|
current_cal: '27518'
|
|
# Jameco 9VAC Transformer (board v1.3+)
|
|
voltage_cal: '7305'
|
|
|
|
esphome:
|
|
name: ${device_name}
|
|
friendly_name: ${friendly_name}
|
|
|
|
esp32:
|
|
board: nodemcu-32s
|
|
|
|
# Enable logging
|
|
logger:
|
|
|
|
# Enable Home Assistant API
|
|
api:
|
|
encryption:
|
|
key: !secret api_encryption_key
|
|
|
|
# Enable OTA updates
|
|
ota:
|
|
- platform: esphome
|
|
|
|
wifi:
|
|
ssid: !secret wifi_ssid
|
|
password: !secret wifi_password
|
|
# Optional: static IP for reliability
|
|
# manual_ip:
|
|
# static_ip: 192.168.1.50
|
|
# gateway: 192.168.1.1
|
|
# subnet: 255.255.255.0
|
|
|
|
# Fallback hotspot if Wi-Fi fails
|
|
ap:
|
|
ssid: ${device_name}
|
|
password: !secret wifi_password
|
|
|
|
captive_portal:
|
|
|
|
web_server:
|
|
port: 80
|
|
|
|
# SPI bus configuration
|
|
spi:
|
|
clk_pin: 18
|
|
miso_pin: 19
|
|
mosi_pin: 23
|
|
|
|
sensor:
|
|
# Wi-Fi signal strength
|
|
- platform: wifi_signal
|
|
name: ${device_name} WiFi Signal
|
|
update_interval: 60s
|
|
|
|
# ──────────────────────────────────
|
|
# IC1: Channels 1-3 (CS pin 5)
|
|
# ──────────────────────────────────
|
|
- platform: atm90e32
|
|
cs_pin: 5
|
|
phase_a:
|
|
voltage:
|
|
name: ${device_name} Volts
|
|
id: ic1Volts
|
|
accuracy_decimals: 1
|
|
current:
|
|
name: ${device_name} CT1 Amps
|
|
id: ct1Amps
|
|
power:
|
|
name: ${device_name} CT1 Watts
|
|
id: ct1Watts
|
|
gain_voltage: ${voltage_cal}
|
|
gain_ct: ${current_cal}
|
|
phase_b:
|
|
current:
|
|
name: ${device_name} CT2 Amps
|
|
id: ct2Amps
|
|
power:
|
|
name: ${device_name} CT2 Watts
|
|
id: ct2Watts
|
|
gain_voltage: ${voltage_cal}
|
|
gain_ct: ${current_cal}
|
|
phase_c:
|
|
current:
|
|
name: ${device_name} CT3 Amps
|
|
id: ct3Amps
|
|
power:
|
|
name: ${device_name} CT3 Watts
|
|
id: ct3Watts
|
|
gain_voltage: ${voltage_cal}
|
|
gain_ct: ${current_cal}
|
|
frequency:
|
|
name: ${device_name} Frequency
|
|
line_frequency: 60Hz
|
|
gain_pga: 1X
|
|
update_interval: ${update_time}
|
|
|
|
# ──────────────────────────────────
|
|
# IC2: Channels 4-6 (CS pin 4)
|
|
# ──────────────────────────────────
|
|
- platform: atm90e32
|
|
cs_pin: 4
|
|
phase_a:
|
|
current:
|
|
name: ${device_name} CT4 Amps
|
|
id: ct4Amps
|
|
power:
|
|
name: ${device_name} CT4 Watts
|
|
id: ct4Watts
|
|
gain_voltage: ${voltage_cal}
|
|
gain_ct: ${current_cal}
|
|
phase_b:
|
|
current:
|
|
name: ${device_name} CT5 Amps
|
|
id: ct5Amps
|
|
power:
|
|
name: ${device_name} CT5 Watts
|
|
id: ct5Watts
|
|
gain_voltage: ${voltage_cal}
|
|
gain_ct: ${current_cal}
|
|
phase_c:
|
|
current:
|
|
name: ${device_name} CT6 Amps
|
|
id: ct6Amps
|
|
power:
|
|
name: ${device_name} CT6 Watts
|
|
id: ct6Watts
|
|
gain_voltage: ${voltage_cal}
|
|
gain_ct: ${current_cal}
|
|
line_frequency: 60Hz
|
|
gain_pga: 1X
|
|
update_interval: ${update_time}
|
|
|
|
# ──────────────────────────────────
|
|
# Calculated: Total Home Power
|
|
# (CT1 = Main Leg 1, CT2 = Main Leg 2)
|
|
# ──────────────────────────────────
|
|
- platform: template
|
|
name: ${device_name} Total Watts
|
|
id: totalWatts
|
|
lambda: "return id(ct1Watts).state + id(ct2Watts).state;"
|
|
accuracy_decimals: 1
|
|
unit_of_measurement: W
|
|
device_class: power
|
|
update_interval: ${update_time}
|
|
|
|
- platform: total_daily_energy
|
|
name: ${device_name} Total Daily Energy
|
|
power_id: totalWatts
|
|
unit_of_measurement: kWh
|
|
accuracy_decimals: 2
|
|
filters:
|
|
- multiply: 0.001
|
|
|
|
time:
|
|
- platform: homeassistant
|
|
id: homeassistant_time
|