For context, read Hacking radiators for fun and no profit.
Disclaimer: This whole article is generated by Claude. Feed it to your own LLM to implement the protocol. You can read it yourself of course, but this is LLM prose.
I replaced my Acova radiators’ wall remotes with a single Heltec WiFi LoRa 32 V3 (ESP32-S3 + SX1262). This is everything needed to do the same: read your radiator’s session key once over SWD, then drive the radiator from the Heltec by reproducing the 868 MHz protocol. All values below are the verified, working implementation — not an approximation.
What it is
The remotes don’t run bespoke Acova firmware — they run Zehnder’s “ComfoRF”, a CANopen-over-RF wireless-mesh stack (Zehnder has owned Acova since 1994); the group’s name is the PHY sync word, 5A 47 52 50 = ASCII “ZGRP”. The remote hardware is an STM32L151 MCU plus an ST SPIRIT1 sub-GHz transceiver. Each radiator holds a 16-byte AES network key (recB) distributed at pairing. To impersonate the remote you need that key, then you reproduce the SPIRIT1’s line coding in software on the SX1262.
Step 1 — Read the session key over SWD
The STM32L151 ships at readout-protection Level 0, so its flash and data-EEPROM are fully readable over SWD. Inside the remote, a 6-pin header X1 carries the debug port:
| X1 pin | Function |
|---|---|
| 1 | NRST (only needed for connect-under-reset) |
| 2 | SWCLK |
| 3 | GND |
| 4 | SWDIO |
There is no VCC pin on the header — power the board from its own 3.3 V rail (battery +). The MCU sleeps in STOP mode, where the debug memory bus stalls; the simplest fix is to hold a radiator button to keep it awake while you connect. (Alternatively wire NRST to pin 1 and use connect-under-reset: reset_config srst_only srst_nogate connect_assert_srst.) Then dump the data EEPROM with a J-Link or ST-Link:
openocd -f interface/jlink.cfg -c "transport select swd" -f target/stm32l1.cfg \
-c "init; reset halt" \
-c "dump_image eeprom.bin 0x08080000 0x2000" -c "shutdown"
# The 16-byte key (recB) lives at EEPROM 0x08080833 = file offset 0x833:
xxd -s 0x833 -l 16 eeprom.bin
Those 16 bytes are your AES-128 key. (The record at 0x08080831 is two flag bytes, the key, then a CRC-8 with seed 0xBE, if you want to validate it.) One caveat: don’t leave DBGMCU_CR forced on across a re-pair — it keeps debug alive through STOP but disturbs the pairing handshake, and only a power-on reset clears it.
Step 2 — The radio (PHY)
| Band | 868.2 MHz |
| Modulation | 2-GFSK, Gaussian BT = 0.5 |
| Bit rate | 50 kbit/s |
| Deviation | ±20 kHz |
| Sync word | 5A 47 52 50, sent raw |
The SPIRIT1 does FEC, interleaving, whitening and CRC in hardware; the SX1262 does not, so you turn all of that off on the radio and do it in software (next sections). RadioLib setup on a Heltec V3:
SX1262 radio = new Module(8, 14, 12, 13); // NSS, DIO1, RST, BUSY
// SPI pins on the Heltec V3: SCK=9, MISO=11, MOSI=10
radio.beginFSK(868.2, 50.0, 20.0, 156.2, 14 /*dBm*/, 64 /*preamble*/, 1.8 /*TCXO*/);
radio.setDataShaping(RADIOLIB_SHAPING_0_5); // Gaussian BT = 0.5
uint8_t sync[] = {0x5A, 0x47, 0x52, 0x50};
radio.setSyncWord(sync, 4);
radio.setCRC(0); // CRC-24 is done in software
radio.setWhitening(false); // PN9 is done in software
Step 3 — The line code (software)
Each frame is rate-1/2 convolutionally coded (K = 4, generators 0o15/0o17), 4×4-interleaved, then XOR-whitened with a PN9 sequence (seed 0x1FF). This reference encoder reproduces the on-air bytes exactly; decode() is the inverse.
static const uint8_t SLOT_N[16] =
{15,11,7,3, 14,10,6,2, 13,9,5,1, 12,8,4,0}; // 15 - 4*(a%4) - a/4
static void pn9(uint8_t* out, size_t n) {
uint16_t state = 0x1FF;
for (size_t i = 0; i < n; i++) {
out[i] = state & 0xFF;
for (int j = 0; j < 8; j++) {
uint16_t fb = (state ^ (state >> 5)) & 1;
state = (state >> 1) | (fb << 8);
}
}
}
// frame = body ‖ CRC-24 ‖ 05 85 ‖ 0x80 (one trailing 1 bit). out_len = 2*flen.
static void encode(const uint8_t* frame, size_t frame_len,
uint8_t* air, size_t out_len) {
size_t nbits = frame_len * 8;
for (size_t k = 0; k < out_len / 4; k++) {
uint32_t w = 0;
for (int a = 0; a < 16; a++) {
long p = 16L * k + SLOT_N[a];
auto g = [&](long q) -> int {
return (q < 0 || q >= (long)nbits) ? 0
: (frame[q >> 3] >> (7 - (q & 7))) & 1;
};
int A = g(p-2) ^ g(p-1) ^ g(p+1);
int B = A ^ g(p);
w |= (uint32_t)((A << 1) | B) << (30 - 2*a);
}
air[4*k] = w>>24; air[4*k+1] = w>>16; air[4*k+2] = w>>8; air[4*k+3] = w;
}
uint8_t pn[128]; pn9(pn, out_len);
for (size_t i = 0; i < out_len; i++) air[i] ^= pn[i];
}
Step 4 — The frame and its CRCs
A command frame body is [len][dst][src][ctl][lseq][TOS] ‖ 12 00 01 ‖ AES-128-ECB(payload). len is the number of bytes after it (24 for a command); dst = 0x00; src is the radiator’s node id; ctl = 0x01; lseq is a 6-bit rolling counter that must advance (keep it ahead of the remote’s, or sync it from frames you hear); TOS = 0x07 marks a command. The node ids (src) in my setup:
| Radiator | src |
|---|---|
| kitchen | 0x05 |
| office | 0x02 |
| bedroom | 0x08 |
| workshop | 0x0c |
Yours will differ — read a radiator’s src as byte 2 of any decoded command frame from its remote. Two CRCs are involved: a CRC-8 inside the encrypted payload, and a CRC-24 over the whole body.
uint8_t crc8(const uint8_t* d, size_t n) { // seed 0xA4, poly 0x07
uint8_t c = 0xA4;
for (size_t i = 0; i < n; i++) {
c ^= d[i];
for (int j = 0; j < 8; j++)
c = (c & 0x80) ? ((c << 1) ^ 0x07) : (c << 1);
}
return c;
}
uint32_t crc24(const uint8_t* d, size_t n) { // init 0xBCD982, poly 0x864CFB
uint32_t c = 0xBCD982;
for (size_t i = 0; i < n; i++) {
c ^= (uint32_t)d[i] << 16;
for (int j = 0; j < 8; j++)
c = (c & 0x800000) ? (((c << 1) ^ 0x864CFB) & 0xFFFFFF)
: ((c << 1) & 0xFFFFFF);
}
return c & 0xFFFFFF;
}
Step 5 — The command payload
The 16-byte plaintext payload is AES-128-ECB encrypted under your key and placed after the 12 00 01 header. Its layout:
| Byte | Field | Value |
|---|---|---|
| 0 | role | 0x01 |
| 1–2 | net-id | 74 03 (shared object index) |
| 3 | seq | 0xFE for commands |
| 4 | class | 0x02 = mode, 0x03 = setpoint |
| 5 | field | mode → 0x03; setpoint → 0x04 eco reg / 0x05 comfort reg |
| 6 | value | mode byte, or °C × 2 (see below) |
| 7 | — | 0x00 |
| 8–14 | — | 0x00 |
| 15 | CRC-8 | over 12 00 01 + bytes 0–14 |
Mode values (byte 6 when class = 0x02, field = 0x03): 0x01 off, 0x02 frost-free, 0x03 eco, 0x04 comfort, 0x08 programme. A setpoint is two frames: first write the register (class 0x03, field 0x04 eco or 0x05 comfort, value = round(°C × 2)), then send a mode command to switch into eco or comfort.
// payload[16]: 01 | net0 net1 | seq | class field value 00 | 0*7 | crc8
void build_payload(uint8_t out[16], uint8_t seq, uint8_t cls, uint8_t field,
uint8_t value, uint8_t net0, uint8_t net1) {
memset(out, 0, 16);
out[0]=0x01; out[1]=net0; out[2]=net1; out[3]=seq;
out[4]=cls; out[5]=field; out[6]=value;
uint8_t buf[18] = {0x12,0x00,0x01};
memcpy(buf+3, out, 15);
out[15] = crc8(buf, 18);
}
// body: len | dst src ctl lseq 0x07 | 12 00 01 || AES-128-ECB_key(payload)
size_t build_body(uint8_t* body, const uint8_t key[16], const uint8_t payload[16],
uint8_t dst, uint8_t src, uint8_t ctl, uint8_t lseq) {
body[0]=24; body[1]=dst; body[2]=src; body[3]=ctl;
body[4]=lseq & 0x3F; body[5]=0x07;
body[6]=0x12; body[7]=0x00; body[8]=0x01;
aes128_ecb_enc(key, payload, body+9); // 16-byte ciphertext from mbedtls/tiny-AES
return 25;
}
// body -> on-air bytes: append CRC-24, 05 85, trailing 1 bit, then line-code.
size_t frame_to_air(const uint8_t* body, size_t blen, uint8_t* air) {
uint8_t f[64]; memcpy(f, body, blen);
uint32_t c = crc24(body, blen);
f[blen]=c>>16; f[blen+1]=c>>8; f[blen+2]=c;
f[blen+3]=0x05; f[blen+4]=0x85;
size_t flen = blen + 5;
f[flen] = 0x80; // one trailing 1 bit
size_t out_len = 2 * flen; // 60 for a 25-byte body
encode(f, flen + 1, air, out_len);
return out_len;
}
Step 6 — Put it together and transmit
Set the kitchen radiator to comfort, 21 °C:
const uint8_t SRC = 0x05; // kitchen, from your capture
uint8_t pay[16], body[32], air[60];
// 1) comfort register = 21.0 C (class=setpoint, field=comfort reg, value=42)
build_payload(pay, 0xFE, 0x03, 0x05, 42, 0x74, 0x03);
size_t bn = build_body(body, key, pay, 0x00, SRC, 0x01, lseq++);
size_t an = frame_to_air(body, bn, air);
radio.fixedPacketLengthMode(an); radio.transmit(air, an); // an = 60
// 2) switch to comfort (class=mode, field=03, value=0x04 comfort)
build_payload(pay, 0xFE, 0x02, 0x03, 0x04, 0x74, 0x03);
bn = build_body(body, key, pay, 0x00, SRC, 0x01, lseq++);
an = frame_to_air(body, bn, air);
radio.fixedPacketLengthMode(an); radio.transmit(air, an);
Space transmits by ~45 ms and respect the band’s duty cycle. To mirror state (so you can tell when someone uses the physical remote), receive with a fixed 64-byte window and run the inverse of encode(): de-whiten, de-interleave via SLOT_N, take A ^ B of each bit pair, then AES-decrypt the payload and check its CRC-8. A radiator never transmits on its own, so there is no acknowledgement to wait for — a command either lands or it doesn’t.


Leave a Reply