Current Progress: Check Milestones
Retrofitting an old ugreen usb switcher to be controlled via MQTT and Home Assistant and then Home Kit.
To achieve that, I used and ESP32 Board and one relais.
Installation on Chip with PlatformiO
- ESP32 Microcontoller (Link
- Arduino Relais (Link)
- UGREEN USB 3.0 Switcher (Link)
- 0,91" OLED Display (Link)
- Wires
- 2x 10k Ohm Resistor
MQTT
For information purposes I installed an 128x32px OLED display. It shows following informations:
- WLAN SSID
- WLAN Strenght in %
- IP Address
- Current selected USB Out
➡ PIN 2: Status LED wich ouput is selected.
➡ PIN 4: Controlls the relais.
⬅ PIN 26: Output 1 is selected
⬅ PIN 27: Output 2 is selected
❌ PIN 21: Used for OLED connection (I2C SDA)
❌ PIN 22: Used for OLED connection (I2C SCL)
The ESP32 controlls the Relais everytime it gets a command from HomeAssistant.
For every command it pulses for one second, so the Input on the UGREEN USB Switch changes.
On the setup I Always set the state. So in HomeKit "On" is Always Output 1 and "Off" is always Output 2