ZRC provide a simple API for bluetooth wireless control.

Write 2 Bytes payload to ATT handle 0x26, ZRC will send out IR code as if some button been pressed.

Index Value Description
0 0x02 Command Code
1 Button Number 00 - Digit 0, 01 - Digit 1, ...

Prerequisite

  1. ZRC been configured.
    Make sure press button can control the device.
  2. Disconnect from FzRemote App.
    Bluetooth peripheral can have only one connection, disconnect from FzRemote App so that Raspberry Pi can connect to it. You can take iPhone far alway from the remote control, or you can kill the App.
  3. Bluetooth up and running on Raspberry Pi.
    Note - Old Raspberry Pi have no build-in bluetooth, USB bluetooth 4.0 adapter required in that case.

Scan to find out mac address.

host$ bluetoothctl
[NEW] Controller 00:02:72:CC:A9:67 ubuntu [default]
[bluetooth]# scan on
Discovery started
[CHG] Controller 00:02:72:CC:A9:67 Discovering: yes
[NEW] Device 00:81:F9:B6:D3:27 ZRC
[bluetooth]# scan off
Discovery stopped
[CHG] Controller 00:02:72:CC:A9:67 Discovering: no
[bluetooth]# exit

Send IR.

import pexpect, time

gatt = pexpect.spawn("gatttool -b 00:81:F9:B6:D3:27 -I")
gatt.sendline("connect")
gatt.expect("Connection successful")
gatt.sendline("char-write-cmd 26 0201")
time.sleep(1)
gatt.sendline("disconnect")

List of Button Number

#define KEY_DIGIT_0         0
#define KEY_DIGIT_1         1
#define KEY_DIGIT_2         2
#define KEY_DIGIT_3         3
#define KEY_DIGIT_4         4
#define KEY_DIGIT_5         5
#define KEY_DIGIT_6         6
#define KEY_DIGIT_7         7
#define KEY_DIGIT_8         8
#define KEY_DIGIT_9         9
#define KEY_POWER           10
#define KEY_STAR            11
#define KEY_SEARCH          12
#define KEY_CURSOR_UP       13
#define KEY_CURSOR_DOWN     14
#define KEY_CURSOR_LEFT     15
#define KEY_CURSOR_RIGHT    16
#define KEY_OK              17
#define KEY_REWIND          18
#define KEY_STOP            19
#define KEY_PLAY            20
#define KEY_FORWARD         21
#define KEY_VOLUME_PLUS     22
#define KEY_VOLUME_MINUS    23
#define KEY_MUTE            24
#define KEY_CHANNEL_PLUS    25
#define KEY_CHANNEL_MINUS   26
#define KEY_RETURN          27
#define KEY_EXIT            28
#define KEY_RED             29
#define KEY_GREEN           30
#define KEY_YELLOW          31
#define KEY_BLUE            32
#define KEY_INFO            33