86 lines
2.8 KiB
Python
86 lines
2.8 KiB
Python
"""
|
|
Script auxiliar para configurar VoiceMonkey para el protocolo de apagado.
|
|
|
|
Este script NO puede crear automáticamente los monkeys (VoiceMonkey no tiene API pública para eso),
|
|
pero te guía paso a paso para crearlos manualmente en la web.
|
|
"""
|
|
import os
|
|
import sys
|
|
from dotenv import load_dotenv
|
|
|
|
# Fix encoding para Windows
|
|
if sys.platform == 'win32':
|
|
import codecs
|
|
sys.stdout = codecs.getwriter('utf-8')(sys.stdout.buffer, 'strict')
|
|
sys.stderr = codecs.getwriter('utf-8')(sys.stderr.buffer, 'strict')
|
|
|
|
# Cargar .env
|
|
dotenv_path = os.path.expanduser("~/Documents/GitHub/biblioteca_negocio_prolongo/.env")
|
|
load_dotenv(dotenv_path)
|
|
|
|
def main():
|
|
print("=" * 70)
|
|
print(" CONFIGURACIÓN DE VOICEMONKEY PARA PROTOCOLO DE APAGADO")
|
|
print("=" * 70)
|
|
print()
|
|
|
|
token = os.getenv("VOICEMONKEY_TOKEN")
|
|
device = os.getenv("VOICEMONKEY_DEVICE")
|
|
|
|
if not token:
|
|
print("[X] ERROR: Falta VOICEMONKEY_TOKEN en .env")
|
|
print()
|
|
print("1. Ve a https://voicemonkey.io/")
|
|
print("2. Inicia sesion con tu cuenta de Amazon")
|
|
print("3. Ve a Settings -> API Token")
|
|
print("4. Copia el token y anadelo al .env:")
|
|
print(" VOICEMONKEY_TOKEN=<tu-token>")
|
|
return
|
|
|
|
print(f"[OK] Token encontrado: {token[:20]}...")
|
|
print(f"[OK] Device: {device}")
|
|
print()
|
|
print("=" * 70)
|
|
print(" INSTRUCCIONES PARA CREAR LOS MONKEYS")
|
|
print("=" * 70)
|
|
print()
|
|
print("1. Abre https://voicemonkey.io/monkeys en tu navegador")
|
|
print()
|
|
print("2. Haz clic en 'Add New Monkey'")
|
|
print()
|
|
print("3. MONKEY 1: apagar-barras")
|
|
print(" - Monkey ID: apagar-barras")
|
|
print(" - Device: " + (device or "<elige tu Echo>"))
|
|
print(" - Action: Announcement")
|
|
print(" - Text: (vacio)")
|
|
print()
|
|
print("4. Guarda y crea una RUTINA en la app Alexa:")
|
|
print(" - Nombre: Apagar barras")
|
|
print(" - Cuando: Voz (di 'Alexa, apagar barras')")
|
|
print(" - Accion: Smart Home -> Apagar 'barras'")
|
|
print()
|
|
print("5. MONKEY 2: apagar-cuartillo")
|
|
print(" - Monkey ID: apagar-cuartillo")
|
|
print(" - Device: " + (device or "<elige tu Echo>"))
|
|
print(" - Action: Announcement")
|
|
print(" - Text: (vacio)")
|
|
print()
|
|
print("6. Guarda y crea otra RUTINA en la app Alexa:")
|
|
print(" - Nombre: Apagar cuartillo")
|
|
print(" - Cuando: Voz (di 'Alexa, apagar cuartillo')")
|
|
print(" - Accion: Smart Home -> Apagar 'cuartillo'")
|
|
print()
|
|
print("=" * 70)
|
|
print(" VERIFICACIÓN")
|
|
print("=" * 70)
|
|
print()
|
|
print("Una vez creados los monkeys y las rutinas, prueba:")
|
|
print()
|
|
print(" python protocolo_apagado_test.py")
|
|
print()
|
|
print("Las luces 'barras' y 'cuartillo' deberían apagarse.")
|
|
print()
|
|
|
|
if __name__ == "__main__":
|
|
main()
|