Files
ha-kiosk-dashboard/check-ha-integrations.py
2025-12-31 04:26:23 -08:00

100 lines
2.9 KiB
Python

#!/usr/bin/env python3
"""Check Home Assistant integrations and suggest kiosk additions"""
import urllib.request
import json
import sys
TOKEN = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiI4NmM2ZGNlMTY2MWU0M2U5YjQ2MDI3MjMxYjE0NDFlMyIsImlhdCI6MTc2NzE3ODUyNiwiZXhwIjoyMDgyNTM4NTI2fQ.E8eShOsejwDYglixpgM_d_JYBlB1OVNhN7cHPnPiLOs"
HA_URL = "http://homeassistant.local:8123"
def get_config():
"""Get Home Assistant config"""
url = f"{HA_URL}/api/config"
req = urllib.request.Request(url)
req.add_header("Authorization", f"Bearer {TOKEN}")
try:
with urllib.request.urlopen(req) as response:
return json.loads(response.read().decode())
except Exception as e:
print(f"Error getting config: {e}", file=sys.stderr)
return None
def get_services():
"""Get available services"""
url = f"{HA_URL}/api/services"
req = urllib.request.Request(url)
req.add_header("Authorization", f"Bearer {TOKEN}")
try:
with urllib.request.urlopen(req) as response:
return json.loads(response.read().decode())
except Exception as e:
print(f"Error getting services: {e}", file=sys.stderr)
return None
if __name__ == '__main__':
print("Checking Home Assistant setup...")
config = get_config()
services = get_services()
if config:
print(f"\nHome Assistant Version: {config.get('version', 'Unknown')}")
print(f"Location: {config.get('location_name', 'Unknown')}")
print(f"Timezone: {config.get('time_zone', 'Unknown')}")
print(f"Unit System: {config.get('unit_system', {}).get('length', 'Unknown')}")
if services:
print(f"\nAvailable Services: {len(services)}")
# Look for interesting services
interesting = ['rss', 'news', 'calendar', 'weather', 'media_player', 'notify']
found = []
for domain in services:
if any(x in domain.lower() for x in interesting):
found.append(domain)
if found:
print(f"Interesting services found: {', '.join(found)}")
print("\n" + "="*60)
print("SUGGESTIONS FOR KIOSK DASHBOARD:")
print("="*60)
print("""
1. WEATHER (Already have: weather.forecast_home)
- Current conditions
- Hourly forecast
- Daily forecast
- Sun times (sunrise/sunset)
2. NEWS & RSS FEEDS
- Fox News RSS feed
- Breaking news alerts
- Local news
- Custom RSS feeds
3. CALENDAR
- Upcoming events
- Today's schedule
- Next appointment
4. SYSTEM STATUS
- Home Assistant updates available
- System health
- Network status
5. CAMERA FEEDS (You have many!)
- Rotating camera views
- Motion detection status
6. TRANSPORTATION
- Public transport departures (you have Roslagsbanan sensors!)
- Next departure times
7. SMART HOME STATUS
- Active lights
- Recent events
- Device status
8. TIME & DATE
- Large clock
- Date
- Weather-based greetings
""")