docs: document ALSA audio error fix for cron and update agent instructions

This commit is contained in:
Markus Graf
2026-05-01 07:33:25 +02:00
parent dd4b3367b0
commit 0c9108686b
2 changed files with 26 additions and 2 deletions
+3
View File
@@ -2,3 +2,6 @@
This project runs on a **Raspberry Pi 4 Model B (2018)**. This project runs on a **Raspberry Pi 4 Model B (2018)**.
Please take this into account for all code changes, dependencies (e.g., ARM architecture), and performance optimizations. Please take this into account for all code changes, dependencies (e.g., ARM architecture), and performance optimizations.
## Audio Output Note
When configuring audio or running tasks on this device, **always use the 3.5mm headphone jack (Audio Jack)** as the explicit audio output unless requested otherwise. The system might have HDMI devices as lower-index cards, which can cause headless/cron background scripts to fail with ALSA errors. Ensure tools and scripts explicitly target the correct audio card (usually `hw:2,0` or via a user-wide `~/.asoundrc` config).
+21
View File
@@ -56,3 +56,24 @@ To have the alarm start automatically at a specific time (e.g., 6:45 AM on weekd
## Author ## Author
Markus Graf (info@marksugraf.ch) Markus Graf (info@marksugraf.ch)
## Troubleshooting
**Audio issues when running via Cron (ALSA: Couldn't open audio device: Unknown error 524):**
If the script runs perfectly from the terminal but crashes when triggered by cron, it might be trying to use an invalid audio output (like a disconnected HDMI port) because background jobs don't have the same environment variables as interactive sessions.
To force the system to use the 3.5mm headphone jack (Audio Jack), you can create a `~/.asoundrc` file for the `pi` user with the following content:
```
pcm.!default {
type asym
playback.pcm {
type plug
slave.pcm "hw:2,0"
}
}
ctl.!default {
type hw
card 2
}
```
*(Note: Change `hw:2,0` and `card 2` to match your actual headphone jack card index, which you can find by running `aplay -l`).*