Working partial r2 df rename.

This commit is contained in:
2024-05-11 19:00:24 -07:00
parent 5f0119e89d
commit 9a2061cfe7

View File

@@ -3,23 +3,26 @@ substitutions:
dn: rack_2 dn: rack_2
sn: R2 sn: R2
friendly_name: Rack 2 friendly_name: Rack 2
duct_fan_pin: GPIO13 df_attic_pin: GPIO13
duct_fan_name: ${sn} Duct Fan Spd df_attic_name: ${friendly_name} Attic Duct Fan Spd
duct_fan_vent_spd_name: ${sn} DF Vent Spd df_attic_vent_spd_name: ${sn} DF Vent Spd
duct_fan_tgt_spd_out_name: ${sn} DF Tgt Spd Out df_attic_tgt_spd_out_name: ${sn} DF Tgt Spd Out
duct_fan_pwmfreq: 5000Hz df_attic_pwmfreq: 5000Hz
duct_fan_off_spd: "0.0" df_attic_off_spd: "0.0"
duct_fan_lo_spd: "1.0" df_attic_lo_spd: "1.0"
duct_fan_init_spd: "60.0" df_attic_init_spd: "60.0"
duct_fan_hi_spd: "100.0" df_attic_hi_spd: "100.0"
wall_fan_pwr_pin: GPIO21 df_attic_tach_pin: GPIO12
wall_fan_pwr_name: ${friendly_name} Wall Fan Power df_attic_tach_id: df_attic_tach_id
wall_fan_spd_pin: GPIO22 df_attic_tach_name: ${friendly_name} Attic Duct Fan Tach
wall_fan_spd_pwmfreq: 25000Hz # wall_fan_pwr_pin: GPIO21
wall_fan_spd_name: ${friendly_name} Wall Fan Speed # wall_fan_pwr_name: ${friendly_name} Wall Fan Power
wall_fan_tach_pin: GPIO23 # wall_fan_spd_pin: GPIO22
wall_fan_tach_id: wall_fan_tach_id # wall_fan_spd_pwmfreq: 25000Hz
wall_fan_tach_name: ${friendly_name} Wall Fan Tach # wall_fan_spd_name: ${friendly_name} Wall Fan Speed
# wall_fan_tach_pin: GPIO23
# wall_fan_tach_id: wall_fan_tach_id
# wall_fan_tach_name: ${friendly_name} Wall Fan Tach
dallas_pin: GPIO32 dallas_pin: GPIO32
dallas_in_addr: "0x1D02131D6063AA28" dallas_in_addr: "0x1D02131D6063AA28"
dallas_in_name: ${friendly_name} Temp In dallas_in_name: ${friendly_name} Temp In
@@ -28,15 +31,15 @@ substitutions:
dallas_update_interval: 30s dallas_update_interval: 30s
globals: globals:
- id: duct_fan_off_spd_id - id: df_attic_off_spd_id
type: float type: float
initial_value: ${duct_fan_off_spd} initial_value: ${df_attic_off_spd}
- id: duct_fan_lo_spd_id - id: df_attic_lo_spd_id
type: float type: float
initial_value: ${duct_fan_lo_spd} initial_value: ${df_attic_lo_spd}
- id: duct_fan_hi_spd_id - id: df_attic_hi_spd_id
type: float type: float
initial_value: ${duct_fan_hi_spd} initial_value: ${df_attic_hi_spd}
<<: !include .common.yaml <<: !include .common.yaml
<<: !include .wifi-oss.yaml <<: !include .wifi-oss.yaml
@@ -49,13 +52,13 @@ esphome:
- priority: 200.0 - priority: 200.0
then: then:
- output.set_level: - output.set_level:
id: duct_fan_output_id id: df_attic_output_id
level: ${duct_fan_init_spd}% level: ${df_attic_init_spd}%
switch: switch:
- platform: gpio # - platform: gpio
pin: ${wall_fan_pwr_pin} # pin: ${wall_fan_pwr_pin}
name: ${wall_fan_pwr_name} # name: ${wall_fan_pwr_name}
- platform: template - platform: template
name: Thermostat On name: Thermostat On
id: thermostat_on_id id: thermostat_on_id
@@ -63,24 +66,24 @@ switch:
output: output:
- platform: ledc - platform: ledc
pin: ${duct_fan_pin} pin: ${df_attic_pin}
id: duct_fan_output_id id: df_attic_output_id
channel: 0 channel: 0
frequency: ${duct_fan_pwmfreq} frequency: ${df_attic_pwmfreq}
- platform: ledc # - platform: ledc
pin: ${wall_fan_spd_pin} # pin: ${wall_fan_spd_pin}
id: wall_fan_spd_id # id: wall_fan_spd_id
channel: 2 # channel: 2
frequency: ${wall_fan_spd_pwmfreq} # frequency: ${wall_fan_spd_pwmfreq}
fan: fan:
- platform: speed - platform: speed
id: duct_fan_spd_id id: df_attic_spd_id
output: duct_fan_output_id output: df_attic_output_id
name: ${duct_fan_name} name: ${df_attic_name}
- platform: speed # - platform: speed
output: wall_fan_spd_id # output: wall_fan_spd_id
name: ${wall_fan_spd_name} # name: ${wall_fan_spd_name}
dallas: dallas:
- pin: - pin:
@@ -91,13 +94,22 @@ dallas:
sensor: sensor:
- platform: pulse_counter - platform: pulse_counter
pin: pin:
number: ${wall_fan_tach_pin} number: ${df_attic_tach_pin}
mode: INPUT_PULLUP mode: INPUT_PULLUP
unit_of_measurement: 'RPM' unit_of_measurement: 'RPM'
name: ${wall_fan_tach_name} name: ${df_attic_tach_name}
update_interval: 10s update_interval: 10s
filters: filters:
- multiply: 0.5 - multiply: 0.5
# - platform: pulse_counter
# pin:
# number: ${wall_fan_tach_pin}
# mode: INPUT_PULLUP
# unit_of_measurement: 'RPM'
# name: ${wall_fan_tach_name}
# update_interval: 10s
# filters:
# - multiply: 0.5
- platform: dallas - platform: dallas
address: ${dallas_in_addr} address: ${dallas_in_addr}
name: ${dallas_in_name} name: ${dallas_in_name}
@@ -114,18 +126,18 @@ binary_sensor:
number: number:
- platform: template - platform: template
id: duct_fan_vent_spd_id id: df_attic_vent_spd_id
name: ${duct_fan_vent_spd_name} name: ${df_attic_vent_spd_name}
optimistic: true optimistic: true
min_value: ${duct_fan_lo_spd} min_value: ${df_attic_lo_spd}
max_value: ${duct_fan_hi_spd} max_value: ${df_attic_hi_spd}
step: 10 step: 10
initial_value: ${duct_fan_init_spd} initial_value: ${df_attic_init_spd}
- platform: template - platform: template
id: duct_fan_tgt_spd_out id: df_attic_tgt_spd_out
name: ${duct_fan_tgt_spd_out_name} name: ${df_attic_tgt_spd_out_name}
min_value: ${duct_fan_off_spd} min_value: ${df_attic_off_spd}
max_value: ${duct_fan_hi_spd} max_value: ${df_attic_hi_spd}
step: 1 step: 1
set_action: set_action:
then: then:
@@ -141,17 +153,17 @@ number:
lo_temp = id(thermostat_out_id).target_temperature_low; lo_temp = id(thermostat_out_id).target_temperature_low;
hi_temp = id(thermostat_out_id).target_temperature_high; hi_temp = id(thermostat_out_id).target_temperature_high;
curtemp = id(dallas_out_id).state; curtemp = id(dallas_out_id).state;
off_spd = id(duct_fan_off_spd_id); off_spd = id(df_attic_off_spd_id);
lo_spd = id(duct_fan_lo_spd_id); lo_spd = id(df_attic_lo_spd_id);
vent_spd = id(duct_fan_vent_spd_id).state; vent_spd = id(df_attic_vent_spd_id).state;
hi_spd = id(duct_fan_hi_spd_id); hi_spd = id(df_attic_hi_spd_id);
ESP_LOGD("fan_speed", "DEBUG Ventilate House: %d", id(ventilate_house).state); ESP_LOGD("fan_speed", "DEBUG Ventilate House: %d", id(ventilate_house).state);
ESP_LOGD("fan_speed", "DEBUG Current Temp: %f", curtemp); ESP_LOGD("fan_speed", "DEBUG Current Temp: %f", curtemp);
ESP_LOGD("fan_speed", "DEBUG Thermostat State: %d", id(thermostat_on_id).state); ESP_LOGD("fan_speed", "DEBUG Thermostat State: %d", id(thermostat_on_id).state);
if ((id(ventilate_house).state == false) && if ((id(ventilate_house).state == false) &&
((curtemp < lo_temp) || (id(thermostat_on_id).state == false))) { ((curtemp < lo_temp) || (id(thermostat_on_id).state == false))) {
ESP_LOGD("fan_speed", "DEBUG turning off"); ESP_LOGD("fan_speed", "DEBUG turning off");
auto call = id(duct_fan_spd_id).turn_off(); auto call = id(df_attic_spd_id).turn_off();
call.perform(); call.perform();
return off_spd; return off_spd;
} }
@@ -169,12 +181,12 @@ number:
} }
if (newspd < lo_spd) { if (newspd < lo_spd) {
ESP_LOGD("fan_speed", "DEBUG New Speed under lo_spd, turning off"); ESP_LOGD("fan_speed", "DEBUG New Speed under lo_spd, turning off");
auto call = id(duct_fan_spd_id).turn_off(); auto call = id(df_attic_spd_id).turn_off();
call.perform(); call.perform();
return off_spd; return off_spd;
} }
ESP_LOGD("fan_speed", "DEBUG Setting fan to newspd: %f", newspd); ESP_LOGD("fan_speed", "DEBUG Setting fan to newspd: %f", newspd);
auto call = id(duct_fan_spd_id).turn_on(); auto call = id(df_attic_spd_id).turn_on();
call.set_speed(newspd); call.set_speed(newspd);
call.perform(); call.perform();
return newspd; return newspd;