Add on_boot. Partial clean up.

This commit is contained in:
2022-07-03 06:28:11 -07:00
parent 3a66962d34
commit 918bf7e19a
2 changed files with 36 additions and 14 deletions

View File

@@ -42,9 +42,19 @@ globals:
initial_value: ${duct_fan_hi_spd} initial_value: ${duct_fan_hi_spd}
<<: !include .common.yaml <<: !include .common.yaml
<<: !include .esp32.yaml
<<: !include .wifi-oss.yaml <<: !include .wifi-oss.yaml
esphome:
name: ${dn}
platform: ESP32
board: esp32doit-devkit-v1
on_boot:
- priority: 200.0
then:
- output.set_level:
id: duct_fan_output_id
level: ${duct_fan_vent_spd}%
switch: switch:
- platform: gpio - platform: gpio
pin: ${wall_fan_pwr_pin} pin: ${wall_fan_pwr_pin}
@@ -199,4 +209,3 @@ climate:
- 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 - switch.turn_on: thermostat_on_id
#TODO - provide some kind of warning / action here #TODO - provide some kind of warning / action here

View File

@@ -1,8 +1,12 @@
substitutions: substitutions:
device_name: rack-3
dn: rack_3
sn: R3
friendly_name: Rack 3
duct_fan_pin: GPIO13 duct_fan_pin: GPIO13
duct_fan_name: R3 Duct Fan Spd duct_fan_name: ${sn} Duct Fan Spd
duct_fan_tgt_spd_in_name: Rack 3 Duct Fan Target Spd In duct_fan_tgt_spd_in_name: ${sn} DF Tgt Spd In
duct_fan_tgt_spd_out_name: Rack 3 Duct Fan Target Spd Out duct_fan_tgt_spd_out_name: ${sn} DF Tgt Spd Out
duct_fan_pwmfreq: 5000Hz duct_fan_pwmfreq: 5000Hz
duct_fan_off_spd: "0.0" duct_fan_off_spd: "0.0"
duct_fan_lo_spd: "1.0" duct_fan_lo_spd: "1.0"
@@ -13,9 +17,9 @@ substitutions:
amppwr_name: "Denon Pwr" amppwr_name: "Denon Pwr"
dallas_pin: GPIO32 dallas_pin: GPIO32
dallas_in_addr: "0x7F0114328974D728" dallas_in_addr: "0x7F0114328974D728"
dallas_in_name: Rack 3 Temp In dallas_in_name: ${friendly_name} Temp In
dallas_out_addr: "0xB801143296ED7B28" dallas_out_addr: "0xB801143296ED7B28"
dallas_out_name: Rack 3 Temp Out dallas_out_name: ${friendly_name} Temp Out
dallas_update_interval: 30s dallas_update_interval: 30s
globals: globals:
@@ -28,7 +32,7 @@ globals:
- id: duct_fan_amppwr_on_lo_spd_id - id: duct_fan_amppwr_on_lo_spd_id
type: float type: float
initial_value: ${duct_fan_amppwr_on_lo_spd} initial_value: ${duct_fan_amppwr_on_lo_spd}
- id: duct_fan_vent_spd - id: duct_fan_vent_spd_id
type: float type: float
initial_value: ${duct_fan_vent_spd} initial_value: ${duct_fan_vent_spd}
- id: duct_fan_hi_spd_id - id: duct_fan_hi_spd_id
@@ -39,6 +43,12 @@ esphome:
name: rack_3 name: rack_3
platform: ESP32 platform: ESP32
board: esp32doit-devkit-v1 board: esp32doit-devkit-v1
on_boot:
- priority: 200.0
then:
- output.set_level:
id: duct_fan_output_id
level: ${duct_fan_vent_spd}%
wifi: wifi:
ssid: "kungle-ot" ssid: "kungle-ot"
@@ -138,7 +148,7 @@ number:
curtemp = id(dallas_out_id).state; curtemp = id(dallas_out_id).state;
off_spd = id(duct_fan_off_spd_id); off_spd = id(duct_fan_off_spd_id);
lo_spd = id(duct_fan_lo_spd_id); lo_spd = id(duct_fan_lo_spd_id);
vent_spd = id(duct_fan_vent_spd); vent_spd = id(duct_fan_vent_spd_id);
hi_spd = id(duct_fan_hi_spd_id); hi_spd = id(duct_fan_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 Amp Power: %d", id(amppwr_id).state); ESP_LOGD("fan_speed", "DEBUG Amp Power: %d", id(amppwr_id).state);
@@ -155,7 +165,10 @@ number:
call.perform(); call.perform();
return off_spd; return off_spd;
} }
if (curtemp > hi_temp) { if (std::isnan(curtemp)) {
ESP_LOGD("fan_speed", "DEBUG current temp unknown. Set spd to vent.");
newspd = vent_spd;
} else if (curtemp > hi_temp) {
ESP_LOGD("fan_speed", "DEBUG curtemp > hi_temp"); ESP_LOGD("fan_speed", "DEBUG curtemp > hi_temp");
newspd = hi_spd; newspd = hi_spd;
} else if (curtemp < lo_temp) { } else if (curtemp < lo_temp) {
@@ -185,7 +198,7 @@ number:
climate: climate:
- platform: thermostat - platform: thermostat
id: thermostat_out_id id: thermostat_out_id
name: Rack3 Out name: ${friendly_name} Out
sensor: dallas_out_id sensor: dallas_out_id
visual: visual:
min_temperature: 60 °F min_temperature: 60 °F
@@ -200,12 +213,12 @@ climate:
min_heating_run_time: 60s min_heating_run_time: 60s
min_idle_time: 60s min_idle_time: 60s
heat_action: heat_action:
- logger.log: "Turning off Rack3 Thermostat" - logger.log: "Turning off ${friendly_name} Thermostat"
- switch.turn_off: thermostat_on_id - switch.turn_off: thermostat_on_id
idle_action: idle_action:
- logger.log: "Turning on Rack3 Thermostat" - logger.log: "Turning on ${friendly_name} Thermostat"
- switch.turn_on: thermostat_on_id - switch.turn_on: thermostat_on_id
cool_action: cool_action:
- logger.log: "WARNING: Rack3 Thermostat has hit high temp!" - logger.log: "WARNING: ${friendly_name} Thermostat has hit high temp!"
- switch.turn_on: thermostat_on_id - switch.turn_on: thermostat_on_id
#TODO - provide some kind of warning / action here #TODO - provide some kind of warning / action here