MDAR
6
I agree that hooking up your expensive PC directly is a risk.
But as you're using NodeRed, a simple £20 ESP device seems like a good option.
I am a big fan of the M5stickC-Plus for all kinds of tasks.
$10 M5StickC
$20 M5stickC-Plus
For example
While the flow and script I've created are a terrible overkill for what you're looking for, it would work perfectly.
There is a Grove port on the bottom of the M5StickC devices, which I've used as 2 GPi pins, to detect 0v contact closures.
The Arduino Script is configured for MQTT and Serial (via USB) communication, using a JSON structure.
I'm happy to share the script and sample Flow.
My longer term plan is to adapt my script to work with the smaller M5 Atom S3