mirror of
https://github.com/CeeWeasel/fresh-home.git
synced 2026-08-09 18:40:14 -04:00
Refactor code structure for improved readability and maintainability
This commit is contained in:
@@ -810,7 +810,7 @@ sensor:
|
||||
topic: ${mqtt_root_topic}/${devicename}/${ct21Name}_kwh/status
|
||||
payload_available: online
|
||||
payload_not_available: offline
|
||||
state_topic: ${mqtt_root_topic}/${devicename}/${ct21Name}_kwh
|
||||
state_topic: ${mqtt_root_topic}/${devicename}/${ct21Name}_kwh
|
||||
# min_save_interval: ${update_time}
|
||||
|
||||
#kWh From CT 22
|
||||
|
||||
@@ -38,14 +38,15 @@ packages:
|
||||
- bed-presence-mk1/base.yaml
|
||||
- esphome-common/bluetooth-proxy.yaml
|
||||
|
||||
|
||||
binary_sensor:
|
||||
- id: !remove local_status_sensor
|
||||
- id: !remove bed_presence_status
|
||||
|
||||
button:
|
||||
- id: !remove local_restart_button
|
||||
- id: !remove btn_restart
|
||||
|
||||
sensor:
|
||||
- id: !remove local_uptime_sensor
|
||||
- id: !remove bed_presence_uptime
|
||||
# See https://github.com/ElevatedSensors/sensor-configs/blob/main/bed-presence-mk1/sensor.yaml for a detailed
|
||||
# description of available substitutions.
|
||||
#
|
||||
|
||||
@@ -6,33 +6,45 @@ sensor:
|
||||
############
|
||||
- platform: atm90e32
|
||||
release_device: true
|
||||
cs_pin: 0
|
||||
cs_pin: ${addon1_ic1}
|
||||
id: ${addon1_id1}
|
||||
phase_a:
|
||||
current:
|
||||
name: ${ct7_name} Amps
|
||||
name: ${ct7_name} ${amp_label}
|
||||
id: ct7Amps
|
||||
power:
|
||||
name: ${ct7_name} Watts
|
||||
name: ${ct7_name} ${watt_label}
|
||||
id: ct7Watts
|
||||
filters:
|
||||
- lambda: |-
|
||||
if (x < 0) return x * -1;
|
||||
return x;
|
||||
gain_voltage: ${voltage_cal1}
|
||||
gain_ct: ${current_cal_ct7}
|
||||
phase_b:
|
||||
current:
|
||||
name: ${ct8_name} Amps
|
||||
name: ${ct8_name} ${amp_label}
|
||||
id: ct8Amps
|
||||
power:
|
||||
name: ${ct8_name} Watts
|
||||
name: ${ct8_name} ${watt_label}
|
||||
id: ct8Watts
|
||||
filters:
|
||||
- lambda: |-
|
||||
if (x < 0) return x * -1;
|
||||
return x;
|
||||
gain_voltage: ${voltage_cal1}
|
||||
gain_ct: ${current_cal_ct8}
|
||||
phase_c:
|
||||
current:
|
||||
name: ${ct9_name} Amps
|
||||
name: ${ct9_name} ${amp_label}
|
||||
id: ct9Amps
|
||||
power:
|
||||
name: ${ct9_name} Watts
|
||||
name: ${ct9_name} ${watt_label}
|
||||
id: ct9Watts
|
||||
filters:
|
||||
- lambda: |-
|
||||
if (x < 0) return x * -1;
|
||||
return x;
|
||||
gain_voltage: ${voltage_cal1}
|
||||
gain_ct: ${current_cal_ct9}
|
||||
line_frequency: ${electric_freq}
|
||||
@@ -44,33 +56,45 @@ sensor:
|
||||
############
|
||||
- platform: atm90e32
|
||||
release_device: true
|
||||
cs_pin: 16
|
||||
cs_pin: ${addon1_ic2}
|
||||
id: ${addon1_id2}
|
||||
phase_a:
|
||||
current:
|
||||
name: ${ct10_name} Amps
|
||||
name: ${ct10_name} ${amp_label}
|
||||
id: ct10Amps
|
||||
power:
|
||||
name: ${ct10_name} Watts
|
||||
name: ${ct10_name} ${watt_label}
|
||||
id: ct10Watts
|
||||
filters:
|
||||
- lambda: |-
|
||||
if (x < 0) return x * -1;
|
||||
return x;
|
||||
gain_voltage: ${voltage_cal2}
|
||||
gain_ct: ${current_cal_ct10}
|
||||
phase_b:
|
||||
current:
|
||||
name: ${ct11_name} Amps
|
||||
name: ${ct11_name} ${amp_label}
|
||||
id: ct11Amps
|
||||
power:
|
||||
name: ${ct11_name} Watts
|
||||
name: ${ct11_name} ${watt_label}
|
||||
id: ct11Watts
|
||||
filters:
|
||||
- lambda: |-
|
||||
if (x < 0) return x * -1;
|
||||
return x;
|
||||
gain_voltage: ${voltage_cal2}
|
||||
gain_ct: ${current_cal_ct11}
|
||||
phase_c:
|
||||
current:
|
||||
name: ${ct12_name} Amps
|
||||
name: ${ct12_name} ${amp_label}
|
||||
id: ct12Amps
|
||||
power:
|
||||
name: ${ct12_name} Watts
|
||||
name: ${ct12_name} ${watt_label}
|
||||
id: ct12Watts
|
||||
filters:
|
||||
- lambda: |-
|
||||
if (x < 0) return x * -1;
|
||||
return x;
|
||||
gain_voltage: ${voltage_cal2}
|
||||
gain_ct: ${current_cal_ct12}
|
||||
line_frequency: ${electric_freq}
|
||||
@@ -79,9 +103,9 @@ sensor:
|
||||
enable_offset_calibration: ${offset_calibration}
|
||||
enable_gain_calibration: ${gain_calibration}
|
||||
|
||||
#Total Amps AddOn1
|
||||
#Total A AddOn1
|
||||
- platform: template
|
||||
name: ${friendly_name} Total Amps Add-on1
|
||||
name: Add-on 1 Total ${amp_label}
|
||||
id: totalAmpsAddOn1
|
||||
lambda: return id(ct7Amps).state + id(ct8Amps).state + id(ct9Amps).state + id(ct10Amps).state + id(ct11Amps).state + id(ct12Amps).state ;
|
||||
accuracy_decimals: 2
|
||||
@@ -89,12 +113,78 @@ sensor:
|
||||
device_class: current
|
||||
update_interval: ${update_time}
|
||||
|
||||
#Total Watts AddOn1
|
||||
#Total W AddOn1
|
||||
- platform: template
|
||||
name: ${friendly_name} Total Watts Add-on1
|
||||
name: Add-on 1 Total ${watt_label}
|
||||
id: totalWattsAddOn1
|
||||
lambda: return id(ct7Watts).state + id(ct8Watts).state + id(ct9Watts).state + id(ct10Watts).state + id(ct11Watts).state + id(ct12Watts).state ;
|
||||
accuracy_decimals: 2
|
||||
unit_of_measurement: W
|
||||
device_class: power
|
||||
update_interval: ${update_time}
|
||||
|
||||
#kWh From CT 7
|
||||
- platform: total_daily_energy
|
||||
name: ${ct7_name} ${kwh_label}
|
||||
id: ct7Kwh
|
||||
power_id: ct7Watts
|
||||
filters:
|
||||
- multiply: 0.001
|
||||
unit_of_measurement: kWh
|
||||
device_class: energy
|
||||
state_class: total_increasing
|
||||
|
||||
# kWh from CT 8
|
||||
- platform: total_daily_energy
|
||||
name: ${ct8_name} ${kwh_label}
|
||||
id: ct8Kwh
|
||||
power_id: ct8Watts
|
||||
filters:
|
||||
- multiply: 0.001
|
||||
unit_of_measurement: kWh
|
||||
device_class: energy
|
||||
state_class: total_increasing
|
||||
|
||||
#kWh From CT 9
|
||||
- platform: total_daily_energy
|
||||
name: ${ct9_name} ${kwh_label}
|
||||
id: ct9Kwh
|
||||
power_id: ct9Watts
|
||||
filters:
|
||||
- multiply: 0.001
|
||||
unit_of_measurement: kWh
|
||||
device_class: energy
|
||||
state_class: total_increasing
|
||||
|
||||
#kWh From CT 10
|
||||
- platform: total_daily_energy
|
||||
name: ${ct10_name} ${kwh_label}
|
||||
id: ct10Kwh
|
||||
power_id: ct10Watts
|
||||
filters:
|
||||
- multiply: 0.001
|
||||
unit_of_measurement: kWh
|
||||
device_class: energy
|
||||
state_class: total_increasing
|
||||
|
||||
#kWh From CT 11
|
||||
- platform: total_daily_energy
|
||||
name: ${ct11_name} ${kwh_label}
|
||||
id: ct11Kwh
|
||||
power_id: ct11Watts
|
||||
filters:
|
||||
- multiply: 0.001
|
||||
unit_of_measurement: kWh
|
||||
device_class: energy
|
||||
state_class: total_increasing
|
||||
|
||||
#kWh From CT 12
|
||||
- platform: total_daily_energy
|
||||
name: ${ct12_name} ${kwh_label}
|
||||
id: ct12Kwh
|
||||
power_id: ct12Watts
|
||||
filters:
|
||||
- multiply: 0.001
|
||||
unit_of_measurement: kWh
|
||||
device_class: energy
|
||||
state_class: total_increasing
|
||||
@@ -5,34 +5,46 @@ sensor:
|
||||
#IC1 AddOn 2
|
||||
############
|
||||
- platform: atm90e32
|
||||
cs_pin: 27
|
||||
cs_pin: ${addon2_ic1}
|
||||
release_device: true
|
||||
id: ${addon2_id1}
|
||||
phase_a:
|
||||
current:
|
||||
name: ${ct13_name} Amps
|
||||
name: ${ct13_name} ${amp_label}
|
||||
id: ct13Amps
|
||||
power:
|
||||
name: ${ct13_name} Watts
|
||||
name: ${ct13_name} ${watt_label}
|
||||
id: ct13Watts
|
||||
filters:
|
||||
- lambda: |-
|
||||
if (x < 0) return x * -1;
|
||||
return x;
|
||||
gain_voltage: ${voltage_cal1}
|
||||
gain_ct: ${current_cal_ct13}
|
||||
phase_b:
|
||||
current:
|
||||
name: ${ct14_name} Amps
|
||||
name: ${ct14_name} ${amp_label}
|
||||
id: ct14Amps
|
||||
power:
|
||||
name: ${ct14_name} Watts
|
||||
name: ${ct14_name} ${watt_label}
|
||||
id: ct14Watts
|
||||
filters:
|
||||
- lambda: |-
|
||||
if (x < 0) return x * -1;
|
||||
return x;
|
||||
gain_voltage: ${voltage_cal1}
|
||||
gain_ct: ${current_cal_ct14}
|
||||
phase_c:
|
||||
current:
|
||||
name: ${ct15_name} Amps
|
||||
name: ${ct15_name} ${amp_label}
|
||||
id: ct15Amps
|
||||
power:
|
||||
name: ${ct15_name} Watts
|
||||
name: ${ct15_name} ${watt_label}
|
||||
id: ct15Watts
|
||||
filters:
|
||||
- lambda: |-
|
||||
if (x < 0) return x * -1;
|
||||
return x;
|
||||
gain_voltage: ${voltage_cal1}
|
||||
gain_ct: ${current_cal_ct15}
|
||||
line_frequency: ${electric_freq}
|
||||
@@ -44,33 +56,45 @@ sensor:
|
||||
############
|
||||
- platform: atm90e32
|
||||
release_device: true
|
||||
cs_pin: 17
|
||||
cs_pin: ${addon2_ic2}
|
||||
id: ${addon2_id2}
|
||||
phase_a:
|
||||
current:
|
||||
name: ${ct16_name} Amps
|
||||
name: ${ct16_name} ${amp_label}
|
||||
id: ct16Amps
|
||||
power:
|
||||
name: ${ct16_name} Watts
|
||||
name: ${ct16_name} ${watt_label}
|
||||
id: ct16Watts
|
||||
filters:
|
||||
- lambda: |-
|
||||
if (x < 0) return x * -1;
|
||||
return x;
|
||||
gain_voltage: ${voltage_cal2}
|
||||
gain_ct: ${current_cal_ct16}
|
||||
phase_b:
|
||||
current:
|
||||
name: ${ct17_name} Amps
|
||||
name: ${ct17_name} ${amp_label}
|
||||
id: ct17Amps
|
||||
power:
|
||||
name: ${ct17_name} Watts
|
||||
name: ${ct17_name} ${watt_label}
|
||||
id: ct17Watts
|
||||
filters:
|
||||
- lambda: |-
|
||||
if (x < 0) return x * -1;
|
||||
return x;
|
||||
gain_voltage: ${voltage_cal2}
|
||||
gain_ct: ${current_cal_ct17}
|
||||
phase_c:
|
||||
current:
|
||||
name: ${ct18_name} Amps
|
||||
name: ${ct18_name} ${amp_label}
|
||||
id: ct18Amps
|
||||
power:
|
||||
name: ${ct18_name} Watts
|
||||
name: ${ct18_name} ${watt_label}
|
||||
id: ct18Watts
|
||||
filters:
|
||||
- lambda: |-
|
||||
if (x < 0) return x * -1;
|
||||
return x;
|
||||
gain_voltage: ${voltage_cal2}
|
||||
gain_ct: ${current_cal_ct18}
|
||||
line_frequency: ${electric_freq}
|
||||
@@ -79,9 +103,9 @@ sensor:
|
||||
enable_offset_calibration: ${offset_calibration}
|
||||
enable_gain_calibration: ${gain_calibration}
|
||||
|
||||
#Total Amps AddOn2
|
||||
#Total A AddOn2
|
||||
- platform: template
|
||||
name: ${friendly_name} Total Amps Add-on2
|
||||
name: Add-on 2 Total ${amp_label}
|
||||
id: totalAmpsAddOn2
|
||||
lambda: return id(ct13Amps).state + id(ct14Amps).state + id(ct15Amps).state + id(ct16Amps).state + id(ct17Amps).state + id(ct18Amps).state ;
|
||||
accuracy_decimals: 2
|
||||
@@ -89,12 +113,78 @@ sensor:
|
||||
device_class: current
|
||||
update_interval: ${update_time}
|
||||
|
||||
#Total Watts AddOn2
|
||||
#Total W AddOn2
|
||||
- platform: template
|
||||
name: ${friendly_name} Total Watts Add-on2
|
||||
name: Add-on 2 Total ${watt_label}
|
||||
id: totalWattsAddOn2
|
||||
lambda: return id(ct13Watts).state + id(ct14Watts).state + id(ct15Watts).state + id(ct16Watts).state + id(ct17Watts).state + id(ct18Watts).state ;
|
||||
accuracy_decimals: 2
|
||||
unit_of_measurement: W
|
||||
device_class: power
|
||||
update_interval: ${update_time}
|
||||
|
||||
#kWh From CT 13
|
||||
- platform: total_daily_energy
|
||||
name: ${ct13_name} ${kwh_label}
|
||||
id: ct13Kwh
|
||||
power_id: ct13Watts
|
||||
filters:
|
||||
- multiply: 0.001
|
||||
unit_of_measurement: kWh
|
||||
device_class: energy
|
||||
state_class: total_increasing
|
||||
|
||||
# kWh from CT 14
|
||||
- platform: total_daily_energy
|
||||
name: ${ct14_name} ${kwh_label}
|
||||
id: ct14Kwh
|
||||
power_id: ct14Watts
|
||||
filters:
|
||||
- multiply: 0.001
|
||||
unit_of_measurement: kWh
|
||||
device_class: energy
|
||||
state_class: total_increasing
|
||||
|
||||
#kWh From CT 15
|
||||
- platform: total_daily_energy
|
||||
name: ${ct15_name} ${kwh_label}
|
||||
id: ct15Kwh
|
||||
power_id: ct15Watts
|
||||
filters:
|
||||
- multiply: 0.001
|
||||
unit_of_measurement: kWh
|
||||
device_class: energy
|
||||
state_class: total_increasing
|
||||
|
||||
#kWh From CT 16
|
||||
- platform: total_daily_energy
|
||||
name: ${ct16_name} ${kwh_label}
|
||||
id: ct16Kwh
|
||||
power_id: ct16Watts
|
||||
filters:
|
||||
- multiply: 0.001
|
||||
unit_of_measurement: kWh
|
||||
device_class: energy
|
||||
state_class: total_increasing
|
||||
|
||||
#kWh From CT 17
|
||||
- platform: total_daily_energy
|
||||
name: ${ct17_name} ${kwh_label}
|
||||
id: ct17Kwh
|
||||
power_id: ct17Watts
|
||||
filters:
|
||||
- multiply: 0.001
|
||||
unit_of_measurement: kWh
|
||||
device_class: energy
|
||||
state_class: total_increasing
|
||||
|
||||
#kWh From CT 18
|
||||
- platform: total_daily_energy
|
||||
name: ${ct18_name} ${kwh_label}
|
||||
id: ct18Kwh
|
||||
power_id: ct18Watts
|
||||
filters:
|
||||
- multiply: 0.001
|
||||
unit_of_measurement: kWh
|
||||
device_class: energy
|
||||
state_class: total_increasing
|
||||
@@ -7,33 +7,45 @@ sensor:
|
||||
- platform: atm90e32
|
||||
release_device: true
|
||||
#if ESP32 has an LED for GPIO2, remove jumper or ESP32 from meter stack before programming via serial
|
||||
cs_pin: 2
|
||||
cs_pin: ${addon3_ic1}
|
||||
id: ${addon3_id1}
|
||||
phase_a:
|
||||
current:
|
||||
name: ${ct19_name} Amps
|
||||
name: ${ct19_name} ${amp_label}
|
||||
id: ct19Amps
|
||||
power:
|
||||
name: ${ct19_name} Watts
|
||||
name: ${ct19_name} ${watt_label}
|
||||
id: ct19Watts
|
||||
filters:
|
||||
- lambda: |-
|
||||
if (x < 0) return x * -1;
|
||||
return x;
|
||||
gain_voltage: ${voltage_cal1}
|
||||
gain_ct: ${current_cal_ct19}
|
||||
phase_b:
|
||||
current:
|
||||
name: ${ct20_name} Amps
|
||||
name: ${ct20_name} ${amp_label}
|
||||
id: ct20Amps
|
||||
power:
|
||||
name: ${ct20_name} Watts
|
||||
name: ${ct20_name} ${watt_label}
|
||||
id: ct20Watts
|
||||
filters:
|
||||
- lambda: |-
|
||||
if (x < 0) return x * -1;
|
||||
return x;
|
||||
gain_voltage: ${voltage_cal1}
|
||||
gain_ct: ${current_cal_ct20}
|
||||
phase_c:
|
||||
current:
|
||||
name: ${ct21_name} Amps
|
||||
name: ${ct21_name} ${amp_label}
|
||||
id: ct21Amps
|
||||
power:
|
||||
name: ${ct21_name} Watts
|
||||
name: ${ct21_name} ${watt_label}
|
||||
id: ct21Watts
|
||||
filters:
|
||||
- lambda: |-
|
||||
if (x < 0) return x * -1;
|
||||
return x;
|
||||
gain_voltage: ${voltage_cal1}
|
||||
gain_ct: ${current_cal_ct21}
|
||||
line_frequency: ${electric_freq}
|
||||
@@ -45,33 +57,45 @@ sensor:
|
||||
############
|
||||
- platform: atm90e32
|
||||
release_device: true
|
||||
cs_pin: 21
|
||||
cs_pin: ${addon3_ic2}
|
||||
id: ${addon3_id2}
|
||||
phase_a:
|
||||
current:
|
||||
name: ${ct22_name} Amps
|
||||
name: ${ct22_name} ${amp_label}
|
||||
id: ct22Amps
|
||||
power:
|
||||
name: ${ct22_name} Watts
|
||||
name: ${ct22_name} ${watt_label}
|
||||
id: ct22Watts
|
||||
filters:
|
||||
- lambda: |-
|
||||
if (x < 0) return x * -1;
|
||||
return x;
|
||||
gain_voltage: ${voltage_cal2}
|
||||
gain_ct: ${current_cal_ct22}
|
||||
phase_b:
|
||||
current:
|
||||
name: ${ct23_name} Amps
|
||||
name: ${ct23_name} ${amp_label}
|
||||
id: ct23Amps
|
||||
power:
|
||||
name: ${ct23_name} Watts
|
||||
name: ${ct23_name} ${watt_label}
|
||||
id: ct23Watts
|
||||
filters:
|
||||
- lambda: |-
|
||||
if (x < 0) return x * -1;
|
||||
return x;
|
||||
gain_voltage: ${voltage_cal2}
|
||||
gain_ct: ${current_cal_ct23}
|
||||
phase_c:
|
||||
current:
|
||||
name: ${ct24_name} Amps
|
||||
name: ${ct24_name} ${amp_label}
|
||||
id: ct24Amps
|
||||
power:
|
||||
name: ${ct24_name} Watts
|
||||
name: ${ct24_name} ${watt_label}
|
||||
id: ct24Watts
|
||||
filters:
|
||||
- lambda: |-
|
||||
if (x < 0) return x * -1;
|
||||
return x;
|
||||
gain_voltage: ${voltage_cal2}
|
||||
gain_ct: ${current_cal_ct24}
|
||||
line_frequency: ${electric_freq}
|
||||
@@ -80,9 +104,9 @@ sensor:
|
||||
enable_offset_calibration: ${offset_calibration}
|
||||
enable_gain_calibration: ${gain_calibration}
|
||||
|
||||
#Total Amps AddOn3
|
||||
#Total A AddOn3
|
||||
- platform: template
|
||||
name: ${friendly_name} Total Amps Add-on3
|
||||
name: Add-on 3 Total ${amp_label}
|
||||
id: totalAmpsAddOn3
|
||||
lambda: return id(ct19Amps).state + id(ct20Amps).state + id(ct21Amps).state + id(ct22Amps).state + id(ct23Amps).state + id(ct24Amps).state ;
|
||||
accuracy_decimals: 2
|
||||
@@ -90,12 +114,78 @@ sensor:
|
||||
device_class: current
|
||||
update_interval: ${update_time}
|
||||
|
||||
#Total Watts AddOn3
|
||||
#Total W AddOn3
|
||||
- platform: template
|
||||
name: ${friendly_name} Total Watts Add-on3
|
||||
name: Add-on 3 Total ${watt_label}
|
||||
id: totalWattsAddOn3
|
||||
lambda: return id(ct19Watts).state + id(ct20Watts).state + id(ct21Watts).state + id(ct22Watts).state + id(ct23Watts).state + id(ct24Watts).state ;
|
||||
accuracy_decimals: 2
|
||||
unit_of_measurement: W
|
||||
device_class: power
|
||||
update_interval: ${update_time}
|
||||
|
||||
#kWh From CT 19
|
||||
- platform: total_daily_energy
|
||||
name: ${ct19_name} ${kwh_label}
|
||||
id: ct19Kwh
|
||||
power_id: ct19Watts
|
||||
filters:
|
||||
- multiply: 0.001
|
||||
unit_of_measurement: kWh
|
||||
device_class: energy
|
||||
state_class: total_increasing
|
||||
|
||||
# kWh from CT 20
|
||||
- platform: total_daily_energy
|
||||
name: ${ct20_name} ${kwh_label}
|
||||
id: ct20Kwh
|
||||
power_id: ct20Watts
|
||||
filters:
|
||||
- multiply: 0.001
|
||||
unit_of_measurement: kWh
|
||||
device_class: energy
|
||||
state_class: total_increasing
|
||||
|
||||
#kWh From CT 21
|
||||
- platform: total_daily_energy
|
||||
name: ${ct21_name} ${kwh_label}
|
||||
id: ct21Kwh
|
||||
power_id: ct21Watts
|
||||
filters:
|
||||
- multiply: 0.001
|
||||
unit_of_measurement: kWh
|
||||
device_class: energy
|
||||
state_class: total_increasing
|
||||
|
||||
#kWh From CT 22
|
||||
- platform: total_daily_energy
|
||||
name: ${ct22_name} ${kwh_label}
|
||||
id: ct22Kwh
|
||||
power_id: ct22Watts
|
||||
filters:
|
||||
- multiply: 0.001
|
||||
unit_of_measurement: kWh
|
||||
device_class: energy
|
||||
state_class: total_increasing
|
||||
|
||||
#kWh From CT 23
|
||||
- platform: total_daily_energy
|
||||
name: ${ct23_name} ${kwh_label}
|
||||
id: ct23Kwh
|
||||
power_id: ct23Watts
|
||||
filters:
|
||||
- multiply: 0.001
|
||||
unit_of_measurement: kWh
|
||||
device_class: energy
|
||||
state_class: total_increasing
|
||||
|
||||
#kWh From CT 24
|
||||
- platform: total_daily_energy
|
||||
name: ${ct24_name} ${kwh_label}
|
||||
id: ct24Kwh
|
||||
power_id: ct24Watts
|
||||
filters:
|
||||
- multiply: 0.001
|
||||
unit_of_measurement: kWh
|
||||
device_class: energy
|
||||
state_class: total_increasing
|
||||
@@ -3,7 +3,7 @@ sensor:
|
||||
#########
|
||||
- platform: atm90e32
|
||||
release_device: true
|
||||
cs_pin: 5
|
||||
cs_pin: ${main_ic1}
|
||||
id: ${main_meter_id1}
|
||||
phase_a:
|
||||
voltage:
|
||||
@@ -11,35 +11,45 @@ sensor:
|
||||
id: ic1Volts
|
||||
accuracy_decimals: 1
|
||||
current:
|
||||
name: ${ct1_name} Amps
|
||||
name: ${ct1_name} ${amp_label}
|
||||
id: ct1Amps
|
||||
# The max value for current that the meter can output is 65.535. If you expect to measure current over 65A,
|
||||
# divide the gain_ct by 2 (120A CT) or 4 (200A CT) and multiply the current and power values by 2 or 4 by uncommenting the filter below
|
||||
# filters:
|
||||
# - multiply: 2
|
||||
power:
|
||||
name: ${ct1_name} Watts
|
||||
name: ${ct1_name} ${watt_label}
|
||||
id: ct1Watts
|
||||
# filters:
|
||||
# - multiply: 2
|
||||
filters:
|
||||
- lambda: |-
|
||||
if (x < 0) return x * -1;
|
||||
return x;
|
||||
gain_voltage: ${voltage_cal1}
|
||||
gain_ct: ${current_cal_ct1}
|
||||
phase_b:
|
||||
current:
|
||||
name: ${ct2_name} Amps
|
||||
name: ${ct2_name} ${amp_label}
|
||||
id: ct2Amps
|
||||
power:
|
||||
name: ${ct2_name} Watts
|
||||
name: ${ct2_name} ${watt_label}
|
||||
id: ct2Watts
|
||||
filters:
|
||||
- lambda: |-
|
||||
if (x < 0) return x * -1;
|
||||
return x;
|
||||
gain_voltage: ${voltage_cal1}
|
||||
gain_ct: ${current_cal_ct2}
|
||||
phase_c:
|
||||
current:
|
||||
name: ${ct3_name} Amps
|
||||
name: ${ct3_name} ${amp_label}
|
||||
id: ct3Amps
|
||||
power:
|
||||
name: ${ct3_name} Watts
|
||||
name: ${ct3_name} ${watt_label}
|
||||
id: ct3Watts
|
||||
filters:
|
||||
- lambda: |-
|
||||
if (x < 0) return x * -1;
|
||||
return x;
|
||||
gain_voltage: ${voltage_cal1}
|
||||
gain_ct: ${current_cal_ct3}
|
||||
frequency:
|
||||
@@ -55,7 +65,7 @@ sensor:
|
||||
##########
|
||||
- platform: atm90e32
|
||||
release_device: true
|
||||
cs_pin: 4
|
||||
cs_pin: ${main_ic2}
|
||||
id: ${main_meter_id2}
|
||||
phase_a:
|
||||
#this voltage is only needed if monitoring 2 voltages
|
||||
@@ -64,29 +74,41 @@ sensor:
|
||||
# id: ic2Volts
|
||||
# accuracy_decimals: 1
|
||||
current:
|
||||
name: ${ct4_name} Amps
|
||||
name: ${ct4_name} ${amp_label}
|
||||
id: ct4Amps
|
||||
power:
|
||||
name: ${ct4_name} Watts
|
||||
name: ${ct4_name} ${watt_label}
|
||||
id: ct4Watts
|
||||
filters:
|
||||
- lambda: |-
|
||||
if (x < 0) return x * -1;
|
||||
return x;
|
||||
gain_voltage: ${voltage_cal2}
|
||||
gain_ct: ${current_cal_ct4}
|
||||
phase_b:
|
||||
current:
|
||||
name: ${ct5_name} Amps
|
||||
name: ${ct5_name} ${amp_label}
|
||||
id: ct5Amps
|
||||
power:
|
||||
name: ${ct5_name} Watts
|
||||
name: ${ct5_name} ${watt_label}
|
||||
id: ct5Watts
|
||||
filters:
|
||||
- lambda: |-
|
||||
if (x < 0) return x * -1;
|
||||
return x;
|
||||
gain_voltage: ${voltage_cal2}
|
||||
gain_ct: ${current_cal_ct5}
|
||||
phase_c:
|
||||
current:
|
||||
name: ${ct6_name} Amps
|
||||
name: ${ct6_name} ${amp_label}
|
||||
id: ct6Amps
|
||||
power:
|
||||
name: ${ct6_name} Watts
|
||||
name: ${ct6_name} ${watt_label}
|
||||
id: ct6Watts
|
||||
filters:
|
||||
- lambda: |-
|
||||
if (x < 0) return x * -1;
|
||||
return x;
|
||||
gain_voltage: ${voltage_cal2}
|
||||
gain_ct: ${current_cal_ct6}
|
||||
#this is only needed if monitoring 2 voltages
|
||||
@@ -100,24 +122,90 @@ sensor:
|
||||
enable_offset_calibration: ${offset_calibration}
|
||||
enable_gain_calibration: ${gain_calibration}
|
||||
|
||||
#Total Amps Main
|
||||
#Total A Main
|
||||
################
|
||||
- platform: template
|
||||
name: ${friendly_name} Total Amps Main
|
||||
name: Mainboard Total ${amp_label}
|
||||
id: totalAmpsMain
|
||||
lambda: return id(ct1Amps).state + id(ct2Amps).state + id(ct3Amps).state + id(ct4Amps).state + id(ct5Amps).state + id(ct6Amps).state ;
|
||||
accuracy_decimals: 2
|
||||
unit_of_measurement: A
|
||||
device_class: current
|
||||
update_interval: ${update_time}
|
||||
|
||||
#Total Watts Main
|
||||
|
||||
#Total W Main
|
||||
#################
|
||||
- platform: template
|
||||
name: ${friendly_name} Total Watts Main
|
||||
name: Mainboard Total ${watt_label}
|
||||
id: totalWattsMain
|
||||
lambda: return id(ct1Watts).state + id(ct2Watts).state + id(ct3Watts).state + id(ct4Watts).state + id(ct5Watts).state + id(ct6Watts).state ;
|
||||
accuracy_decimals: 1
|
||||
unit_of_measurement: W
|
||||
device_class: power
|
||||
update_interval: ${update_time}
|
||||
|
||||
#kWh From CT 1
|
||||
- platform: total_daily_energy
|
||||
name: ${ct1_name} ${kwh_label}
|
||||
id: ct1Kwh
|
||||
power_id: ct1Watts
|
||||
filters:
|
||||
- multiply: 0.001
|
||||
unit_of_measurement: kWh
|
||||
device_class: energy
|
||||
state_class: total_increasing
|
||||
|
||||
# kWh from CT 2
|
||||
- platform: total_daily_energy
|
||||
name: ${ct2_name} ${kwh_label}
|
||||
id: ct2Kwh
|
||||
power_id: ct2Watts
|
||||
filters:
|
||||
- multiply: 0.001
|
||||
unit_of_measurement: kWh
|
||||
device_class: energy
|
||||
state_class: total_increasing
|
||||
|
||||
#kWh From CT 3
|
||||
- platform: total_daily_energy
|
||||
name: ${ct3_name} ${kwh_label}
|
||||
id: ct3Kwh
|
||||
power_id: ct3Watts
|
||||
filters:
|
||||
- multiply: 0.001
|
||||
unit_of_measurement: kWh
|
||||
device_class: energy
|
||||
state_class: total_increasing
|
||||
|
||||
#kWh From CT 4
|
||||
- platform: total_daily_energy
|
||||
name: ${ct4_name} ${kwh_label}
|
||||
id: ct4Kwh
|
||||
power_id: ct4Watts
|
||||
filters:
|
||||
- multiply: 0.001
|
||||
unit_of_measurement: kWh
|
||||
device_class: energy
|
||||
state_class: total_increasing
|
||||
|
||||
#kWh From CT 5
|
||||
- platform: total_daily_energy
|
||||
name: ${ct5_name} ${kwh_label}
|
||||
id: ct5Kwh
|
||||
power_id: ct5Watts
|
||||
filters:
|
||||
- multiply: 0.001
|
||||
unit_of_measurement: kWh
|
||||
device_class: energy
|
||||
state_class: total_increasing
|
||||
|
||||
#kWh From CT 6
|
||||
- platform: total_daily_energy
|
||||
name: ${ct6_name} ${kwh_label}
|
||||
id: ct6Kwh
|
||||
power_id: ct6Watts
|
||||
filters:
|
||||
- multiply: 0.001
|
||||
unit_of_measurement: kWh
|
||||
device_class: energy
|
||||
state_class: total_increasing
|
||||
@@ -11,7 +11,7 @@ logger:
|
||||
# Sync time with Home Assistant.
|
||||
time:
|
||||
- platform: homeassistant
|
||||
id: homeassistant_time
|
||||
id: local_homeassistant_time
|
||||
|
||||
# Enable Home Assistant API
|
||||
api:
|
||||
@@ -23,8 +23,12 @@ ota:
|
||||
- platform: esphome
|
||||
password: !secret ota-password
|
||||
|
||||
debug:
|
||||
update_interval: 10s
|
||||
|
||||
packages:
|
||||
binary_sensor: !include binary_sensor/status_sensor.config.yaml
|
||||
button: !include button/restart_button.config.yaml
|
||||
sensor: !include sensor/uptime_sensor.config.yaml
|
||||
debug: !include sensor/debug_sensor.config.yaml
|
||||
text_sensor: !include text_sensor/version_sensor.config.yaml
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
sensor:
|
||||
- platform: debug
|
||||
free:
|
||||
name: "Heap Free"
|
||||
id: heap_free_sensor
|
||||
entity_category: diagnostic
|
||||
loop_time:
|
||||
name: "Loop Time"
|
||||
id: loop_time_sensor
|
||||
entity_category: diagnostic
|
||||
@@ -8,6 +8,7 @@ sensor:
|
||||
|
||||
- platform: copy # Reports the WiFi signal strength in %
|
||||
source_id: local_wifi_signal_db
|
||||
id: local_wifi_signal_percent
|
||||
name: "WiFi Signal Strength"
|
||||
filters:
|
||||
- lambda: return min(max(2 * (x + 100.0), 0.0), 100.0);
|
||||
|
||||
@@ -3,17 +3,17 @@ text_sensor:
|
||||
ip_address:
|
||||
name: IP
|
||||
icon: mdi:ip
|
||||
update_interval: 60s
|
||||
# update_interval: 60s
|
||||
disabled_by_default: true
|
||||
ssid:
|
||||
name: SSID
|
||||
icon: mdi:lan
|
||||
update_interval: 60s
|
||||
# update_interval: 60s
|
||||
disabled_by_default: true
|
||||
bssid:
|
||||
name: BSSID
|
||||
disabled_by_default: true
|
||||
update_interval: 60s
|
||||
# update_interval: 60s
|
||||
icon: mdi:router-network
|
||||
mac_address:
|
||||
name: Wifi MAC Address
|
||||
|
||||
@@ -21,8 +21,6 @@ psram:
|
||||
packages:
|
||||
network: !include ../common/wifi.yaml
|
||||
|
||||
# captive_portal:
|
||||
|
||||
# wifi:
|
||||
# # Enable fast connect
|
||||
# fast_connect: true
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
esphome:
|
||||
captive_portal:
|
||||
|
||||
wifi:
|
||||
# Enable fast connect
|
||||
fast_connect: true
|
||||
min_auth_mode: WPA2
|
||||
use_address: ${devicename}.local
|
||||
#use_address: ${static_ip}
|
||||
|
||||
networks:
|
||||
- ssid: !secret wifi_ssid
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
esphome:
|
||||
captive_portal:
|
||||
|
||||
wifi:
|
||||
# Enable fast connect
|
||||
|
||||
+287
-745
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user