Files
ha-kiosk-dashboard/get-dashboard-urls.py
2025-12-31 04:26:43 -08:00

33 lines
1.2 KiB
Python

#!/usr/bin/env python3
import urllib.request
import json
TOKEN = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiI4NmM2ZGNlMTY2MWU0M2U5YjQ2MDI3MjMxYjE0NDFlMyIsImlhdCI6MTc2NzE3ODUyNiwiZXhwIjoyMDgyNTM4NTI2fQ.E8eShOsejwDYglixpgM_d_JYBlB1OVNhN7cHPnPiLOs"
HA_URL = "http://homeassistant.local:8123"
url = f"{HA_URL}/api/lovelace/dashboards"
req = urllib.request.Request(url)
req.add_header("Authorization", f"Bearer {TOKEN}")
try:
with urllib.request.urlopen(req) as response:
dashboards = json.loads(response.read().decode())
print("="*60)
print("AVAILABLE DASHBOARDS:")
print("="*60)
for dash in dashboards:
title = dash.get("title", "Unknown")
url_path = dash.get("url_path", "")
dash_id = dash.get("id", "")
print(f"\nTitle: {title}")
print(f"Path: {url_path}")
print(f"Direct Link: {HA_URL}/{url_path}/0")
if url_path == "dashboard-kiosk":
print(" ⭐ This is your Kiosk Dashboard!")
print("\n" + "="*60)
except Exception as e:
print(f"Error getting dashboards: {e}")
print("\nTry these URLs directly:")
print(f" {HA_URL}/dashboard-kiosk/0")
print(f" {HA_URL}/lovelace/default_view")