alexa-pi / AlexaPi

Alexa client for all your devices! # No active development. PRs welcome # consider https://github.com/respeaker/avs instead
MIT License
1.33k stars 396 forks source link

AlexaPi doesn't respond beyond hello and yes with error code 504 #523

Open drservomonkey opened 1 year ago

drservomonkey commented 1 year ago

Thank you for reporting an issue with AlexaPi.

Make sure you are running the latest version of AlexaPi, and look through issues before submitting.

Check out our Wiki, and make sure to look at Debugging, and Audio debugging in particular before filing an issue.

In order to help troubleshooting, be sure to include the following information:

Output of the audio debugging script.

Your OS (including version) where you are running AlexaPi: Note: Raspbian older than Stretch is not supported! Raspberry Pi OS desktop(couldn't find version name)

Your hardware platform and model you are running on: RPi 3b

Python release (python3 --version): 3.9.2

Description of problem: I installed AlexaPi on a fresh on install and authorized it on localhost, got it to say hello on normal mode but doesn't respond to anything, then after running it on debug mode, replied to my speeches with a yes but in the terminal window shows an error : no 504

Expected: expected to respond relevantly

Problem-relevant config.yaml entries: i don't know if anything is wrong so here is the entire config file:

`# See https://github.com/alexa-pi/AlexaPi/wiki/Audio-setup-&-debugging
# to get a better idea of how to set things in here

# Level of log output
# default: INFO
# set to DEBUG for verbose logging
logging: INFO

sound:
  # Name of your microphone device: "raspberrypi"
  # leave empty for default
  input_device: ""

  playback_handler: "vlc"

  # you can go here with alsa, pulse or others
  # keep blank for the best audio output selected by the underlying code
  output: "alsa"
  # output device: "raspberrypi"
  # currently supports ALSA only
  output_device: "default"

  # if left empty, won't be passed to the underlying library / command if it supports it
  # if it doesn't 100% will be used
  default_volume: 80

  # Means the same as above, but is used for media (playing music for example)
  # Leave blank to use the same setting as for speech content
  media_output:
  media_output_device:
  media_default_volume:

  # Some device: "raspberrypi"
  # value is the number of seconds of silence to pad the beginning and end of the audio. Only
  # the sox handler supports this configuration option.
  playback_padding: 0

# Amazon Alexa settings
alexa:
  Client_ID: "amzn1.application-oa2-client.d--"
  Client_Secret: "2--"
  Device_Type_ID: "AlexaRPi"
  Security_Profile_Description: "AlexaRPi"
  Security_Profile_ID: "amzn1.application.9----"
  refresh_token: "**no**"

# See https://github.com/alexa-pi/AlexaPi/wiki/Triggers for the description of these options
triggers:
  platform:
    enabled: true
    voice_confirm: false

    # one of: oneshot-vad, continuous, continuous-vad
    event_type: "oneshot-vad"

    # only for "continuous" event_types
    long_press:
      # system command to run after pressing the button for _duration_ number of seconds
      # empty to disable
      command: ""

      # duration in seconds
      duration: 10

      # CURRENTLY DISABLED
      # optional audio file to play before executing the command
      # you might wanna use full path to make sure AlexaPi finds it
      # you can use {resources_path} for the path to the AlexaPi "resources" directory
      audio_file: ""

  pocketsphinx:
    enabled: true
    voice_confirm: true

    phrase: "alexa"
    threshold: 1e-10

  snowboy:
    enabled: false
    voice_confirm: true

    # Use your own model or a file from the default snowboy distribution:
    #
    # {distribution}/alexa.umdl
    # {distribution}/snowboy.umdl
    # {distribution}/alexa/alexa_02092017.umdl
    # {distribution}/alexa/alexa-avs-sample-app/alexa.umdl

    model: "{distribution}/alexa/alexa_02092017.umdl"
    sensitivity: 0.5

# Commands to run before and after an interaction begins. Leave empty to disable.
event_commands:

  # Example used to lower shairport-sync volume during interaction with alexa
  #     startup: "amixer set shairportvolume 100%"
  #     pre_interaction: "amixer set shairportvolume 10%-""
  #     post_interaction: "amixer set shairportvolume 10%+""
  # Note this assumes you have redirected shairport-syncs audio to a seperate softdevice
  # with control "shairportvolume". Example asound.conf avalible in the scripts folder

  # Command to run at the start of AlexaPi
  startup: ""

  # Command to run after a trigger is detected but before an interaction begins
  pre_interaction: ""

  # Command to run after the interaction has completed
  post_interaction: ""

  # Command to run during a clean shutdown of AlexaPi
  shutdown: ""

platform:
  # Name of your platform, e.g. raspberrypi, orangepi, desktop
  device: "raspberrypi"

platforms:
  # common config for all platforms (if they support the options)
  # can be overriden in the the respective platform sections
  common:

  chip:
    # GPIO Pin with button connected
    button: XIO-P1
    # GPIO Pin for the playback/activity light
    plb_light: XIO-P3
    # GPIO Pin for the recording light
    rec_light: XIO-P5

  raspberrypi:
    # GPIO Pin with button connected
    button: 18
    # GPIO Pin for the playback/activity light
    plb_light: 24
    # GPIO Pin for the recording light
    rec_light: 25

  orangepi:
    # GPIO Pin with button connected
    button: 20
    # GPIO Pin for the playback/activity light
    plb_light: 9
    # GPIO Pin for the recording light
    rec_light: 8

  desktop:
    min_seconds_to_record: 3

  dummy:

  magicmirror:
    # Magic Mirror - github.com/MichMich/MagicMirror
    # Integrates with MMM-AlexaPi module (github.com/dgonano/MMM-AlexaPi) to display listening, playback, etc status
    # Hostname of the AlexaPi HTTP server, leave empty for any name
    hostname: ""
    # Port the ALexaPi HTTTP server binds to
    port: 5055
    # Hostname of the Magic Mirror
    mm_hostname: "localhost"
    # Port of the Magic Mirror
    mm_port: "8080"
    # How ofter the Hearbeat fires in seconds
    hb_timer: 5

  hyperion:
    # Hostname of the Hyperion node's JSON server
    hyperion_json_host: "127.0.0.1"
    # Port of the Hyperion node's JSON server
    hyperion_json_port: 19444
    # Visual status as static 'color' or 'effect'
    # Overridden by 'hyperion_flash_state_xxx'
    hyperion_mode: "effect"
    # Running speed when visualizing as 'effect'
    hyperion_effect_speed: 1
    hyperion_priority: 1
    color_playback: [80, 213, 35]
    color_processing: [35,169,213]
    color_recording: [168, 35, 213]
    flash_duration: 500
    flash_frequency: 8
    # Use Strobe effect instead of default effect or static color
    flash_state_playback: true
    flash_state_processing: true
    flash_state_recording: true
    # Visualize playback state
    indicate_playback: true
    #Also print json request/response when in debug mode
    verbose: false

  serial:
    port: "/dev/ttyACM0"
    baudrate: 9600
    messages:
      trigger: ""
      playback_start: "g"
      playback_end: "x"
      recording_start: ""
      recording_end: ""
      processing_start: ""
      processing_end: ""
      failure: ""
      success: ""
`

Steps to reproduce:

what i did was install AlexaPi on a fresh os install via ssh completely

Traceback (if applicable): na

Additional info: this is how the debug mode outputs are:

2023-01-12 16:21:19 INFO: Triggered: pocketsphinx
2023-01-12 16:21:19 DEBUG: Stopping audio play
2023-01-12 16:21:19 DEBUG: Playing audio: /opt/AlexaPi/src/resources/alexayes.mp3
2023-01-12 16:21:19 DEBUG: Player State: State.Opening
2023-01-12 16:21:19 DEBUG: Player State: State.Playing
2023-01-12 16:21:19 DEBUG: Started play.
2023-01-12 16:21:20 DEBUG: Player State: State.Ended
2023-01-12 16:21:20 DEBUG: Finished play.
2023-01-12 16:21:20 DEBUG: Recording: Setting up
2023-01-12 16:21:20 DEBUG: Recording: Start
2023-01-12 16:21:20 DEBUG: Starting new HTTPS connection (1): access-alexa-na.amazon.com:443
2023-01-12 16:21:54 DEBUG: Start sending speech to Alexa Voice Service
2023-01-12 16:21:55 DEBUG: Recording: End
2023-01-12 16:21:55 DEBUG: Finished sending speech to Alexa Voice Service
2023-01-12 16:22:00 DEBUG: Processing Request Response...
2023-01-12 16:22:00 INFO: (process_response Error) Status Code: 504

i am a noob so i might not be able to comprehend too much jargon : thanks in advance

fazelian commented 1 year ago

I do not know if you have already solved the issue, I have the same problem and I think it is network related. The alexapi service can not respond due to network timeout error.