feat: add homelab deployment configs, documentation, and automation scripts
This commit is contained in:
28
scripts/find_ha_entities.py
Normal file
28
scripts/find_ha_entities.py
Normal file
@@ -0,0 +1,28 @@
|
||||
import paramiko
|
||||
import sys
|
||||
import json
|
||||
|
||||
sys.stdout.reconfigure(encoding='utf-8')
|
||||
c = paramiko.SSHClient()
|
||||
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
||||
c.connect('140.44.4.71', username='root', key_filename=r'C:\Users\Snarf\.ssh\id_ed25519_snarfnet', timeout=10)
|
||||
|
||||
ha_token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiIzZWUyNTE1MDk0NGU0ZjRjYmJkMGM1MWI5MThmY2EzYiIsImlhdCI6MTc0NjgxMDM3NSwiZXhwIjoyMDYyMTcwMzc1fQ.Le6M7WL63nxtLTxccFacQR5GVUY5C-a_zGtmXT_uaz4"
|
||||
|
||||
cmd = f"""curl -s -H "Authorization: Bearer {ha_token}" -H "Content-Type: application/json" http://14.4.4.20:8123/api/states"""
|
||||
_, stdout, stderr = c.exec_command(cmd)
|
||||
raw = stdout.read().decode()
|
||||
|
||||
try:
|
||||
states = json.loads(raw)
|
||||
print(f"Total HA entities: {len(states)}")
|
||||
weatherflow_entities = [s for s in states if any(k in s['entity_id'].lower() for k in ['tempest', 'weatherflow', 'weather'])]
|
||||
print(f"\nFound {len(weatherflow_entities)} Tempest / Weather entities:")
|
||||
for s in weatherflow_entities:
|
||||
print(f" - {s['entity_id']} = {s['state']} (name: {s.get('attributes', {}).get('friendly_name')})")
|
||||
except Exception as e:
|
||||
print("Error parsing HA response:", e)
|
||||
print("Raw output preview:", raw[:500])
|
||||
|
||||
c.close()
|
||||
|
||||
Reference in New Issue
Block a user