From b4893a1d51763a81380d8cff35c393236c379ec5 Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Tue, 10 Nov 2026 10:42:37 +0100 Subject: fix(k1c): read the part fan from Creality's output_pin fan0 Creality's K1C firmware drives the part cooling fan as `output_pin fan0` and reports the standard `fan` object with speed null, so the tab showed no fan speed. The standard object still wins when it has a value. Co-Authored-By: Claude Opus 5.5 --- tests/test_k1c.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'tests') diff --git a/tests/test_k1c.py b/tests/test_k1c.py index b82869e..47c25ec 100644 --- a/tests/test_k1c.py +++ b/tests/test_k1c.py @@ -80,6 +80,13 @@ class K1C(unittest.TestCase): m.state(), m.state() self.assertEqual(sum("/server/files/metadata" in u for u, _ in fake.calls), 1) + def test_part_fan_falls_back_to_crealitys_output_pin(self): + st = k1c.summarize({"fan": {}, "output_pin fan0": {"value": 0.5}}) + self.assertEqual(st["fan"], 0.5) + # What the K1C actually reports: the key present, the value null. + self.assertEqual(k1c.summarize({"fan": {"speed": None}, "output_pin fan0": {"value": 1.0}})["fan"], 1.0) + self.assertEqual(k1c.summarize({"fan": {"speed": 0.3}, "output_pin fan0": {"value": 1}})["fan"], 0.3) + def test_off_backs_off_instead_of_polling_every_tick(self): fake = Fake(down=True) m = k1c.make({"k1c": {"url": URL}, "http": fake}) -- cgit v1.2.3