Add auto-on when receiver is on for rack3.
This commit is contained in:
25
rack_3.yaml
25
rack_3.yaml
@@ -6,6 +6,7 @@ substitutions:
|
|||||||
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"
|
||||||
|
duct_fan_amppwr_on_lo_spd: "20.0"
|
||||||
duct_fan_hi_spd: "100.0"
|
duct_fan_hi_spd: "100.0"
|
||||||
amppwr_pin: GPIO19
|
amppwr_pin: GPIO19
|
||||||
amppwr_name: "Denon Pwr"
|
amppwr_name: "Denon Pwr"
|
||||||
@@ -17,13 +18,16 @@ substitutions:
|
|||||||
dallas_update_interval: 30s
|
dallas_update_interval: 30s
|
||||||
|
|
||||||
globals:
|
globals:
|
||||||
- id: duct_fan_off_spd
|
- id: duct_fan_off_spd_id
|
||||||
type: float
|
type: float
|
||||||
initial_value: ${duct_fan_off_spd}
|
initial_value: ${duct_fan_off_spd}
|
||||||
- id: duct_fan_lo_spd
|
- id: duct_fan_lo_spd_id
|
||||||
type: float
|
type: float
|
||||||
initial_value: ${duct_fan_lo_spd}
|
initial_value: ${duct_fan_lo_spd}
|
||||||
- id: duct_fan_hi_spd
|
- id: duct_fan_amppwr_on_lo_spd_id
|
||||||
|
type: float
|
||||||
|
initial_value: ${duct_fan_amppwr_on_lo_spd}
|
||||||
|
- id: duct_fan_hi_spd_id
|
||||||
type: float
|
type: float
|
||||||
initial_value: ${duct_fan_hi_spd}
|
initial_value: ${duct_fan_hi_spd}
|
||||||
|
|
||||||
@@ -116,16 +120,22 @@ 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);
|
off_spd = id(duct_fan_off_spd_id);
|
||||||
lo_spd = id(duct_fan_lo_spd);
|
hi_spd = id(duct_fan_hi_spd_id);
|
||||||
hi_spd = id(duct_fan_hi_spd);
|
lo_spd = id(duct_fan_lo_spd_id);
|
||||||
if ((curtemp < lo_temp) || (id(thermostat_on_id).state == false)) {
|
if (id(amppwr_id).state == true) {
|
||||||
|
// Amp is on, use that lo speed.
|
||||||
|
lo_spd = id(duct_fan_amppwr_on_lo_spd_id);
|
||||||
|
} else if ((curtemp < lo_temp) || (id(thermostat_on_id).state == false)) {
|
||||||
|
// Amp is off and temp is lo or thermostat is off. Turn the fan off.
|
||||||
auto call = id(duct_fan_spd_id).turn_off();
|
auto call = id(duct_fan_spd_id).turn_off();
|
||||||
call.perform();
|
call.perform();
|
||||||
return off_spd;
|
return off_spd;
|
||||||
}
|
}
|
||||||
if (curtemp > hi_temp) {
|
if (curtemp > hi_temp) {
|
||||||
newspd = hi_spd;
|
newspd = hi_spd;
|
||||||
|
} else if (curtemp < lo_temp) {
|
||||||
|
newspd = lo_spd;
|
||||||
} else {
|
} else {
|
||||||
// Set newspd to same linear proportion of spd range as current temp is of temp range
|
// Set newspd to same linear proportion of spd range as current temp is of temp range
|
||||||
newspd = lo_spd + ((hi_spd - lo_spd) * (curtemp - lo_temp) / (hi_temp - lo_temp));
|
newspd = lo_spd + ((hi_spd - lo_spd) * (curtemp - lo_temp) / (hi_temp - lo_temp));
|
||||||
@@ -167,6 +177,7 @@ climate:
|
|||||||
# Sense when receiver is turned on
|
# Sense when receiver is turned on
|
||||||
binary_sensor:
|
binary_sensor:
|
||||||
- platform: gpio
|
- platform: gpio
|
||||||
|
id: amppwr_id
|
||||||
pin: ${amppwr_pin}
|
pin: ${amppwr_pin}
|
||||||
name: ${amppwr_name}
|
name: ${amppwr_name}
|
||||||
device_class: power
|
device_class: power
|
||||||
|
|||||||
Reference in New Issue
Block a user