Skip to content

Reprogramming Radbot TRVs

Tristan Keen edited this page Feb 6, 2021 · 3 revisions

In order to decrypt the messages from the TRVs, we need to set a shared encryption key across the devices. See an earlier report from the OpenTRV list of another successful attempt at this.

Radbot pads

If you open up a Radbot battery compartment & hold it upside down, you can just make out an arc of eight small silver pads next to the battery springs on the underside of the PCB. See the photo below, where I've actually undone the Radbot casing screws also for a clearer shot. You might want to do this, but with a good reprogramming technique you'll find this unnecessary.

  • GND (next to battery -'ive spring)
  • MISO
  • MOSI
  • NRST
  • SCK
  • TX
  • RX
  • Vcc (next to battery +'ive spring)

Reprogramming kit

You'll also need the USB-to-TTL-level serial cable and a few lengths of reasonably stiff wire. I found the breadboard jumper wires I listed on the Parts List to be ideal. The serial cable came with individual wire-mounted sockets for the +/- supply and TX/RX lines - I extended these with pin-to-pin jumper wires as in the photo below, and taped the TX/RX jumper-wire pair to the inside of a small Allen key to make a tool to hold the ends of the wires on the pads. The jumper wire ends fit together holding the wire pins with an approx 1/8th inch gap between them, which seems to fit the pad spacing on the Radbots.

Using the serial port connection

Finally, you need a computer with USB port to drive the serial cable. I couldn't get the Windows drivers to install properly, whereas under Linux it's pretty easy to open up the necessary 4800 baud "8N1" connection. E.g. I ran the below on an older Raspberry Pi (the Zero doesn't have full-size USB ports, but you might have an adapter):

# Generate a sequence of 16 space-separated hex bytes
# Copy it somewhere else for safe keeping - you will need it again later
# (use the same key for all your TRVs and to configure the heatmon service)
python3 -c 'import secrets; print(" ".join(f"{b:02x}" for b in secrets.token_bytes(16)))'

# Install the 'screen' utility
sudo apt install -y screen

# Plug in the USB connection & find the device name, something like /dev/ttyUSB0
# (yours will be the one at the end timestamped when you plugged it in)
ls -lrt /dev/tty*

# Connect to serial port (might also need 'sudo ' prefix)
screen /dev/ttyUSB0 4800

# Press enter to wake up the Radbot when connected & poweredup,
# and when you see the '>' prompt enter the set-key command below
# (obviously use your own random key after 'K B' instead of '00 11...ff')
K B 00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff

# Unplug the USB or 'Ctrl+A' then 'k' to exit

You can use power from the USB-to-serial cable rather than batteries to power the Radbot - it's more convenient. See the OpenTRV docs for more details.

Alternate, Two-handed method

Unfortunately, I don't have three hands to hold both Radbot and Allen key steady while typing at a terminal. Hence I created the set_trv_key.py utility which sets the serial port to the correct config and automates entering the necessary command once it sees the TRV responding.

  1. Plugin the prepared USB-to-serial cable & reprogramming tool, making sure the wires aren't touching anything critical (or each other).
  2. Open a terminal window and change directory to where you've cloned the heatmon repo (see notes how in Completeing the Raspberry Pi Setup).
  3. Create a new 16-byte random key with python3 -c 'import secrets; print("".join(f"{b:02x}" for b in secrets.token_bytes(16)))', and save a copy somewhere private for later.
  4. Run make venv to create a local Python virtual-env with the necessary libraries.
  5. Run ./set_trv_key.py 0011223....ddeeff (but substituting your key!) to start the reprogrammer watching for a live connection. If your USB device is not /dev/ttyUSB0 provide that as a second argument.
  6. Trap the negative and positive power pins from your serial cable in the big wire springs that make up the battery terminals for the Radbot, powering it up. Make sure they don't get in the way of access to the "RX" and "TX" pads next to the positive terminal.
  7. Maneuver your reprogramming tool to touch the two protruding TX/RX pins on the two pads. If you've got the spacing right you only need to guide the one you can see (probably the TX pin) and the other will still connect.
  8. Wait a few seconds for set_try_key.py to try hitting Enter, and hopefully it will complete the key update quickly.
  9. Carefully remove the reprogramming tool, unplug and power down the Radbot/serial cable.
  10. Repeat steps 5-9 for any more OpenTRV/Radbots, using the same secure key.