This project was spawned by the desire to control uhubctl
from within Home Assistant.
This add-on takes advantage of the API provided by Home Assistant and is extremely easy to use. You no longer even need to set up credentials to connect to the MQTT server.
-
Navigate in your Home Assistant frontend to Supervisor -> Add-on Store.
-
Click the 3-dots menu at upper right ... > Repositories and add this repository's URL: https://github.com/mochipon/hassio-uhubctl
-
Scroll down the page to find the new repository, and click the new add-on named "MQTT Bridge for uhubctl"
-
Click Install and give it a few minutes to finish downloading.
-
Click Start, give it a few seconds to spin up.
By default, the add-on publishes telemetry data to the topic tele/uhubctl/localhost
. Find the target hub you want to control by checking Vendor ID (Vid
), Product ID (Pid
), and number of ports of each hub.
Here is an example of a yaml entry in Home Assistant to control Port 1
of HUB3-4
.
switch:
- platform: mqtt
name: USB Fan
unique_id: usb-fan
icon: "mdi:fan"
state_topic: "tele/uhubctl/localhost/HUB3-4/STATE"
value_template: "{{ value_json.POWER1 }}"
command_topic: "cmnd/uhubctl/localhost/HUB3-4/POWER1"
availability_topic: "tele/uhubctl/localhost/LWT"
payload_available: "Online"
payload_not_available: "Offline"