https://github.com/xeferis/mqtt_usb_switcher
Smarthome USB Switch
https://github.com/xeferis/mqtt_usb_switcher
esp32 esp32-arduino mqtt smarthome usb usb-switch usb-switcher
Last synced: about 2 months ago
JSON representation
Smarthome USB Switch
- Host: GitHub
- URL: https://github.com/xeferis/mqtt_usb_switcher
- Owner: Xeferis
- License: mit
- Created: 2023-08-29T12:59:49.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-06-26T10:32:39.000Z (almost 2 years ago)
- Last Synced: 2024-06-26T11:59:48.170Z (almost 2 years ago)
- Topics: esp32, esp32-arduino, mqtt, smarthome, usb, usb-switch, usb-switcher
- Language: C++
- Homepage:
- Size: 408 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# MQTT_USB_Switcher
Current Progress: Check [Milestones](https://github.com/Xeferis/MQTT_USB_Switcher/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](https://amzn.eu/d/09rRW8V)
- Arduino Relais ([Link](https://www.amazon.de/dp/B07BVXT1ZK?ref=ppx_pop_mob_ap_share))
- UGREEN USB 3.0 Switcher ([Link](https://www.amazon.de/dp/B01N6GD9JO?ref=ppx_pop_mob_ap_share))
- 0,91" OLED Display ([Link](https://amzn.eu/d/3ufx9ke))
- Wires
- 2x 10k Ohm Resistor
### Software needed
- HomeAssistant ([Link](https://www.home-assistant.io/))
- MQTT Brooker Add-On ([Link](https://mosquitto.org/))
---
## 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

---