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;
}
}
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];
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;
}
last_query = now;
}
-#endif
if (err = libusb_interrupt_transfer(devh, 0x82, resp, 64, &received, 1000)) {
if (err != LIBUSB_ERROR_TIMEOUT)