Skip to content

Xeferis/MQTT_USB_Switcher

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MQTT_USB_Switcher

Current Progress: Check Milestones

Introduction

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

Parts

  • ESP32 Microcontoller (Link
  • Arduino Relais (Link)
  • UGREEN USB 3.0 Switcher (Link)
  • 0,91" OLED Display (Link)
  • Wires
  • 2x 10k Ohm Resistor

Software needed

  • HomeAssistant (Link)
  • MQTT Brooker Add-On (Link)

Setup

Communication

MQTT

Display

For information purposes I installed an 128x32px OLED display. It shows following informations:

  • WLAN SSID
  • WLAN Strenght in %
  • IP Address
  • Current selected USB Out

PINs

Output

PIN 2: Status LED wich ouput is selected.
PIN 4: Controlls the relais.

Input

PIN 26: Output 1 is selected
PIN 27: Output 2 is selected

Reserved

PIN 21: Used for OLED connection (I2C SDA)
PIN 22: Used for OLED connection (I2C SCL)


How does it work ?

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


Wiring diagram

alt Text