Working with both duct fans.
This commit is contained in:
@@ -3,10 +3,12 @@ substitutions:
|
|||||||
dn: rack_2
|
dn: rack_2
|
||||||
sn: R2
|
sn: R2
|
||||||
friendly_name: Rack 2
|
friendly_name: Rack 2
|
||||||
|
ts_wants_name: ${friendly_name} Thermostat Wants
|
||||||
|
|
||||||
df_attic_pin: GPIO13
|
df_attic_pin: GPIO13
|
||||||
df_attic_name: ${friendly_name} Attic Duct Fan Spd
|
df_attic_name: ${friendly_name} Attic Duct Fan
|
||||||
df_attic_vent_spd_name: ${sn} DF Vent Spd
|
df_attic_ovrr_spd_name: ${friendly_name} Attic Duct Fan Override Spd
|
||||||
df_attic_tgt_spd_out_name: ${sn} DF Tgt Spd Out
|
df_attic_ovrr_sw_name: ${friendly_name} Attic Duct Fan Override
|
||||||
df_attic_pwmfreq: 5000Hz
|
df_attic_pwmfreq: 5000Hz
|
||||||
df_attic_off_spd: "0.0"
|
df_attic_off_spd: "0.0"
|
||||||
df_attic_lo_spd: "1.0"
|
df_attic_lo_spd: "1.0"
|
||||||
@@ -15,6 +17,24 @@ substitutions:
|
|||||||
df_attic_tach_pin: GPIO12
|
df_attic_tach_pin: GPIO12
|
||||||
df_attic_tach_id: df_attic_tach_id
|
df_attic_tach_id: df_attic_tach_id
|
||||||
df_attic_tach_name: ${friendly_name} Attic Duct Fan Tach
|
df_attic_tach_name: ${friendly_name} Attic Duct Fan Tach
|
||||||
|
# AC Infiniti S8 seems to get up to 9300, so lets divide by 100
|
||||||
|
df_attic_tach_multiplier: "0.01"
|
||||||
|
|
||||||
|
df_lndry_pin: GPIO19
|
||||||
|
df_lndry_name: ${friendly_name} Laundry Duct Fan
|
||||||
|
df_lndry_ovrr_spd_name: ${friendly_name} Laundry Duct Fan Override Spd
|
||||||
|
df_lndry_ovrr_sw_name: ${friendly_name} Laundry Duct Fan Override
|
||||||
|
df_lndry_pwmfreq: 5000Hz
|
||||||
|
df_lndry_off_spd: "0.0"
|
||||||
|
df_lndry_lo_spd: "20.0"
|
||||||
|
df_lndry_init_spd: "40.0"
|
||||||
|
df_lndry_hi_spd: "100.0"
|
||||||
|
df_lndry_tach_pin: GPIO18
|
||||||
|
df_lndry_tach_id: df_lndry_tach_id
|
||||||
|
df_lndry_tach_name: ${friendly_name} Laundry Duct Fan Tach
|
||||||
|
# AC Infiniti S6 seems to get up to 43,000 at 90% so lets divide by 500
|
||||||
|
df_lndry_tach_multiplier: "0.002"
|
||||||
|
|
||||||
# wall_fan_pwr_pin: GPIO21
|
# wall_fan_pwr_pin: GPIO21
|
||||||
# wall_fan_pwr_name: ${friendly_name} Wall Fan Power
|
# wall_fan_pwr_name: ${friendly_name} Wall Fan Power
|
||||||
# wall_fan_spd_pin: GPIO22
|
# wall_fan_spd_pin: GPIO22
|
||||||
@@ -40,6 +60,15 @@ globals:
|
|||||||
- id: df_attic_hi_spd_id
|
- id: df_attic_hi_spd_id
|
||||||
type: float
|
type: float
|
||||||
initial_value: ${df_attic_hi_spd}
|
initial_value: ${df_attic_hi_spd}
|
||||||
|
- id: df_lndry_off_spd_id
|
||||||
|
type: float
|
||||||
|
initial_value: ${df_lndry_off_spd}
|
||||||
|
- id: df_lndry_lo_spd_id
|
||||||
|
type: float
|
||||||
|
initial_value: ${df_lndry_lo_spd}
|
||||||
|
- id: df_lndry_hi_spd_id
|
||||||
|
type: float
|
||||||
|
initial_value: ${df_lndry_hi_spd}
|
||||||
|
|
||||||
<<: !include .common.yaml
|
<<: !include .common.yaml
|
||||||
<<: !include .wifi-oss.yaml
|
<<: !include .wifi-oss.yaml
|
||||||
@@ -51,18 +80,12 @@ esphome:
|
|||||||
on_boot:
|
on_boot:
|
||||||
- priority: 200.0
|
- priority: 200.0
|
||||||
then:
|
then:
|
||||||
|
# - output.set_level:
|
||||||
|
# id: df_attic_output_id
|
||||||
|
# level: ${df_attic_init_spd}%
|
||||||
- output.set_level:
|
- output.set_level:
|
||||||
id: df_attic_output_id
|
id: df_lndry_output_id
|
||||||
level: ${df_attic_init_spd}%
|
level: ${df_lndry_init_spd}%
|
||||||
|
|
||||||
switch:
|
|
||||||
# - platform: gpio
|
|
||||||
# pin: ${wall_fan_pwr_pin}
|
|
||||||
# name: ${wall_fan_pwr_name}
|
|
||||||
- platform: template
|
|
||||||
name: Thermostat On
|
|
||||||
id: thermostat_on_id
|
|
||||||
optimistic: true
|
|
||||||
|
|
||||||
output:
|
output:
|
||||||
- platform: ledc
|
- platform: ledc
|
||||||
@@ -70,6 +93,11 @@ output:
|
|||||||
id: df_attic_output_id
|
id: df_attic_output_id
|
||||||
channel: 0
|
channel: 0
|
||||||
frequency: ${df_attic_pwmfreq}
|
frequency: ${df_attic_pwmfreq}
|
||||||
|
- platform: ledc
|
||||||
|
pin: ${df_lndry_pin}
|
||||||
|
id: df_lndry_output_id
|
||||||
|
channel: 2
|
||||||
|
frequency: ${df_lndry_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
|
||||||
@@ -81,6 +109,10 @@ fan:
|
|||||||
id: df_attic_spd_id
|
id: df_attic_spd_id
|
||||||
output: df_attic_output_id
|
output: df_attic_output_id
|
||||||
name: ${df_attic_name}
|
name: ${df_attic_name}
|
||||||
|
- platform: speed
|
||||||
|
id: df_lndry_spd_id
|
||||||
|
output: df_lndry_output_id
|
||||||
|
name: ${df_lndry_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}
|
||||||
@@ -96,11 +128,20 @@ sensor:
|
|||||||
pin:
|
pin:
|
||||||
number: ${df_attic_tach_pin}
|
number: ${df_attic_tach_pin}
|
||||||
mode: INPUT_PULLUP
|
mode: INPUT_PULLUP
|
||||||
unit_of_measurement: 'RPM'
|
unit_of_measurement: '%'
|
||||||
name: ${df_attic_tach_name}
|
name: ${df_attic_tach_name}
|
||||||
update_interval: 10s
|
update_interval: 10s
|
||||||
filters:
|
filters:
|
||||||
- multiply: 0.5
|
- multiply: ${df_attic_tach_multiplier}
|
||||||
|
- platform: pulse_counter
|
||||||
|
pin:
|
||||||
|
number: ${df_lndry_tach_pin}
|
||||||
|
mode: INPUT_PULLUP
|
||||||
|
unit_of_measurement: '%'
|
||||||
|
name: ${df_lndry_tach_name}
|
||||||
|
update_interval: 10s
|
||||||
|
filters:
|
||||||
|
- multiply: ${df_lndry_tach_multiplier}
|
||||||
# - platform: pulse_counter
|
# - platform: pulse_counter
|
||||||
# pin:
|
# pin:
|
||||||
# number: ${wall_fan_tach_pin}
|
# number: ${wall_fan_tach_pin}
|
||||||
@@ -123,78 +164,173 @@ binary_sensor:
|
|||||||
name: "Ventilate House"
|
name: "Ventilate House"
|
||||||
entity_id: binary_sensor.ventilate_house
|
entity_id: binary_sensor.ventilate_house
|
||||||
id: ventilate_house
|
id: ventilate_house
|
||||||
|
- platform: homeassistant
|
||||||
|
name: "Windows Open"
|
||||||
|
entity_id: binary_sensor.windows_open
|
||||||
|
id: windows_open
|
||||||
|
|
||||||
|
switch:
|
||||||
|
# - platform: gpio
|
||||||
|
# pin: ${wall_fan_pwr_pin}
|
||||||
|
# name: ${wall_fan_pwr_name}
|
||||||
|
- platform: template
|
||||||
|
name: ${df_attic_ovrr_sw_name}
|
||||||
|
id: df_attic_ovrr
|
||||||
|
optimistic: true
|
||||||
|
on_turn_on:
|
||||||
|
then:
|
||||||
|
lambda: |-
|
||||||
|
ESP_LOGD("speed_fan", "Setting Attic Fan per Override: %f", id(df_attic_ovrr_spd_id).state);
|
||||||
|
auto call = id(df_attic_spd_id).turn_on();
|
||||||
|
call.set_speed(id(df_attic_ovrr_spd_id).state);
|
||||||
|
call.perform();
|
||||||
|
on_turn_off:
|
||||||
|
then:
|
||||||
|
- logger.log: "Attic Fan Override turned off."
|
||||||
|
- fan.turn_off: df_attic_spd_id
|
||||||
|
- platform: template
|
||||||
|
name: ${df_lndry_ovrr_sw_name}
|
||||||
|
id: df_lndry_ovrr
|
||||||
|
optimistic: true
|
||||||
|
on_turn_on:
|
||||||
|
then:
|
||||||
|
lambda: |-
|
||||||
|
ESP_LOGD("speed_fan", "Setting Laundry Fan per Override: %f", id(df_attic_ovrr_spd_id).state);
|
||||||
|
auto call = id(df_lndry_spd_id).turn_on();
|
||||||
|
call.set_speed(id(df_lndry_ovrr_spd_id).state);
|
||||||
|
call.perform();
|
||||||
|
on_turn_off:
|
||||||
|
then:
|
||||||
|
- logger.log: "Laundry Fan Override turned off."
|
||||||
|
- fan.turn_off: df_lndry_spd_id
|
||||||
|
|
||||||
number:
|
number:
|
||||||
- platform: template
|
- platform: template
|
||||||
id: df_attic_vent_spd_id
|
id: df_attic_ovrr_spd_id
|
||||||
name: ${df_attic_vent_spd_name}
|
name: ${df_attic_ovrr_spd_name}
|
||||||
optimistic: true
|
optimistic: true
|
||||||
min_value: ${df_attic_lo_spd}
|
min_value: 0.0
|
||||||
max_value: ${df_attic_hi_spd}
|
max_value: ${df_attic_hi_spd}
|
||||||
step: 10
|
step: 10
|
||||||
initial_value: ${df_attic_init_spd}
|
initial_value: ${df_attic_init_spd}
|
||||||
- platform: template
|
on_value:
|
||||||
id: df_attic_tgt_spd_out
|
then:
|
||||||
name: ${df_attic_tgt_spd_out_name}
|
if:
|
||||||
min_value: ${df_attic_off_spd}
|
condition:
|
||||||
max_value: ${df_attic_hi_spd}
|
switch.is_on: df_attic_ovrr
|
||||||
step: 1
|
|
||||||
set_action:
|
|
||||||
then:
|
then:
|
||||||
lambda: |-
|
lambda: |-
|
||||||
|
auto call = id(df_attic_spd_id).turn_on();
|
||||||
|
call.set_speed(x);
|
||||||
|
call.perform();
|
||||||
|
- platform: template
|
||||||
|
id: df_lndry_ovrr_spd_id
|
||||||
|
name: ${df_lndry_ovrr_spd_name}
|
||||||
|
optimistic: true
|
||||||
|
min_value: 0.0
|
||||||
|
max_value: ${df_lndry_hi_spd}
|
||||||
|
step: 10
|
||||||
|
initial_value: ${df_lndry_init_spd}
|
||||||
|
on_value:
|
||||||
|
then:
|
||||||
|
if:
|
||||||
|
condition:
|
||||||
|
switch.is_on: df_lndry_ovrr
|
||||||
|
then:
|
||||||
|
lambda: |-
|
||||||
|
auto call = id(df_lndry_spd_id).turn_on();
|
||||||
|
call.set_speed(x);
|
||||||
|
call.perform();
|
||||||
|
- platform: template
|
||||||
|
id: ts_wants_id
|
||||||
|
name: ${ts_wants_name}
|
||||||
|
optimistic: true
|
||||||
|
min_value: 0
|
||||||
|
max_value: 100
|
||||||
|
step: 1
|
||||||
|
|
||||||
|
time:
|
||||||
|
platform: sntp
|
||||||
|
on_time:
|
||||||
|
- seconds: /10
|
||||||
|
then:
|
||||||
|
- logger.log: "...on_time..."
|
||||||
|
- number.set:
|
||||||
|
id: ts_wants_id
|
||||||
|
value: !lambda |-
|
||||||
float lo_temp;
|
float lo_temp;
|
||||||
float hi_temp;
|
float hi_temp;
|
||||||
float curtemp;
|
float curtemp;
|
||||||
float off_spd;
|
float newpct;
|
||||||
float lo_spd;
|
|
||||||
float vent_spd;
|
|
||||||
float hi_spd;
|
|
||||||
float newspd;
|
|
||||||
lo_temp = id(thermostat_out_id).target_temperature_low;
|
|
||||||
hi_temp = id(thermostat_out_id).target_temperature_high;
|
|
||||||
curtemp = id(dallas_out_id).state;
|
curtemp = id(dallas_out_id).state;
|
||||||
off_spd = id(df_attic_off_spd_id);
|
lo_temp = id(ts_out_id).target_temperature_low;
|
||||||
|
hi_temp = id(ts_out_id).target_temperature_high;
|
||||||
|
newpct = ((curtemp - lo_temp) / (hi_temp - lo_temp)) * 100;
|
||||||
|
if (newpct < 0) {
|
||||||
|
newpct = 0;
|
||||||
|
}
|
||||||
|
if (newpct > 100) {
|
||||||
|
newpct = 100;
|
||||||
|
}
|
||||||
|
ESP_LOGD("cron", "DEBUG Thermostat Wants percent: %f", newpct);
|
||||||
|
return newpct;
|
||||||
|
- if:
|
||||||
|
condition:
|
||||||
|
and:
|
||||||
|
- binary_sensor.is_on: ventilate_house
|
||||||
|
- switch.is_off: df_attic_ovrr
|
||||||
|
then:
|
||||||
|
# Set Attic fan to at least Ventilate Speed
|
||||||
|
# Turn Laundry fan off
|
||||||
|
- lambda: |-
|
||||||
|
float lo_spd;
|
||||||
|
float hi_spd;
|
||||||
|
float ovrr_spd;
|
||||||
|
float ts_wants_pct;
|
||||||
|
float ts_wants_spd;
|
||||||
|
float new_spd;
|
||||||
lo_spd = id(df_attic_lo_spd_id);
|
lo_spd = id(df_attic_lo_spd_id);
|
||||||
vent_spd = id(df_attic_vent_spd_id).state;
|
|
||||||
hi_spd = id(df_attic_hi_spd_id);
|
hi_spd = id(df_attic_hi_spd_id);
|
||||||
ESP_LOGD("fan_speed", "DEBUG Ventilate House: %d", id(ventilate_house).state);
|
ovrr_spd = id(df_attic_ovrr_spd_id).state;
|
||||||
ESP_LOGD("fan_speed", "DEBUG Current Temp: %f", curtemp);
|
ts_wants_pct = id(ts_wants_id).state;
|
||||||
ESP_LOGD("fan_speed", "DEBUG Thermostat State: %d", id(thermostat_on_id).state);
|
ts_wants_spd = lo_spd + ((hi_spd - lo_spd) * ts_wants_pct / 100);
|
||||||
if ((id(ventilate_house).state == false) &&
|
ESP_LOGD("cron", "DEBUG Thermostat Wants Attic Fan Speed: %f", ts_wants_spd);
|
||||||
((curtemp < lo_temp) || (id(thermostat_on_id).state == false))) {
|
ESP_LOGD("cron", "DEBUG Ventilate Wants Attic Fan Speed: %f", ovrr_spd);
|
||||||
ESP_LOGD("fan_speed", "DEBUG turning off");
|
if (ovrr_spd > ts_wants_spd) {
|
||||||
auto call = id(df_attic_spd_id).turn_off();
|
new_spd = ovrr_spd;
|
||||||
call.perform();
|
|
||||||
return off_spd;
|
|
||||||
}
|
|
||||||
if (curtemp > hi_temp) {
|
|
||||||
ESP_LOGD("fan_speed", "DEBUG curtemp > hi_temp");
|
|
||||||
newspd = hi_spd;
|
|
||||||
} else {
|
} else {
|
||||||
// Set newspd to same linear proportion of spd range as current temp is of temp range
|
new_spd = ts_wants_spd;
|
||||||
newspd = lo_spd + ((hi_spd - lo_spd) * (curtemp - lo_temp) / (hi_temp - lo_temp));
|
|
||||||
ESP_LOGD("fan_speed", "DEBUG New Speed set: %f", newspd);
|
|
||||||
}
|
}
|
||||||
if ((id(ventilate_house).state == true) && (newspd < vent_spd)) {
|
ESP_LOGD("cron", "DEBUG Setting Attic Fan Speed: %f", new_spd);
|
||||||
newspd = vent_spd;
|
|
||||||
ESP_LOGD("fan_speed", "DEBUG New Speed changed to Vent Speed: %f", newspd);
|
|
||||||
}
|
|
||||||
if (newspd < lo_spd) {
|
|
||||||
ESP_LOGD("fan_speed", "DEBUG New Speed under lo_spd, turning off");
|
|
||||||
auto call = id(df_attic_spd_id).turn_off();
|
|
||||||
call.perform();
|
|
||||||
return off_spd;
|
|
||||||
}
|
|
||||||
ESP_LOGD("fan_speed", "DEBUG Setting fan to newspd: %f", newspd);
|
|
||||||
auto call = id(df_attic_spd_id).turn_on();
|
auto call = id(df_attic_spd_id).turn_on();
|
||||||
call.set_speed(newspd);
|
call.set_speed(new_spd);
|
||||||
|
call.perform();
|
||||||
|
- if:
|
||||||
|
condition:
|
||||||
|
and:
|
||||||
|
- binary_sensor.is_off: ventilate_house
|
||||||
|
- switch.is_off: df_lndry_ovrr
|
||||||
|
then:
|
||||||
|
# Set Laundry fan per thermostat
|
||||||
|
- lambda: |-
|
||||||
|
float lo_spd;
|
||||||
|
float hi_spd;
|
||||||
|
float ts_wants_pct;
|
||||||
|
float ts_wants_spd;
|
||||||
|
lo_spd = id(df_lndry_lo_spd_id);
|
||||||
|
hi_spd = id(df_lndry_hi_spd_id);
|
||||||
|
ts_wants_pct = id(ts_wants_id).state;
|
||||||
|
ts_wants_spd = lo_spd + ((hi_spd - lo_spd) * ts_wants_pct / 100);
|
||||||
|
ESP_LOGD("cron", "DEBUG Thermostat Wants Laundry Fan Speed: %f", ts_wants_spd);
|
||||||
|
ESP_LOGD("cron", "DEBUG Setting Laundry Fan Speed: %f", ts_wants_spd);
|
||||||
|
auto call = id(df_lndry_spd_id).turn_on();
|
||||||
|
call.set_speed(ts_wants_spd);
|
||||||
call.perform();
|
call.perform();
|
||||||
return newspd;
|
|
||||||
|
|
||||||
# Dual-point thermostat
|
# Dual-point thermostat
|
||||||
climate:
|
climate:
|
||||||
- platform: thermostat
|
- platform: thermostat
|
||||||
id: thermostat_out_id
|
id: ts_out_id
|
||||||
name: ${friendly_name} Out
|
name: ${friendly_name} Out
|
||||||
sensor: dallas_out_id
|
sensor: dallas_out_id
|
||||||
visual:
|
visual:
|
||||||
@@ -204,6 +340,7 @@ climate:
|
|||||||
default_preset: Default
|
default_preset: Default
|
||||||
preset:
|
preset:
|
||||||
- name: Default
|
- name: Default
|
||||||
|
mode: auto
|
||||||
default_target_temperature_low: 75 °F
|
default_target_temperature_low: 75 °F
|
||||||
default_target_temperature_high: 100 °F
|
default_target_temperature_high: 100 °F
|
||||||
min_cooling_off_time: 60s
|
min_cooling_off_time: 60s
|
||||||
@@ -213,11 +350,27 @@ climate:
|
|||||||
min_idle_time: 60s
|
min_idle_time: 60s
|
||||||
heat_action:
|
heat_action:
|
||||||
- logger.log: "Turning off ${friendly_name} Thermostat"
|
- logger.log: "Turning off ${friendly_name} Thermostat"
|
||||||
- switch.turn_off: thermostat_on_id
|
- number.set:
|
||||||
|
id: ts_wants_id
|
||||||
|
value: 0
|
||||||
idle_action:
|
idle_action:
|
||||||
- logger.log: "Turning on ${friendly_name} Thermostat"
|
- logger.log: "Turning on ${friendly_name} Thermostat"
|
||||||
- switch.turn_on: thermostat_on_id
|
- number.set:
|
||||||
|
id: ts_wants_id
|
||||||
|
value: !lambda |-
|
||||||
|
float lo_temp;
|
||||||
|
float hi_temp;
|
||||||
|
float curtemp;
|
||||||
|
float newpct;
|
||||||
|
curtemp = id(dallas_out_id).state;
|
||||||
|
lo_temp = id(ts_out_id).target_temperature_low;
|
||||||
|
hi_temp = id(ts_out_id).target_temperature_high;
|
||||||
|
newpct = ((curtemp - lo_temp) / (hi_temp - lo_temp)) * 100;
|
||||||
|
ESP_LOGD("thermostat", "DEBUG Thermostat Wants: %f", newpct);
|
||||||
|
return newpct;
|
||||||
cool_action:
|
cool_action:
|
||||||
- logger.log: "WARNING: ${friendly_name} Thermostat has hit high temp!"
|
- logger.log: "WARNING: ${friendly_name} Thermostat has hit high temp!"
|
||||||
- switch.turn_on: thermostat_on_id
|
- number.set:
|
||||||
|
id: ts_wants_id
|
||||||
|
value: 100
|
||||||
#TODO - provide some kind of warning / action here
|
#TODO - provide some kind of warning / action here
|
||||||
|
|||||||
Reference in New Issue
Block a user