From: Martin Mares Date: Sun, 23 Feb 2025 18:48:21 +0000 (+0100) Subject: BSB Daemon: Modulation decoded, byte swaps handled more gracefully X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=cb57cb7d7ee827cd153b520489abbc9df4d86615;p=home-hw.git BSB Daemon: Modulation decoded, byte swaps handled more gracefully --- diff --git a/bsb/daemon/burrow-bsbd.c b/bsb/daemon/burrow-bsbd.c index bc1dc2e..78dc617 100644 --- a/bsb/daemon/burrow-bsbd.c +++ b/bsb/daemon/burrow-bsbd.c @@ -278,26 +278,29 @@ static void process_answer(time_t t, byte *p, uint len) if (len < 4) return; - u32 addr = get_u32_be(p); // Two highest-order bytes are swapped + // Two highest-order bytes are swapped + u32 addr = (p[0] << 16) | (p[1] << 24) | (p[2] << 8) | p[3]; p += 4; len -= 4; switch (addr) { - case 0x053d0834: - // Boiler modulation (format not decoded yet) + case 0x3d050834: + // Burner modulation if (len >= 2) { uint mod = get_u16_be(p); - mqtt_publish("burrow/heating/modulation", "%04x %lld", mod, (long long) t); + if (mod > 100) // If there is no flame, the value is 0x100; otherwise, it's percentage + mod = 0; + mqtt_publish("burrow/heating/modulation", "%d %lld", mod, (long long) t); } break; - case 0x313d052f: + case 0x3d31052f: // Hot water temperature if (len >= 3) { int temp = get_s16_be(p + 1); mqtt_publish("burrow/heating/water/temp", "%.2f %lld", temp / 64., (long long) t); } break; - case 0x113d051a: + case 0x3d11051a: // Boiler return temperature if (len >= 3) { int temp = get_s16_be(p + 1); @@ -309,7 +312,7 @@ static void process_answer(time_t t, byte *p, uint len) static u32 query_list[] = { 0x3d31052f, // Hot water temperature - 0x3d050834, // Boiler modulation + 0x3d050834, // Burner modulation 0x3d31052f, // Hot water temperature (measure more frequently) 0x3d11051a, // Boiler return temperature };