Hi @Dean_Commodore ,
I have the same issue. So I added logic to Node-Red to verify the CAN interface name
[
{
"id": "493f26a77a9ec46e",
"type": "tab",
"label": "Flow 1",
"disabled": false,
"info": "",
"env": []
},
{
"id": "e5170a78393e72b2",
"type": "inject",
"z": "493f26a77a9ec46e",
"name": "Auto-detect on deploy",
"props": [
{
"p": "payload"
}
],
"repeat": "",
"crontab": "",
"once": true,
"onceDelay": 1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 165,
"y": 100,
"wires": [
[
"1fe6451b90b09f47"
]
]
},
{
"id": "1fe6451b90b09f47",
"type": "exec",
"z": "493f26a77a9ec46e",
"command": "ls /sys/class/net",
"addpay": "",
"append": "",
"useSpawn": "false",
"timer": "",
"winHide": false,
"oldrc": false,
"name": "List network interfaces",
"x": 385,
"y": 100,
"wires": [
[
"9874a0d3d5de224a"
],
[],
[]
]
},
{
"id": "9874a0d3d5de224a",
"type": "function",
"z": "493f26a77a9ec46e",
"name": "Detect CAN interface",
"func": "const lines = (msg.payload || '').split('\\n').map(l => l.trim()).filter(Boolean);\nconst canIfaces = lines.filter(l => /^(ve)?can\\d+$/.test(l));\n\nif (canIfaces.length === 0) {\n node.error('No CAN interface found under /sys/class/net -- leaving flow.canInterface untouched');\n return null;\n}\n\n// Prefer plain can0/can1 over vecan0/vecan1 if both happen to exist\ncanIfaces.sort((a, b) => (a.startsWith('ve') ? 1 : 0) - (b.startsWith('ve') ? 1 : 0));\n\nconst chosen = canIfaces[0];\nflow.set('canInterface', chosen);\n\nmsg.payload = `Detected CAN interface: ${chosen} (candidates found: ${canIfaces.join(', ')})`;\nreturn msg;",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 605,
"y": 100,
"wires": [
[
"37cbb11252d7377a"
]
]
},
{
"id": "37cbb11252d7377a",
"type": "debug",
"z": "493f26a77a9ec46e",
"name": "CAN interface detection result",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 855,
"y": 100,
"wires": []
},
{
"id": "708269b11fe3d756",
"type": "comment",
"z": "493f26a77a9ec46e",
"name": "Auto-detects CAN interface on every deploy",
"info": "Runs 'ls /sys/class/net' once, ~1s after deploy, and sets flow.canInterface to whichever of can0/can1/vecan0/vecan1 is found (preferring plain can* over vecan* if both exist). Check the debug sidebar to confirm what was detected. If it ever picks the wrong one (e.g. both present), use the manual 'CAN interface = ...' buttons to override.",
"x": 235,
"y": 60,
"wires": []
}
]