Extracting Sony IR Transmitter Pronto Codes for Sony STR-DB930 (+Guide)

I tried controlling my Sony STR-DB930 receiver using an ESP-01M (ESP8285) IR transmitter + receiver board. I found some documentation about the necessary codes in the Slimdevices forum, but their configuration uses 11 bits and the minimum I can set in the “remote_transmitter.transmit_sony” is 12.
I got the “Power Off”, “Vol+”, “Vol-” and “Mute” comands working, but not the “Power On”.

  - platform: template
    name: "Sony Amplifyer OFF"
    on_press:
      - logger.log: Sending OFF Code
      - remote_transmitter.transmit_sony:
          data: 0x00000F41
          nbits: 12
          repeat:
            times: 4
            wait_time: 50ms

  - platform: template
    name: "Sony Amplifier Vol+"
    on_press:
      - logger.log: Increasing Volume...
      - remote_transmitter.transmit_pronto:
          data: "0000 006D 000D 0000 0060 0018 0018 0017 002E 0018 0018 0017 0018 0017 002E 0018 0018 0017 0017 0018 0017 0018 0017 0018 0018 0017 0017 0018 002E 0181"
          repeat:
            times: 2
            wait_time: 0s
  - platform: template
    name: "Sony Amplifier Vol-"
    on_press:
      - logger.log: Decreasing Volume...
      - remote_transmitter.transmit_pronto:
          data: "0000 006D 000D 0000 0061 0017 002F 0018 002E 0018 0018 0017 0018 0017 002E 0018 0018 0017 0018 0017 0018 0017 0018 0017 0017 0017 0018 0018 002D 0181"
          repeat: 
            times: 2
            wait_time: 0s
  - platform: template
    name: "Sony Amplifier Mute"
    on_press:
      - logger.log: Muting...
      - remote_transmitter.transmit_pronto:
          data: "0000 006D 000D 0000 0061 0017 0018 0017 0018 0017 002E 0018 0018 0017 002E 0018 0018 0017 0018 0017 0018 0017 0018 0017 0018 0017 0018 0017 002E 0181"
          repeat: 
            times: 2
            wait_time: 0s

I captured all these codes using the default IR remote app on my Xiaomi phone and the IR receiver on the ESP-01M. But I cannot turn on the Sony receiver with my phone, that’s why I tried the code I found in the forum post. Unfortunately, it does not work at all…

Any ideas what I’m doing wrong?

Code from the Slimdevices forum:

begin remote

  name  sony_rec_2
  bits           11
  flags SPACE_ENC|CONST_LENGTH
  eps            30
  aeps          100

  header       2468   537
  one          1269   537
  zero          669   537
  ptrail       1268
  gap          44943
  min_repeat      2
  toggle_bit      0


      begin codes
          power                    0x0000000000000540
          Radio                    0x0000000000000420
          Tape                     0x0000000000000620
          MD                       0x0000000000000310
          Video_1                  0x0000000000000220
          TV                       0x00000000000002B0
          DVD                      0x00000000000005F0
          5.1_CH                   0x0000000000000270
          CD                       0x0000000000000520
          volup                    0x0000000000000240
          voldown                  0x0000000000000640
          mute                     0x0000000000000140
      end codes

end remote

EDIT: I finally got it working!
I found different config files of “Learning Remotes”, something like a Logitech Harmony Universal Remote I guess, on RemoteCentral (Sony Category). These come in the .ccf file format, that I decoded thanks to the awesome https://github.com/gsauthof/pronto-ccf project. Make sure you run this on Linux, I got a bunch of errors on Windows because of the mmap dependency.
I dumped the command output to a file and searched for the “Power On” command:

Button: ON
    Carrier: 40.64 kHz (0x66)
    Header:  0000 0066 0000 000d
    once (0 on/off pairs):
    repeat (13 on/off pairs):
        005f 0018  0018 0018  0030 0018
        0030 0018  0030 0018  0018 0018
        0030 0018  0018 0018  0018 0017
        0018 0018  0018 0017  0018 0018
        002f 0429 

Then I used ChatGPT to transfer the “on/off” pairs onto a valid pronto command for the Esphome IR transmitter:

