This is my first ESPHome project, and luckily it’s pretty simple. I can switching the port by pressing the button. It also exposes the current activated port.
Demo video: https://youtu.be/F_oZo9kNero
Source code & tutorial: GitHub - redphx/esphome-ugreen-hdmi-switcher: Control UGREEN HDMI Switcher/Splitter over WiFi using ESPHome