diff --git a/birdnet-pi-zach/CHANGELOG.md b/birdnet-pi-zach/CHANGELOG.md index 8cfe01fbdc..75f6f1235a 100644 --- a/birdnet-pi-zach/CHANGELOG.md +++ b/birdnet-pi-zach/CHANGELOG.md @@ -1,3 +1,6 @@ +## 2026.08.15 (15-08-2026) +- Fix: `ALSA_CARD` now really selects the microphone. Its value was copied as-is into `REC_CARD`, but BirdNET-Pi hands `REC_CARD` to `arecord -D` / `ffmpeg -f alsa -i`, which expect an ALSA PCM name: a card index such as `1` gave `Unknown PCM 1` and no recording at all. It is now converted to `plughw:CARD=,DEV=0`, while a value that already is a PCM name (`dsnoop:CARD=Audio,DEV=0`, `default`, `null`, `pulse`, `pipewire`, ...) is used as provided +- Fix: writing `REC_CARD` no longer detaches `birdnet.conf` from `/config`. `sed -i` replaced the `$HOME/BirdNET-Pi/birdnet.conf` symlink with a regular file, so later edits from the WebUI went to a different file than the one the add-on had written; it now edits `/config/birdnet.conf` with `--follow-symlinks` ## 2026.07.10-2 (10-07-2026) - Minor bugs fixed ## 2026.07.10 (10-07-2026) diff --git a/birdnet-pi-zach/config.yaml b/birdnet-pi-zach/config.yaml index 401f3cf952..e87b2add01 100644 --- a/birdnet-pi-zach/config.yaml +++ b/birdnet-pi-zach/config.yaml @@ -116,5 +116,5 @@ tmpfs: true udev: true url: https://github.com/alexbelgium/hassio-addons/tree/master/birdnet-pi-zach usb: true -version: 2026.07.10.2 +version: 2026.08.15 video: true diff --git a/birdnet-pi-zach/rootfs/etc/cont-init.d/99-run.sh b/birdnet-pi-zach/rootfs/etc/cont-init.d/99-run.sh index 85c69008c8..d59313ab41 100755 --- a/birdnet-pi-zach/rootfs/etc/cont-init.d/99-run.sh +++ b/birdnet-pi-zach/rootfs/etc/cont-init.d/99-run.sh @@ -66,12 +66,25 @@ fi || true # Use ALSA CARD defined in add-on options if available if [ -n "${ALSA_CARD:-}" ]; then - bashio::log.warning "ALSA_CARD is defined, the birdnet.conf is adapt to use device $ALSA_CARD" - for file in "$HOME"/BirdNET-Pi/birdnet.conf /config/birdnet.conf; do - if [ -f "$file" ]; then - sed -i "/^REC_CARD/c\REC_CARD=$ALSA_CARD" "$file" - fi - done + # REC_CARD is passed as-is to "arecord -D" (scripts/birdnet_recording.sh) and to + # "ffmpeg -f alsa -i" (scripts/livestream.sh), so it must be an ALSA PCM name. + # ALSA_CARD holds a card index (1) or a card id (Audio), which are not PCM names: + # writing them as-is gives "Unknown PCM 1" and no recording at all. Build a PCM + # name from them, and pass through a value that already is one (plughw:...). + if [[ "$ALSA_CARD" == *:* ]] || [[ "$ALSA_CARD" =~ ^(default|null|pulse|pipewire)$ ]]; then + REC_CARD="$ALSA_CARD" + else + REC_CARD="plughw:CARD=${ALSA_CARD},DEV=0" + fi + bashio::log.warning "ALSA_CARD is defined, the birdnet.conf is adapted to use device $REC_CARD" + # --follow-symlinks : $HOME/BirdNET-Pi/birdnet.conf is a symlink to /config/birdnet.conf + # (01-structure.sh), and sed -i would replace it with a regular file, detaching it from + # the file the WebUI writes to. Only /config/birdnet.conf is updated directly, since the + # home-path symlink is writable by the pi/caddy user and could be repointed before this + # root-run script gets to it. + if [ -f /config/birdnet.conf ]; then + sed -i --follow-symlinks "/^REC_CARD/c\REC_CARD=$REC_CARD" /config/birdnet.conf + fi fi # Define permissions for audio