Skip to content

Commit f76ec0a

Browse files
committed
cleanup
1 parent c6de9f8 commit f76ec0a

1 file changed

Lines changed: 8 additions & 24 deletions

File tree

custom_components/better_thermostat/climate.py

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2485,11 +2485,11 @@ def extra_state_attributes(self) -> dict[str, Any]:
24852485
# Führe kompakt alle TRV-Balance Infos zusammen (nur valve_percent)
24862486
bal_compact = {}
24872487
for trv, info in self.real_trvs.items():
2488-
bal = info.get("balance")
2488+
bal = info.get("calibration_balance")
24892489
if bal:
24902490
bal_compact[trv] = {"valve%": bal.get("valve_percent")}
24912491
if bal_compact:
2492-
dev_specific["balance"] = json.dumps(bal_compact)
2492+
dev_specific["calibration_balance"] = json.dumps(bal_compact)
24932493
except Exception:
24942494
pass
24952495

@@ -2504,7 +2504,9 @@ def extra_state_attributes(self) -> dict[str, Any]:
25042504
if rep_trv is None:
25052505
rep_trv = next(iter(self.real_trvs.keys()), None)
25062506
if rep_trv is not None:
2507-
bal = (self.real_trvs.get(rep_trv, {}) or {}).get("balance") or {}
2507+
bal = (self.real_trvs.get(rep_trv, {}) or {}).get(
2508+
"calibration_balance"
2509+
) or {}
25082510
dbg = bal.get("debug") or {}
25092511
pid = dbg.get("pid") or {}
25102512
# Nur wenn Modus pid ist, sonst vermeiden wir Rauschen
@@ -2558,24 +2560,6 @@ def _to_float(val):
25582560
except Exception:
25592561
pass
25602562

2561-
# Balance Telemetrie (kompakt)
2562-
if hasattr(self, "temp_slope") and self.temp_slope is not None:
2563-
dev_specific["temp_slope_K_min"] = round(self.temp_slope, 4)
2564-
try:
2565-
# Führe kompakt alle TRV-Balance Infos zusammen (nur valve_percent)
2566-
bal_compact = {}
2567-
for trv, info in self.real_trvs.items():
2568-
bal = info.get("balance")
2569-
if bal:
2570-
bal_compact[trv] = {"valve%": bal.get("valve_percent")}
2571-
if bal_compact:
2572-
dev_specific["balance"] = json.dumps(bal_compact)
2573-
except Exception:
2574-
pass
2575-
2576-
except Exception:
2577-
pass
2578-
25792563
return dev_specific
25802564

25812565
@property
@@ -2754,7 +2738,7 @@ def _to_pct(val):
27542738
except Exception:
27552739
return None
27562740

2757-
THRESH = 5.0
2741+
THRESH = 0.0
27582742
for trv_id, info in (self.real_trvs or {}).items():
27592743
if not isinstance(info, dict):
27602744
continue
@@ -2828,13 +2812,13 @@ def _to_pct(val):
28282812
pass
28292813

28302814
# 4) Balance module currently targets a valve percent > 0 (proxy for heating intent)
2831-
bal = info.get("balance") or {}
2815+
bal = info.get("calibration_balance") or {}
28322816
v_bal = bal.get("valve_percent") if isinstance(bal, dict) else None
28332817
try:
28342818
v_bal_n = _to_pct(v_bal)
28352819
if v_bal_n is not None and v_bal_n > THRESH:
28362820
_LOGGER.debug(
2837-
"better_thermostat %s: overriding hvac_action to HEATING (balance.valve_percent %.1f%%, TRV %s)",
2821+
"better_thermostat %s: overriding hvac_action to HEATING (calibration_balance.valve_percent %.1f%%, TRV %s)",
28382822
self.device_name,
28392823
v_bal_n,
28402824
trv_id,

0 commit comments

Comments
 (0)