GX IO Extender 150 – How to access digital input state in Node-RED / MQTT?

Hi, I’m trying to read the digital inputs from a GX IO Extender 150 in Node-RED on a Cerbo GX, but I can’t get the input state to appear in Node-RED.

I have two GX IO Extender 150 units, showing as device instances 50 and 51.

The physical inputs are definitely being detected by the GX. For testing I configured the input as a Generic pulse meter, and every time I apply an input the pulse count increases on the Cerbo GX display.

For example, the GX display shows the connection for one input as:

/run/io-ext/HQ2518DX63E/input_2

However, I cannot find the actual digital input state through MQTT/Node-RED.

I first tried subscribing directly to:

N/+/GxIOExtender/50/DigitalInput/+/State

but received nothing.

I then subscribed to # using an MQTT-in node connected to the Cerbo MQTT broker, and tried filtering msg.topic for:

/GxIOExtender/50/DigitalInput/2

but still receive nothing when the physical input changes.

The MQTT node shows connected, and the Cerbo itself is definitely seeing the input because the pulse meter increments.

What is the correct MQTT topic / D-Bus path for accessing the individual GX IO Extender 150 digital input state?

Ultimately I want to use the GX IO Extender inputs in Node-RED to control outputs/logic, so I need to detect the actual ON/OFF state of each input.

Any help identifying the correct service name, D-Bus path or MQTT topic would be greatly appreciated.

[{"id":"8a42ac99f845c177","type":"tab","label":"GX IO-Extender Input","disabled":false,"info":"","env":[]},{"id":"2b92418a1afac855","type":"victron-input-digitalinput","z":"8a42ac99f845c177","service":"com.victronenergy.digitalinput/10","path":"/State","serviceObj":{"service":"com.victronenergy.digitalinput/10","name":"Door alarm","communityTag":"digitalinput"},"pathObj":{"path":"/State","type":"enum","name":"Digital input state","enum":{"0":"low","1":"high","2":"off","3":"on","4":"no","5":"yes","6":"open","7":"closed","8":"ok","9":"alarm","10":"running","11":"stopped"}},"name":"","onlyChanges":false,"roundValues":"no","rateLimit":0,"conditionalMode":false,"condition1HysteresisEnabled":false,"condition1HysteresisThreshold":"","outputTrue":"true","outputFalse":"false","debounce":"2000","x":220,"y":380,"wires":[["8367c3a52d52e416","b4c29108efbbe9d1"]]},{"id":"e1c6f6a6e3cd8496","type":"victron-output-switch","z":"8a42ac99f845c177","service":"com.victronenergy.switch/50","path":"/SwitchableOutput/output_5/State","serviceObj":{"service":"com.victronenergy.switch/50","name":"GX IO extender 150","communityTag":"switch"},"pathObj":{"path":"/SwitchableOutput/output_5/State","type":"enum","enum":{"0":"Off","1":"On"},"name":"Output 5 state","mode":"both"},"name":"","onlyChanges":false,"roundValues":"no","rateLimit":0,"conditionalMode":false,"condition1Operator":">","condition1HysteresisEnabled":false,"condition1HysteresisThreshold":"","condition2Enabled":false,"condition2Service":"","condition2Path":"","condition2Operator":">","logicOperator":"AND","outputTrue":"true","outputFalse":"false","outputOnChange":false,"debounce":2000,"x":830,"y":380,"wires":[]},{"id":"8367c3a52d52e416","type":"function","z":"8a42ac99f845c177","name":"wrangle input value","func":"v = msg.payload;\n\nv = parseInt(v);\n\nif (Number.isInteger(v))\n{\n    /*\n    0 - low\n    1 - high\n    2 - off\n    3 - on\n    4 - no\n    5 - yes\n    6 - open\n    7 - closed\n    8 - ok\n    9 - alarm\n    10 - running\n    11 - stopped\n    */\n    v = v % 2;  // because they're pairs from the input values 0-11\n}\nelse\n{\n    v = 0;\n}\n\nmsg.payload = v;\n\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":510,"y":380,"wires":[["e1c6f6a6e3cd8496","800405e231b0c35f"]]},{"id":"800405e231b0c35f","type":"debug","z":"8a42ac99f845c177","name":"debug ouput value","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":770,"y":440,"wires":[]},{"id":"b4c29108efbbe9d1","type":"debug","z":"8a42ac99f845c177","name":"debug input value","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":770,"y":480,"wires":[]},{"id":"61765f16ddc0fb21","type":"global-config","env":[],"modules":{"@victronenergy/node-red-contrib-victron":"1.7.24"}}]

Lol, I can’t get the flow posting to work but the gist is use the Digital Input node, make sure you’re using one of the alarm state values for the input (the pulse counter doesn’t seem to allow access to the actual input state). Other wrinkle is that the input values are a bit odd and require some massaging (see that function)

Dean, you’re a legend! I’ve been trying to figure this out for a long time, and you’ve hit the nail on the head straight away.

Really appreciate you taking the time to help me out. Thanks again, mate!