very new to ESP and HA automation but I have a good Electronic background,
I have a USB3 Switch that I use to switch Keyboard and Mouse between two Computers, the Switch has only one button on the main case, I got it from Amazon here
just connected the 2 open pins of relay to the button which works by sending an API command to HA after creating a webhook with automation.
now the issue is that I would like to detect which PC i’m on to prevent accidentally switching to the wrong PC, and I don’t think I really need the relay, I can use an Optocoupler to simulate the button on GPIO0 and I think I can use another GPIO and connect it to one of the LED’s on the USB Switch to detect which PC is on.
now i’m not really sure how I can configure ESPHome to use that GPIO and preventing the switch from Changing, I know I can use binary_sensor but I’m not sure how I can form the code,
but RealVNC wouldn’t work for me, PC2 is a Linux PC and my workstation, PC1 is Windows PC which I normally game on it and it’s off most of the time, I tried to get a real KVM Switch but without EDID emulation all of them they mess up the resolution, do instead to switch screen input I used HA since I’m using a LG Oled TV as a computer screen I was able to connect it to HA and switch inputs with Keyboard hotkeys.
Why? My desktop PC a Windows PC. My Plex server and myNAS are on Ubuntu. My MQTT broker server is on a Raspberry Pi. All of them are running the RealVNC server in the background. I can get to the desktop of any of them with just a few mouse clicks.
@stevemann will you be able to game on your PC while connected to a RealVNC session?
my gaming computer is (PC1) which is off most of time until I want to start gaming and that’s when I turn it on, my work Computer PC2 which is on most of the time, I don’t think you will be able to get a graphics performance for gaming using RealVNC.
No clue since I don’t play games on my PC. If you have gigabit LAN then I would guess not. But it costs nothing but time to try.
Are your monitors HDMI?
I do have an HDMI KVM switch in my server room that has a remote selector box. I haven’t opened it to check but I would bet that it’s no more than a dry-contact button to pull a signal line down. (Four buttons on the box plus ground uses all 6 wires in the plug ).
I also use Synergy. I have three computers on my desktop, each with their own monitor. Synergy lets me use one keyboard/mouse on all of them. I have my main PC, my video editing PC and my Ubuntu computer. When they are all on, I just move my mouse to whichever computer screen I want to use.
Here is a YouTube video that explains how Synergy works.
believe it or not I have tried all of them, my setup is simple 2 Computers connected to 48" OLED TV, and both are connected to HDMI, I’m able to switch TV inputs from HA with my keyboard and all I want to do is switch Keyboard and mouse from PC1 to PC2 vise versa without leaving my hands from my keyboard and reaching another button to switch.
I did try a handful KVM switch but those that don’t have EDID emulation everytime you switch between PC’s it messes up the resulotion and window arrangement, a KVM Switch with EDID emulation and support 4K@120Hz cost’s between 350-500$ if not more, and yet still I have to reach another button to switch between if that KVM Switch doesn’t have keyboard hotkey support.
as I said all I want to do is switch between PC’s and I have this ESP01s so why not use it, I know I can use ESP8266-12 which has more GPIO’s but if I can go smaller why not.
all I need is the ESPHome logic to be able to detect if I’m on PC2 and Press the hotkey for PC2 the ESP01 shouldn’t do anything but if i’m on PC2 and press hotkey for PC1 then ESP01 should simulate the button pressing on the USB switch.