"""Minimal closed-loop policy. Change only the first line to switch backends.""" from hth_sdk import HTH def decide(state): heat = 25 if (state.max_temperature_c or 0) < 45 else 0 return {"fan": 20, "heater": heat, "door": 0} def run(hth: HTH, steps: int = 8) -> None: for state in hth.watch(period=0.05, count=steps): if not state.ready or not state.fresh: continue result = hth.set(**decide(state)) print(state.time, result.ok, state.max_temperature_c) if __name__ == "__main__": with HTH.demo(scenario="coupled_4chamber", seed=1, speed=20) as hth: run(hth)