health_play_predefined_retry


Overview

The health_play_predefined_retry application plays a predefined sound upon startup and monitors the health of the sound controller. If the sound controller encounters an issue, it will attempt to retry playing the sound until the controller is healthy again. The application also listens for emergency button presses and logs the emergency status.

Execution

The application can be executed with the following command:

python3 health_play_predefined_retry/ --auto-run

Inputs

  • –auto-run: Automatically runs the application upon startup.

Outputs

  • Logs when the predefined sound starts playing.

  • Logs any health status changes for the sound controller.

  • Logs emergency button presses and status changes.

Behavior

  • The application starts by attempting to play a predefined sound in the background.

  • It monitors the health of the sound controller, retrying to play the sound if the controller is not healthy.

  • If an emergency status is triggered, it logs the event and can stop the sound playback if needed.

  • The application finishes only when the user stops it manually.

Example Output

# python3 health_play_predefined_retry/ --auto-run
[INFO] [timestamp] [pyraya.health_play_predefined_retry]: Playing sound in background
[INFO] [timestamp] [pyraya.health_play_predefined_retry]: Waiting for the playing to finish...
[WARNING] [timestamp] [pyraya.health_play_predefined_retry]: CONTROLLER ERROR: The sound controller has failed
[WARNING] [timestamp] [pyraya.health_play_predefined_retry]: Waiting for it to recover to play the sound again
[INFO] [timestamp] [pyraya.health_play_predefined_retry]: TRYING AGAIN
[INFO] [timestamp] [pyraya.health_play_predefined_retry]: Playing sound in background
[WARNING] [timestamp] [pyraya.health_play_predefined_retry]: Emergency status! Button: Pressed, components: ['motion']
[INFO] [timestamp] [pyraya.health_play_predefined_retry]: Application finished!