Detect arming failure to trigger parallel actions using mavros

Hello All,

I’m using a herelink controller with a pixhawk purple cube. I have intentionally set the hardware switch so that the arming checks fail. I have created an architecture which would allow my companion computer’s arming authorization to be triggered when this arming failure is detected.

I would like to know how can I detect this failure in arming(due to the hardware switch) and make it trigger a script to run. I can use mavros(or any other way you suggest I should try).

Thanks.