From: Martin Mares Date: Sat, 15 Feb 2025 20:24:23 +0000 (+0100) Subject: BSB Daemon: Query hot water temperature X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=a75abe24aff39d0a910efcdf787b67c907acba14;p=home-hw.git BSB Daemon: Query hot water temperature --- diff --git a/bsb/daemon/burrow-bsbd.c b/bsb/daemon/burrow-bsbd.c index ca9e66d..60fc17a 100644 --- a/bsb/daemon/burrow-bsbd.c +++ b/bsb/daemon/burrow-bsbd.c @@ -283,6 +283,13 @@ static void process_answer(time_t t, byte *p, uint len) len -= 4; switch (addr) { + case 0x313d052f: + // 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; } } @@ -358,7 +365,7 @@ int main(int argc UNUSED, char **argv) time_t now = time(NULL); time_t last_stats = 0; - // time_t last_query = now; + time_t last_query = now; int err, received; byte resp[64]; @@ -382,9 +389,16 @@ int main(int argc UNUSED, char **argv) last_stats = now; } -#if 0 - if (last_query + 10 < now) { - byte pkt[] = { 0xdc, 0xc2, 0x00, 0x0b, 0x06, 0x3d, 0x2e, 0x11, 0x25, 0x00, 0x00 }; + if (last_query + 30 < now) { + byte pkt[] = { + 0xdc, // start of frame + 0x00, // source address (filled by firmware) + BSB_ADDR_BOILER, // destination address + 0x0b, // length + BSB_OP_QUERY, // operation + 0x3d, 0x31, 0x05, 0x2f, // address: hot water temperature (first 2 bytes swapped!) + 0x00, 0x00, // CRC (filled by firmware) + }; if (err = libusb_bulk_transfer(devh, 0x01, pkt, sizeof(pkt), &received, 2000)) { usb_error("Send failed: error %d", err); continue; @@ -393,7 +407,6 @@ int main(int argc UNUSED, char **argv) } last_query = now; } -#endif if (err = libusb_interrupt_transfer(devh, 0x82, resp, 64, &received, 1000)) { if (err != LIBUSB_ERROR_TIMEOUT)