Add configurations for new ESP32 camera and sensors, including home energy monitor

This commit is contained in:
Joshua King
2026-02-13 21:02:34 -05:00
parent 8ebe0e29d6
commit 2a2ea974fd
4 changed files with 216 additions and 0 deletions

View File

@@ -0,0 +1,107 @@
esphome:
name: salt-sensor
friendly_name: Salt-Sensor
esp32:
board: esp32-c3-devkitm-1
framework:
type: arduino
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: "EaifDkFuB9N+qDKHW6B4k/n495FWLVmcp6DBODKzK10="
ota:
- platform: esphome
password: "7ce613915c51252c2810c07c889b4a5e"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Salt-Sensor Fallback Hotspot"
password: "ZoBRDcj54rwW"
captive_portal:
# Enable Web server.
web_server:
port: 80
# Sync time with Home Assistant.
time:
- platform: homeassistant
id: homeassistant_time
# Text sensors with general information.
text_sensor:
# Expose ESPHome version as sensor.
- platform: version
name: salt_level_sensor ESPHome Version
# Expose WiFi information as sensors.
- platform: wifi_info
ip_address:
name: salt_level_sensor IP
ssid:
name: salt_level_sensor SSID
bssid:
name: salt_level_sensor BSSID
sensor:
# Uptime sensor.
- platform: uptime
name: salt_level_sensor Uptime
# WiFi Signal sensor.
- platform: wifi_signal
name: salt_level_sensor WiFi Signal
update_interval: 60s
# Ultrasonic sensor to measure salt level.
# - platform: ultrasonic
# trigger_pin: GPIO6
# echo_pin: GPIO7
# name: "Salt level in percent"
# update_interval: 1h
# unit_of_measurement: "%"
# # pulse_time: 20us
# # accuracy_decimals: 4
# filters:
# - lambda: return(0.42-x)*(100/0.42);
# # - multiply: 100
# - exponential_moving_average:
# alpha: 0.001
# send_every: 1
# - clamp:
# min_value: 20
# max_value: 100
# on_value_range:
# above: 200
# then:
# - homeassistant.service:
# service: notify.mailgun
# data:
# target:
# -"joshua@cnjmail.com"
# title: "Add Salt"
# message: "Add Salt to the Water Softener Tank"
# - homeassistant.service:
# service: notify.mobile_app_joshuas_iphone_of_pain
# data:
# message: Water softener is low on salt, please add salt.
# Ultrasonic sensor to measure salt level.
- platform: ultrasonic
trigger_pin: GPIO6
echo_pin: GPIO7
name: "Salt level in cm"
update_interval: .5h
unit_of_measurement: "cm"
# pulse_time: 20us
# accuracy_decimals: 4
filters:
- lambda: return(0.83-x)*(100/0.83);

View File

@@ -0,0 +1,161 @@
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