This guide covers all external integrations available in LFS-Ayats for notifications, streaming, and cloud backup.
Send real-time notifications to Discord channels using webhooks.
Server Settings → Integrations → WebhooksNew Webhookintegrations:
discord:
enabled: true
webhook_url: "https://discord.com/api/webhooks/YOUR_WEBHOOK_ID/YOUR_TOKEN"
notifications:
personal_best: true
session_summary: true
anomalies: true
from src.integrations import DiscordIntegration
discord = DiscordIntegration(webhook_url="https://discord.com/api/webhooks/...")
# Send a personal best notification
await discord.notify_personal_best({
'circuit': 'Blackwood GP',
'time': 98.456,
'vehicle': 'XF GTI',
'improvement': 0.234,
'timestamp': datetime.now().isoformat()
})
See examples/discord_integration_example.py for complete examples.
Send notifications and receive commands through a Telegram bot.
/newbot and follow the instructionsintegrations:
telegram:
enabled: true
bot_token: "123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11"
chat_id: "123456789"
from src.integrations import TelegramIntegration
telegram = TelegramIntegration(
bot_token="YOUR_BOT_TOKEN",
chat_id="YOUR_CHAT_ID"
)
# Send a formatted message
await telegram.send_message(
"<b>System Status:</b> ✅ Online\n"
"<i>Drivers connected:</i> 8"
)
# Send a photo
await telegram.send_photo(
photo_path="telemetry_chart.png",
caption="📊 Session telemetry"
)
See examples/telegram_integration_example.py for complete examples.
Display real-time telemetry data in OBS Studio or other streaming software.
from src.integrations import StreamingOverlay
overlay = StreamingOverlay(port=5000)
overlay.start()
Browser source to your scenehttp://localhost:50001920, Height: 1080Shutdown source when not visibleintegrations:
streaming:
enabled: true
overlay_port: 5000
update_rate: 10 # Hz
overlay = StreamingOverlay(port=5000)
overlay.start()
# Update telemetry data
overlay.update_telemetry({
'speed': 120.5,
'rpm': 6500,
'gear': 4,
'lap_time': 98.456,
'position': '2/10'
})
See examples/streaming_overlay_example.py for a complete example.
Automatically backup telemetry data to Google Drive or Dropbox.
pip install google-api-python-client google-auth-httplib2 google-auth-oauthlib
integrations:
cloud_backup:
enabled: true
provider: google_drive
auto_backup: true
backup_interval: 3600 # seconds
credentials_path: ./credentials.json
folder_id: null # Optional: specify folder ID
pip install dropbox
integrations:
cloud_backup:
enabled: true
provider: dropbox
auto_backup: true
backup_interval: 3600
credentials_path: null # Not needed for Dropbox
from src.integrations import GoogleDriveIntegration
# Upload a single file
gdrive = GoogleDriveIntegration('./credentials.json')
file_id = gdrive.upload_session('session_data.json')
# Auto-backup all files
count = gdrive.auto_backup(
'./data/',
folder_id='optional_folder_id',
file_extensions=['.json', '.csv']
)
See examples/cloud_storage_example.py for complete examples.
integrations:
# Discord notifications
discord:
enabled: true
webhook_url: "${DISCORD_WEBHOOK_URL}" # Use environment variable
bot_token: null # Optional: for bot commands
notifications:
personal_best: true
session_summary: true
anomalies: true
# Telegram bot
telegram:
enabled: false
bot_token: "${TELEGRAM_BOT_TOKEN}"
chat_id: "${TELEGRAM_CHAT_ID}"
# Streaming overlay
streaming:
enabled: false
overlay_port: 5000
update_rate: 10 # Hz
# Cloud backup
cloud_backup:
enabled: false
provider: google_drive # or dropbox
auto_backup: true
backup_interval: 3600 # seconds (1 hour)
credentials_path: ./credentials.json
folder_id: null # Optional Google Drive folder ID
For security, use environment variables for sensitive data:
export DISCORD_WEBHOOK_URL="https://discord.com/api/webhooks/..."
export TELEGRAM_BOT_TOKEN="123456:ABC-DEF..."
export TELEGRAM_CHAT_ID="123456789"
Then reference them in config.yaml:
integrations:
discord:
webhook_url: "${DISCORD_WEBHOOK_URL}"
See examples/integrated_system_example.py for a complete example showing how to use all integrations together.
from src.integrations import (
DiscordIntegration,
TelegramIntegration,
StreamingOverlay,
GoogleDriveIntegration
)
# Initialize all integrations
discord = DiscordIntegration(webhook_url="...")
telegram = TelegramIntegration(bot_token="...", chat_id="...")
overlay = StreamingOverlay(port=5000)
overlay.start()
# On personal best
await discord.notify_personal_best(lap_data)
await telegram.notify_personal_best(lap_data)
# Update streaming overlay in real-time
overlay.update_telemetry(telemetry_data)
# Backup session at end
gdrive.upload_session('session_data.json')
examples/discord_integration_example.pyexamples/telegram_integration_example.pyexamples/streaming_overlay_example.pyexamples/cloud_storage_example.pyexamples/integrated_system_example.pyupdate_rate in config and that telemetry data is being sentFor detailed API documentation, see:
src/integrations/discord_integration.pysrc/integrations/telegram_integration.pysrc/integrations/streaming_overlay.pysrc/integrations/cloud_storage.pyEach module contains comprehensive docstrings with usage examples.