167 lines
4.1 KiB
YAML
167 lines
4.1 KiB
YAML
substitutions:
|
|
duct_fan_pin: GPIO13
|
|
duct_fan_name: Rack 3 Duct Fan Speed
|
|
duct_fan_spd_target_in_name: Rack 3 Duct Fan Target Speed In
|
|
duct_fan_spd_target_out_name: Rack 3 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"
|
|
amppwr_pin: GPIO19
|
|
amppwr_name: "Denon Pwr"
|
|
dallas_pin: GPIO32
|
|
dallas_in_addr: "0x7F0114328974D728"
|
|
dallas_in_name: Rack 3 Temp In
|
|
dallas_out_addr: "0xB801143296ED7B28"
|
|
dallas_out_name: Rack 3 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: rack_3
|
|
platform: ESP32
|
|
board: esp32doit-devkit-v1
|
|
|
|
wifi:
|
|
ssid: "kungle-ot"
|
|
password: "ThingsWelcomeToKungle"
|
|
|
|
manual_ip:
|
|
static_ip: 192.168.37.74
|
|
gateway: 192.168.37.1
|
|
subnet: 255.255.255.0
|
|
|
|
# Enable fallback hotspot (captive portal) in case wifi connection fails
|
|
ap:
|
|
ssid: "Rack 3 Fallback Hotspot"
|
|
password: "jj0CXEgu3Lzo"
|
|
|
|
captive_portal:
|
|
|
|
# Enable logging
|
|
logger:
|
|
|
|
# Enable Home Assistant API
|
|
api:
|
|
|
|
ota:
|
|
|
|
switch:
|
|
- platform: template
|
|
name: Thermostat On
|
|
id: thermostat_on_id
|
|
optimistic: true
|
|
|
|
output:
|
|
- platform: ledc
|
|
pin: ${duct_fan_pin}
|
|
id: duct_fan_output_id
|
|
frequency: ${duct_fan_pwmfreq}
|
|
|
|
fan:
|
|
- platform: speed
|
|
id: duct_fan_spd_id
|
|
output: duct_fan_output_id
|
|
name: ${duct_fan_name}
|
|
|
|
dallas:
|
|
- pin:
|
|
number: ${dallas_pin}
|
|
mode: INPUT_PULLUP
|
|
update_interval: ${dallas_update_interval}
|
|
|
|
sensor:
|
|
- platform: dallas
|
|
address: ${dallas_in_addr}
|
|
name: ${dallas_in_name}
|
|
- platform: dallas
|
|
address: ${dallas_out_addr}
|
|
name: ${dallas_out_name}
|
|
id: dallas_out_id
|
|
|
|
number:
|
|
- platform: template
|
|
id: duct_fan_spd_target_in_id
|
|
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_id
|
|
name: ${duct_fan_spd_target_out_name}
|
|
min_value: ${duct_fan_lo_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;
|
|
|
|
# Dual-point thermostat
|
|
climate:
|
|
- platform: thermostat
|
|
id: thermostat_out_id
|
|
name: Rack3 Out
|
|
sensor: dallas_out_id
|
|
visual:
|
|
min_temperature: 60 °F
|
|
max_temperature: 100 °F
|
|
temperature_step: 1
|
|
default_mode: auto
|
|
default_target_temperature_low: 75 °F
|
|
default_target_temperature_high: 100 °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 Rack3 Thermostat"
|
|
- switch.turn_off: thermostat_on_id
|
|
idle_action:
|
|
- logger.log: "Turning on Rack3 Thermostat"
|
|
- switch.turn_on: thermostat_on_id
|
|
cool_action:
|
|
- logger.log: "WARNING: Rack3 Thermostat has hit high temp!"
|
|
- switch.turn_on: thermostat_on_id
|
|
#TODO - provide some kind of warning / action here
|
|
|
|
# Sense when receiver is turned on
|
|
binary_sensor:
|
|
- platform: gpio
|
|
pin: ${amppwr_pin}
|
|
name: ${amppwr_name}
|
|
device_class: power
|