This is the base structure of the pronto command:

remote_transmitter.transmit_pronto:
  data: "0000 0066 0000 000d <Insert command-specific data here>"

Working Power ON command:

remote_transmitter.transmit_pronto:
      data: "0000 0066 0000 000d 005f 0018 0018 0018 0030 0018 0030 0018 0030 0018 0018 0018 0030 0018 0018 0018 0018 0017 0018 0018 0018 0017 0018 0018 002f 0429"

Nice job! Looking for remote codes for old sony receiver from online sources and implementing them with Esp8285 is not something I see every day.

1 Like

Thanks! I used my Sony STR-DB930 in my home theater because I had it since it came out and it still works like a charm.
It features optical audio, 5.1, DTS, Dolby ProLogic, over 500 W of total power and I love the sound. The only drawbacks are the nonexistent HDMI throughputs and that there is no way to implement it in HA besides IR.
And now that I can control it via ESPHome, it does its job just as well as a 2024 receiver :smile:

It’s so pleasing to “upcycle” older tech that is just missing some features for a few bucks!

A more detailed guide on how to get and use pronto codes in ESPHome:

Step 1: Extract IR Code Data

First, you need to extract the raw IR code data from your remote control. You can do this using various methods such as:

  • Using an IR receiver with Arduino or similar hardware to capture the signal.
  • Extracting data from online repositories of IR codes (e.g., .ccf files like in my example).

See RemoteCentral (Sony Category), download some .ccf files, use pronto-ccf (GitHub) on Linux to dump the content and search for the codes you need. Sometimes they are not labeled, so you might have to search through multiple .ccf files.

For example, you might extract the following data:

  • Carrier Frequency: 40.64 kHz
  • Header: 0000 0066 0000 000d
  • Repeat (On/Off Pairs):
005f 0018 0018 0018 0030 0018 0030 0018 0030 0018 0018 0018 0030 0018 0018 0018 0018 0017 0018 0018 0018 0017 0018 0018 002f 0429

Step 2: Understand the Structure of IR Codes

An IR signal consists of “On” (high) and “Off” (low) periods. These are represented as a sequence of numbers indicating the duration of each “on” or “off” pulse in microseconds.

  • Each pair of numbers corresponds to an “on/off” period.
  • These values are typically hexadecimal (e.g., 005f, 0018).

In ESPHome, we use the Pronto format, which is a specific format for IR codes. It starts with 0000 followed by a header (like 0066 for the carrier frequency), and then the on/off values.

Step 3: Convert the IR Code into ESPHome Format

You need to convert the raw extracted data into a format that ESPHome understands. This involves:

  1. Start with the Pronto header: 0000 0066 0000 000d
  • 0000: Indicates the Pronto format.
  • 0066: The carrier frequency converted to hexadecimal (40.64 kHz ≈ 0066).
  • 0000: Indicates no “repeat” block in this example.
  • 000d: The length of the following on/off pair data.
  1. Add the on/off pairs: Copy the extracted on/off pairs into the code as hexadecimal values:
005f 0018 0018 0018 0030 0018 0030 0018 0030 0018 0018 0018 0030 0018 0018 0018 0018 0017 0018 0018 0018 0017 0018 0018 002f 0429

Step 4: Create the ESPHome Code

Using the remote_transmitter.transmit_pronto action in ESPHome, you can now create the code:

on_...:
  - remote_transmitter.transmit_pronto:
      data: "0000 0066 0000 000d 005f 0018 0018 0018 0030 0018 0030 0018 0030 0018 0018 0018 0030 0018 0018 0018 0018 0017 0018 0018 0018 0017 0018 0018 002f 0429"

If you need to repeat the signal, you can use the repeat option:

on_...:
  - remote_transmitter.transmit_pronto:
      data: "0000 0066 0000 000d 005f 0018 0018 0018 0030 0018 0030 0018 0030 0018 0018 0018 0030 0018 0018 0018 0018 0017 0018 0018 0018 0017 0018 0018 002f 0429"
      repeat:
        times: 2  # Number of times to repeat the signal (for my Sony receiver, 2 was a good value)
        wait_time: 0s # Time between repeats