This integration provides real-time monitoring of your YouTube predownloader through Home Assistant using MQTT.
Add to your configuration.yaml:
mqtt:
broker: 192.168.1.100 # Your Home Assistant IP
port: 1883
username: mqtt_user # Optional
password: mqtt_pass # Optional
Or install the "Mosquitto broker" add-on from the Home Assistant Add-on Store.
Copy config_example.py to config.py and update:
MQTT_BROKER = "192.168.1.100" # Your Home Assistant IP
MQTT_PORT = 1883
MQTT_USERNAME = "mqtt_user" # If authentication enabled
MQTT_PASSWORD = "mqtt_pass" # If authentication enabled
pip install paho-mqtt psutil
The integration will automatically start when you run:
python3 main.py
The sensors will automatically appear in Home Assistant. Create a dashboard with:
type: entities
title: YouTube Predownloader
entities:
- sensor.youtube_download_queue
- sensor.youtube_conversion_queue
- sensor.youtube_download_progress
- sensor.youtube_conversion_progress
- sensor.youtube_download_speed
- sensor.youtube_cpu_usage
- sensor.youtube_memory_usage
- sensor.youtube_active_downloads
- sensor.youtube_active_conversions
type: gauge
entity: sensor.youtube_download_progress
min: 0
max: 100
name: Download Progress
type: horizontal-stack
cards:
- type: statistic
entity: sensor.youtube_download_queue
name: Download Queue
- type: statistic
entity: sensor.youtube_conversion_queue
name: Conversion Queue
type: history-graph
entities:
- sensor.youtube_cpu_usage
- sensor.youtube_memory_usage
hours_to_show: 2
automation:
- alias: "YouTube Downloads Complete"
trigger:
platform: state
entity_id: sensor.youtube_download_progress
to: "100"
action:
service: notify.mobile_app
data:
message: "🎬 All YouTube videos downloaded!"
automation:
- alias: "YouTube High CPU Alert"
trigger:
platform: numeric_state
entity_id: sensor.youtube_cpu_usage
above: 80
for: "00:05:00"
action:
service: notify.mobile_app
data:
message: "⚠️ YouTube predownloader using high CPU: {{ states('sensor.youtube_cpu_usage') }}%"
# If psutil can't access process info:
sudo python3 main.py
The integration publishes to these topics:
youtube_predownloader/sensor/*/state - Individual sensor valuesyoutube_predownloader/status - Combined JSON statushomeassistant/sensor/youtube_predownloader_*/config - Discovery configs