This commit is contained in:
Mateusz Gruszczyński
2026-08-30 23:33:23 +02:00
parent 4054fe3f76
commit ac5a464d96
9 changed files with 31 additions and 22 deletions
+1 -1
View File
@@ -32,7 +32,7 @@ fn adjustment_allowed(zone: &Zone) -> bool {
}
fn external_room_sensor_cooling_assist(mode: &str, control_source: &str) -> f64 {
if mode == "cool" && matches!(control_source, "external" | "combined") { 0.5 } else { 0.0 }
if mode == "cool" && matches!(control_source, "external" | "combined") { 1.0 } else { 0.0 }
}
fn effective_sensor_stale_after_seconds(zone_value: u64, global_value: u64) -> u64 {
+11 -2
View File
@@ -588,13 +588,22 @@ mod tests {
#[test]
fn external_room_sensor_selects_lower_cooling_setpoint_only_when_used() {
assert_eq!(external_room_sensor_cooling_assist("cool", "external"), 0.5);
assert_eq!(external_room_sensor_cooling_assist("cool", "combined"), 0.5);
assert_eq!(external_room_sensor_cooling_assist("cool", "external"), 1.0);
assert_eq!(external_room_sensor_cooling_assist("cool", "combined"), 1.0);
assert_eq!(external_room_sensor_cooling_assist("cool", "device_fallback"), 0.0);
assert_eq!(external_room_sensor_cooling_assist("cool", "device_discrepancy_fallback"), 0.0);
assert_eq!(external_room_sensor_cooling_assist("heat", "external"), 0.0);
}
#[test]
fn external_room_sensor_cooling_keeps_full_step_below_half_degree_target() {
let assist = external_room_sensor_cooling_assist("cool", "external");
assert_eq!(round_device_setpoint("cool", true, 23.0 - assist), 22.0);
assert_eq!(round_device_setpoint("cool", true, 23.5 - assist), 22.0);
assert_eq!(round_device_setpoint("cool", true, 24.0 - assist), 23.0);
assert_eq!(round_device_setpoint("cool", true, 24.5 - assist), 23.0);
}
#[test]
fn smart_fan_uses_low_speed_when_zone_is_satisfied() {
assert_eq!(smart_fan_speed("heat", 21.0, 21.0, None, false), 1);
+4 -4
View File
@@ -373,10 +373,10 @@ async fn control_zones(state: &AppState) -> Result<()> {
// stop naturally when we move the target to the satisfied side of room temperature.
let outdoor_assist = outdoor_assist_offset(effective_mode, outdoor_assist_temperature, temp, target);
// When an independent room sensor is actually driving cooling, the indoor unit's
// own sensor can satisfy too early. Apply a half-degree pre-rounding bias: because
// GREE setpoints are sent as whole degrees, this selects the next lower whole-degree
// target (0.5-1.0 C below the room target). Do not stack it with outdoor assist and
// do not use it during device/fallback control.
// own sensor can satisfy too early. Apply a full-degree pre-rounding bias: because
// GREE setpoints are sent as whole degrees, this keeps the unit at least one full
// degree below the room target, including half-degree thermostat setpoints. Do not
// stack it with outdoor assist or use it during device/fallback control.
let room_sensor_assist = external_room_sensor_cooling_assist(effective_mode, &zone.control_temperature_source);
let demand_assist = outdoor_assist.max(room_sensor_assist);
let active_target = match effective_mode {