20-sep: [automatizacion] Morning routine (Tapo + WoL + AutoLogon + Apertura de pestañas)
This commit is contained in:
27
scripts/morning_routine/arranque_apps.ps1
Normal file
27
scripts/morning_routine/arranque_apps.ps1
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
# scripts/morning_routine/arranque_apps.ps1
|
||||||
|
# Tarea que se lanza automaticamente 1 minuto despues de iniciar sesion en Windows
|
||||||
|
|
||||||
|
Write-Host "Iniciando Morning Routine..."
|
||||||
|
|
||||||
|
# 1. Abrir WhatsApp (App de Windows Store)
|
||||||
|
Write-Host "Abriendo WhatsApp..."
|
||||||
|
Start-Process "whatsapp:"
|
||||||
|
|
||||||
|
# 2. Abrir Telegram Desktop
|
||||||
|
Write-Host "Abriendo Telegram..."
|
||||||
|
$telegramPath = "$env:APPDATA\Telegram Desktop\Telegram.exe"
|
||||||
|
if (Test-Path $telegramPath) {
|
||||||
|
Start-Process $telegramPath
|
||||||
|
}
|
||||||
|
|
||||||
|
# 3. Abrir Microsoft Edge con pestañas de Jira
|
||||||
|
Write-Host "Abriendo Jira en Edge..."
|
||||||
|
$edgeUrls = "https://prolongo.atlassian.net/jira/software/c/projects/DK/boards/2", "https://prolongo.atlassian.net/jira/software/c/projects/DS/boards/3"
|
||||||
|
Start-Process "msedge.exe" -ArgumentList $edgeUrls
|
||||||
|
|
||||||
|
# 4. Abrir Google Chrome con Correo y Calendario
|
||||||
|
Write-Host "Abriendo Gmail y Calendar en Chrome..."
|
||||||
|
$chromeUrls = "https://mail.google.com/mail/u/0/#inbox", "https://calendar.google.com/calendar/u/0/r"
|
||||||
|
Start-Process "chrome.exe" -ArgumentList $chromeUrls
|
||||||
|
|
||||||
|
Write-Host "Rutina completada. ¡Buenos días!"
|
||||||
22
scripts/morning_routine/enable_autologon.ps1
Normal file
22
scripts/morning_routine/enable_autologon.ps1
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
param(
|
||||||
|
[Parameter(Mandatory=$true, HelpMessage="Introduce la contrasena/PIN de Windows")]
|
||||||
|
[string]$Password
|
||||||
|
)
|
||||||
|
|
||||||
|
# Detectar usuario actual
|
||||||
|
$username = $env:USERNAME
|
||||||
|
$domain = $env:USERDOMAIN
|
||||||
|
|
||||||
|
$winlogonPath = "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon"
|
||||||
|
|
||||||
|
try {
|
||||||
|
Set-ItemProperty -Path $winlogonPath -Name "AutoAdminLogon" -Value "1"
|
||||||
|
Set-ItemProperty -Path $winlogonPath -Name "DefaultUserName" -Value $username
|
||||||
|
Set-ItemProperty -Path $winlogonPath -Name "DefaultPassword" -Value $Password
|
||||||
|
Set-ItemProperty -Path $winlogonPath -Name "DefaultDomainName" -Value $domain
|
||||||
|
|
||||||
|
Write-Host "[OK] AutoLogon habilitado correctamente para $domain\$username." -ForegroundColor Green
|
||||||
|
Write-Host "Al encenderse, el PC entrara directo a este escritorio sin pedir clave." -ForegroundColor Cyan
|
||||||
|
} catch {
|
||||||
|
Write-Host "[ERROR] Necesitas ejecutar este script como Administrador." -ForegroundColor Red
|
||||||
|
}
|
||||||
36
scripts/morning_routine/rpi_despierta_pc.py
Normal file
36
scripts/morning_routine/rpi_despierta_pc.py
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
import os
|
||||||
|
import time
|
||||||
|
import asyncio
|
||||||
|
from wakeonlan import send_magic_packet
|
||||||
|
from plugp100.api.tapo_client import TapoClient
|
||||||
|
from plugp100.api.plug_device import PlugDevice
|
||||||
|
|
||||||
|
# Credenciales de TAPO (leer del entorno en la Raspberry)
|
||||||
|
TAPO_USER = os.getenv("TAPO_USER")
|
||||||
|
TAPO_PASS = os.getenv("TAPO_PASS")
|
||||||
|
TAPO_IP = os.getenv("TAPO_IP") # La IP local del enchufe Tapo
|
||||||
|
|
||||||
|
# MAC detectada de la placa base del sobremesa
|
||||||
|
PC_MAC = "74-56-3C-CB-0E-CE"
|
||||||
|
|
||||||
|
async def main():
|
||||||
|
print("1. Encendiendo monitor via Tapo...")
|
||||||
|
try:
|
||||||
|
client = TapoClient(TAPO_USER, TAPO_PASS)
|
||||||
|
device = PlugDevice(client, TAPO_IP)
|
||||||
|
await device.login()
|
||||||
|
await device.turn_on()
|
||||||
|
print(" -> Enchufe Tapo encendido correctamente.")
|
||||||
|
except Exception as e:
|
||||||
|
print(f" -> Error al encender Tapo: {e}")
|
||||||
|
|
||||||
|
print("2. Esperando 3 segundos para estabilidad eléctrica...")
|
||||||
|
time.sleep(3)
|
||||||
|
|
||||||
|
print(f"3. Enviando paquete Wake-On-LAN al PC (MAC: {PC_MAC})...")
|
||||||
|
# Broadcast global para asegurar que llega de la 192.168.50.x a la 192.168.1.x
|
||||||
|
send_magic_packet(PC_MAC, ip_address='255.255.255.255')
|
||||||
|
print(" -> Comando de arranque enviado con éxito.")
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
asyncio.run(main())
|
||||||
Reference in New Issue
Block a user