20-sep: Webhook apagar PC funcionando - callable desde cualquier sitio
This commit is contained in:
29
scripts/check_ha_config.py
Normal file
29
scripts/check_ha_config.py
Normal file
@@ -0,0 +1,29 @@
|
||||
import requests
|
||||
import os
|
||||
from dotenv import load_dotenv
|
||||
|
||||
load_dotenv(r'C:\Users\juanm\Documents\GitHub\biblioteca_negocio_prolongo\.env')
|
||||
|
||||
url = os.getenv('HOMEASSISTANT_URL')
|
||||
token = os.getenv('HOMEASSISTANT_TOKEN')
|
||||
|
||||
headers = {
|
||||
'Authorization': f'Bearer {token}',
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
|
||||
# Verificar estados
|
||||
response = requests.get(f'{url}/api/states', headers=headers)
|
||||
states = response.json()
|
||||
|
||||
# Buscar automation
|
||||
automations = [s for s in states if s['entity_id'].startswith('automation.')]
|
||||
print('Automations encontradas:')
|
||||
for a in automations:
|
||||
print(f' - {a["entity_id"]}: {a["state"]}')
|
||||
|
||||
# Buscar scripts
|
||||
scripts = [s for s in states if s['entity_id'].startswith('script.')]
|
||||
print('\nScripts encontrados:')
|
||||
for s in scripts:
|
||||
print(f' - {s["entity_id"]}: {s["state"]}')
|
||||
Reference in New Issue
Block a user