JBL MA series AVR

Hi I am on Remote 3 Beta Firmware 2.8.3. I built a native driver using pkg (tried Node 14, 16, and 18 targets for linux-arm64). The driver installs successfully, but immediately fails to connect with ‘Connection Refused (os error 111)’. It seems native binaries are crashing immediately on launch on this firmware. I have tried the HTTP request, it works but I don’t get the state of the AVR back to the remote, so I’m getting the equivalent of smarter IR, but I want the remote to know the status of the AVR for my activities. Can anyone help with a proper integration? These are my notes:

1. manifest (driver.json)

{
“driver_id”: “jbl_ma_series”,
“name”: { “en”: “JBL MA Series” },
“driver_url”: “native”,
“version”: “1.1.0”,
“min_core_api”: “0.14.0”,
“developer”: { “name”: “Community”, “email”: “dev@example.com” },
“setup_data_schema”: { “type”: “object”, “properties”: {} }
}

  1. Main Logic (index.js)

const WebSocket = require(‘ws’);
const net = require(‘net’);

// — JBL MA SERIES CONTROL CODES —
const JBL_IP = ‘192.168.68.89’;
const JBL_PORT = 50000;
const CMDS = {
POWER_ON: Buffer.from([0x23, 0x04, 0x03, 0x01, 0x0E, 0x03, 0x0D]),
POWER_OFF: Buffer.from([0x23, 0x04, 0x03, 0x01, 0x0E, 0x03, 0x0D]), // Toggle
VOL_UP: Buffer.from([0x23, 0x04, 0x03, 0x01, 0x0E, 0xE3, 0x0D]),
VOL_DOWN: Buffer.from([0x23, 0x04, 0x03, 0x01, 0x0E, 0x13, 0x0D]),
MUTE: Buffer.from([0x23, 0x04, 0x03, 0x01, 0x0E, 0xC3, 0x0D]),
INPUT_HDMI1: Buffer.from([0x23, 0x05, 0x01, 0x02, 0x0D]),
INPUT_TV: Buffer.from([0x23, 0x05, 0x01, 0x01, 0x0D])
};

// — DRIVER SERVER SETUP —
// Catch process crashes to prevent “Connection Refused”
process.on(‘uncaughtException’, (e) => console.error(‘[CRASH]’, e));
process.on(‘unhandledRejection’, (e) => console.error(‘[REJECT]’, e));

const port = process.env.UC_INTEGRATION_DRIVER_PORT || 8090;
console.log(Starting Driver on port ${port}...);

// Bind to 0.0.0.0 to ensure visibility on the Remote’s network interface
const wss = new WebSocket.Server({ host: ‘0.0.0.0’, port: Number(port) });

wss.on(‘connection’, (ws) => {
console.log(‘[Remote] Core Connected’);

// Send "Available" state immediately
ws.send(JSON.stringify({
    kind: 'driver_state_change',
    driver_id: 'jbl_ma_series',
    entity_id: 'jbl_avr',
    attributes: { source: 'READY' },
    state: 'ON'
}));

// Handle commands from Remote
ws.on('message', (message) => {
    try {
        const data = JSON.parse(message);
        if (data.kind === 'entity_command') {
            console.log('Received command:', data.cmd_id);
            // TODO: Connect `net.Socket` here to send CMDS to JBL_IP
        }
    } catch (err) {
        console.error('Message Error', err);
    }
});

});

  1. Build Dependencies (package.json)

{
“name”: “jbl-driver”,
“version”: “1.0.0”,
“bin”: “index.js”,
“scripts”: {
“build”: “pkg . --targets node14-linux-arm64 --output bin/driver --public”
},
“dependencies”: {
“ws”: “^8.18.0”
},
“devDependencies”: {
“pkg”: “^5.8.1”
}
}

4. Build & Install Instructions

1. Install Dependencies

npm install

2. Build Binary (Targeting Node 14 for compatibility)

npm run build

3. Create Package Structure

mkdir -p bin

(Move the built ‘driver’ file into ‘bin’ if not already there)

chmod +x bin/driver

4. Create Archive

tar -czvf jbl-driver.tar.gz driver.json bin

5. Upload to Remote

curl -k -u web-configurator:3036 -X POST https://192.168.68.84/api/intg/install
-H “Content-Type: multipart/form-data”
-F “file=@jbl-driver.tar.gz”

The Error: The driver uploads successfully, but the Remote shows “Connection Refused (os error 111)” immediately.

Attempts: We tried targeting node18-linux-arm64, node16-linux-arm64, and node14-linux-arm64 using pkg. All resulted in the same error.

Hypothesis: The binary is crashing on startup

Hopefully someone can help, I’m new to this. Thanks.

So you see anything in the integration and core logs?

I’ll have a look when I get home.

I’m currently using your HTTP request integration, I can control the AVR, I just don’t get the state of it, so when someone at home uses the AVR remote instead of the remote 3, it messes up my activity. That’s why I want or trying to make a proper integration.