Skip to content

adrian-evo/alexa-control

Repository files navigation

alexa-control

Start stop radio stations by schedule or menu in MacOS.

Used AI-assisted development, all code AI generated.

Quick Start

Start All Services (Scheduler + Menubar)

npm start
# or
./start-all.sh

Stop All Services

npm stop
# or
./stop-all.sh

Start Services Individually

Start Scheduler Only:

npm run scheduler
# or
./service.sh start

Start Menubar Only:

Option 1: Double-click (macOS)

  1. First time only - make the file executable:
    chmod +x menubar/start-menubar.command
  2. Double-click menubar/start-menubar.command in Finder

Option 2: Terminal

npm run menubar
# or
cd menubar && npm start

Check Status

npm run status
# or
./service.sh status

Refresh Amazon Cookie

Important: Amazon cookies are valid for 14 days and are automatically refreshed by the application every 7 days. You should rarely need to manually refresh!

Only refresh manually if:

  • The app hasn't run for more than 14 days (cookie expired)
  • You're setting up for the first time
  • You see persistent "Error: no JSON" authentication failures
npm run refresh

This will:

  1. Start a proxy server at http://localhost:3456
  2. Open that URL in your browser
  3. Log in to your Amazon account (amazon.com or amazon.de)
  4. Automatically save the new cookie and registration data

How automatic refresh works:

  • Cookie is valid for 14 days
  • App refreshes it automatically every 7 days
  • Uses OAuth tokens (no manual login needed after initial setup)
  • Refresh happens in the background without interruption

Note: One-time authentication errors are usually network issues or Amazon rate-limiting. The app will retry automatically. Only use manual refresh if errors persist for days.

Architecture

  • Scheduler Service: Automated radio playback based on schedule.json (runs as background daemon)
  • Menubar App: Manual control UI in system tray (Electron app)
  • Both services run independently and can be started/stopped separately

Logging

The system uses unified log files with errors marked inline:

  • logs/scheduler.log - All scheduled task activity and errors
  • logs/menubar.log - All menubar app activity and errors

Errors are marked with ERROR: prefix in the same file. No separate error logs needed.

View logs:

# Watch scheduler logs in real-time
tail -f logs/scheduler.log

# Watch menubar logs in real-time  
tail -f logs/menubar.log

# Search for errors
grep ERROR logs/scheduler.log
grep ERROR logs/menubar.log

First-time setup or after updating:

# Clean up old log files (output.log, error.log, menubar-error.log)
./cleanup-logs.sh  # macOS/Linux
cleanup-logs.cmd   # Windows

# Reinstall scheduler service to use new logging configuration
./service.sh stop
./service.sh install
./service.sh start

Troubleshooting

Check Logs

All activity is logged to logs/scheduler.log and logs/menubar.log. Errors are marked with ERROR: prefix.

Common Issues

Old log files still being created: You need to reinstall the scheduler service after updating:

./service.sh stop
./service.sh install
./service.sh start

Scheduler not running:

npm run status
# If not running: npm run scheduler

Authentication errors: Only refresh if errors persist:

npm run refresh

View active schedules: Check logs/scheduler.log for the schedule list printed at startup.

About

Start stop radio stations by schedule or menu in MacOS.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors