I run HA on a pi5 connected to my home network, mostly to monitor my 3D printers cameras, and control some tapo smart sockets and smart bulbs at the printers.
The things i 3D print are train simulator controllers, which use arduino’s to simulate joysticks and keyboards to control the trains in the simulator (SimRail)
I have this daft idea to use one of the switches on my train controller lighting panel to turn on and off a smart bulb,
The switch in question is a DPDT toggle switch, one ‘half’ of the double pole switch is used to send the signal to the computer to operate the ‘cab light switch’ in the simulated train, turning on and off the cab light.
And i want to use the ‘other half’ of the switch to send a signal to HA to turn a tapo smart bulb in a light fitting above my head on and off as the simulator’s cab light is turned on and off.
So when i’m pretending to drive a train in the dark, switching on the cab light turns on a real light above my head and illuminates my controls.
I’m not very good at programming things,
At first i looked at hacking a smart switch perhaps, but these all seem to use momentary switch inputs, or want mains voltage to them… this is a computer controller that is connected via USB, so all i have is 5 volts DC inside the controllers.
Then i thought i’d use a seperate arduino with a wifi shield, or maybe even and ESP32 with the built in wifi stuff, and have the toggle switch send a command to HA when it changes state, and that will then turn the smart bulb on and off as needed.
Here’s where i get confused to what i need,
an ESP32 or arduino of some sorts of course, as it will only have 2 inputs connected to it i want the smallest and cheapest one i can get that will work,
Then do i need to use ESP home on that board, and set things up so it talks to my HA server, and then on the HA server add some code to make it listen to the ESP32 and send the signal for on and off to the relevant tapo smart bulb?