Add fan per thermostat functionlity.
This commit is contained in:
186
projector_3.yaml
186
projector_3.yaml
@@ -1,37 +1,52 @@
|
||||
substitutions:
|
||||
duct_fan_pin: GPIO14
|
||||
duct_fan_id: duct_fan_id
|
||||
duct_fan_pwmfreq: 5000Hz
|
||||
duct_fan_spd_id: duct_fan_spd_id
|
||||
duct_fan_spd_name: pj_3_duct_fan_spd
|
||||
# heat_pin: GPIO19
|
||||
# heat_name: "Denon Pwr"
|
||||
duct_fan_pin: GPIO14
|
||||
duct_fan_spd_name: Prj3 Duct Fan Speed
|
||||
duct_fan_spd_target_in_name: Prj3 Duct Fan Target Speed In
|
||||
duct_fan_spd_target_out_name: Prj3 Duct Fan Target Speed Out
|
||||
duct_fan_pwmfreq: 5000Hz
|
||||
duct_fan_off_spd: "0.0"
|
||||
duct_fan_lo_spd: "10.0"
|
||||
duct_fan_hi_spd: "100.0"
|
||||
prjpwr_pin: GPIO19
|
||||
prjpwr_name: Prj3 Pwr
|
||||
dallas_pin: GPIO32
|
||||
dallas_1_addr: "0x1F3C01D0756F0928"
|
||||
dallas_1_name: pj_3_temp_cold
|
||||
dallas_2_addr: "0x873C01D0756D4B28"
|
||||
dallas_2_name: pj_3_temp_prj_exh
|
||||
dallas_3_addr: "0xA901143295610E28"
|
||||
dallas_3_name: pj_3_temp_box_exh
|
||||
dallas_in_addr: "0x1F3C01D0756F0928"
|
||||
dallas_in_name: Prj3 Temp In
|
||||
dallas_prj_addr: "0x873C01D0756D4B28"
|
||||
dallas_prj_name: Prj3 Temp Prj
|
||||
dallas_out_addr: "0xA901143295610E28"
|
||||
dallas_out_name: Prj3 Temp Out
|
||||
dallas_update_interval: 30s
|
||||
|
||||
globals:
|
||||
- id: duct_fan_off_spd
|
||||
type: float
|
||||
initial_value: ${duct_fan_off_spd}
|
||||
- id: duct_fan_lo_spd
|
||||
type: float
|
||||
initial_value: ${duct_fan_lo_spd}
|
||||
- id: duct_fan_hi_spd
|
||||
type: float
|
||||
initial_value: ${duct_fan_hi_spd}
|
||||
|
||||
esphome:
|
||||
name: pj_3
|
||||
name: prj3
|
||||
platform: ESP32
|
||||
board: esp32doit-devkit-v1
|
||||
board: esp32doit-devkit-v1
|
||||
|
||||
wifi:
|
||||
ssid: "kungle-oss"
|
||||
password: "hcfU8@gG&8Hm"
|
||||
ssid: "kungle-oss"
|
||||
password: "hcfU8@gG&8Hm"
|
||||
fast_connect: true
|
||||
|
||||
manual_ip:
|
||||
static_ip: 192.168.35.192
|
||||
gateway: 192.168.35.1
|
||||
subnet: 255.255.255.0
|
||||
gateway: 192.168.35.1
|
||||
subnet: 255.255.255.0
|
||||
|
||||
# Enable fallback hotspot (captive portal) in case wifi connection fails
|
||||
ap:
|
||||
ssid: "Projector 3 Fallback Hotspot"
|
||||
ssid: "Prj3 Fallback Hotspot"
|
||||
password: "xfPfYSP3N0C3"
|
||||
|
||||
captive_portal:
|
||||
@@ -44,63 +59,116 @@ api:
|
||||
|
||||
ota:
|
||||
|
||||
switch:
|
||||
- platform: template
|
||||
name: Thermostat On
|
||||
id: thermostat_on_id
|
||||
optimistic: true
|
||||
|
||||
output:
|
||||
- platform: ledc
|
||||
pin: ${duct_fan_pin}
|
||||
id: ${duct_fan_id}
|
||||
id: duct_fan_output_id
|
||||
frequency: ${duct_fan_pwmfreq}
|
||||
|
||||
fan:
|
||||
- platform: speed
|
||||
id: ${duct_fan_spd_id}
|
||||
output: ${duct_fan_id}
|
||||
id: duct_fan_spd_id
|
||||
output: duct_fan_output_id
|
||||
name: ${duct_fan_spd_name}
|
||||
# speed:
|
||||
# low: 0.2
|
||||
# medium: 0.6
|
||||
# high: 1.0
|
||||
|
||||
dallas:
|
||||
- pin:
|
||||
number: ${dallas_pin}
|
||||
mode: INPUT_PULLUP
|
||||
update_interval: 10s
|
||||
update_interval: ${dallas_update_interval}
|
||||
|
||||
sensor:
|
||||
- platform: dallas
|
||||
address: ${dallas_1_addr}
|
||||
name: ${dallas_1_name}
|
||||
address: ${dallas_in_addr}
|
||||
name: ${dallas_in_name}
|
||||
id: dallas_in_id
|
||||
- platform: dallas
|
||||
address: ${dallas_2_addr}
|
||||
name: ${dallas_2_name}
|
||||
address: ${dallas_prj_addr}
|
||||
name: ${dallas_prj_name}
|
||||
id: dallas_prj_id
|
||||
- platform: dallas
|
||||
address: ${dallas_3_addr}
|
||||
name: ${dallas_3_name}
|
||||
address: ${dallas_out_addr}
|
||||
name: ${dallas_out_name}
|
||||
id: dallas_out_id
|
||||
|
||||
# # Sense when receiver is turned on
|
||||
# binary_sensor:
|
||||
# - platform: gpio
|
||||
# pin: ${heat_pin}
|
||||
# name: ${heat_name}
|
||||
# device_class: power
|
||||
# # on_press:
|
||||
# # then:
|
||||
# # - if:
|
||||
# # condition:
|
||||
# # lambda: 'return id(${duct_fan_spd_id}).state == "OFF";'
|
||||
# # then:
|
||||
# # - logger.log: "${duct_fan_spd_name} was off. Turning on as ${heat_name} turned on."
|
||||
# # - fan.turn_on:
|
||||
# # id: ${duct_fan_spd_id}
|
||||
# # speed: LOW
|
||||
# # else:
|
||||
# # - logger.log: "${heat_name} turned on, but not turning on ${duct_fan_spd_name} as already on."
|
||||
number:
|
||||
- platform: template
|
||||
id: duct_fan_spd_target_in
|
||||
name: ${duct_fan_spd_target_in_name}
|
||||
optimistic: true
|
||||
min_value: ${duct_fan_lo_spd}
|
||||
max_value: ${duct_fan_hi_spd}
|
||||
step: 1
|
||||
- platform: template
|
||||
id: duct_fan_spd_target_out
|
||||
name: ${duct_fan_spd_target_out_name}
|
||||
min_value: ${duct_fan_off_spd}
|
||||
max_value: ${duct_fan_hi_spd}
|
||||
step: 1
|
||||
set_action:
|
||||
then:
|
||||
lambda: |-
|
||||
float lo;
|
||||
float hi;
|
||||
float curtemp;
|
||||
float newspd;
|
||||
lo = id(thermostat_out_id).target_temperature_low;
|
||||
hi = id(thermostat_out_id).target_temperature_high;
|
||||
curtemp = id(dallas_out_id).state;
|
||||
if ((curtemp < lo) || (id(thermostat_on_id).state == false)) {
|
||||
auto call = id(duct_fan_spd_id).turn_off();
|
||||
call.perform();
|
||||
return id(duct_fan_off_spd);
|
||||
}
|
||||
if (curtemp > hi) {
|
||||
newspd = id(duct_fan_hi_spd);
|
||||
} else {
|
||||
// Set newspd to same linear proportion of spd range as current temp is of temp range
|
||||
newspd = id(duct_fan_lo_spd) + (id(duct_fan_hi_spd) * (curtemp - lo) / (hi - lo));
|
||||
}
|
||||
auto call = id(duct_fan_spd_id).turn_on();
|
||||
call.set_speed(newspd);
|
||||
call.perform();
|
||||
return newspd;
|
||||
|
||||
# # on_release:
|
||||
# # then:
|
||||
# # - fan.turn_on:
|
||||
# # id: ${duct_fan_spd_id}
|
||||
# # speed: LOW
|
||||
# Dual-point thermostat
|
||||
climate:
|
||||
- platform: thermostat
|
||||
id: thermostat_out_id
|
||||
name: Prj3 Out
|
||||
sensor: dallas_prj_id
|
||||
visual:
|
||||
min_temperature: 60 °F
|
||||
max_temperature: 160 °F
|
||||
temperature_step: 1
|
||||
default_mode: auto
|
||||
default_target_temperature_low: 75 °F
|
||||
default_target_temperature_high: 160 °F
|
||||
min_cooling_off_time: 60s
|
||||
min_cooling_run_time: 60s
|
||||
min_heating_off_time: 60s
|
||||
min_heating_run_time: 60s
|
||||
min_idle_time: 60s
|
||||
heat_action:
|
||||
- logger.log: "Turning off Prj3 Thermostat"
|
||||
- switch.turn_off: thermostat_on_id
|
||||
idle_action:
|
||||
- logger.log: "Turning on Prj3 Thermostat"
|
||||
- switch.turn_on: thermostat_on_id
|
||||
cool_action:
|
||||
- logger.log: "WARNING: Prj3 Thermostat has hit high temp!"
|
||||
- switch.turn_on: thermostat_on_id
|
||||
#TODO - provide some kind of warning / action here
|
||||
|
||||
# # - lambda: |-
|
||||
# # if (id(${duct_fan_spd_id}).is_off) {
|
||||
# Sense when projector is turned on
|
||||
binary_sensor:
|
||||
- platform: gpio
|
||||
pin: ${prjpwr_pin}
|
||||
name: ${prjpwr_name}
|
||||
device_class: power
|
||||
|
||||
Reference in New Issue
Block a user