mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-01-11 10:21:02 +01:00
Add ALSA_CARD from addon options
This commit is contained in:
@@ -6,9 +6,18 @@ set -e
|
||||
# INITALISATION #
|
||||
#################
|
||||
|
||||
bashio::log.info "ALSA_CARD option is set to $(bashio::config "ALSA_CARD"). If the microphone doesn't work, please adapt it"
|
||||
echo " "
|
||||
|
||||
# Check if alsa_card is provided
|
||||
CONFIG_LOCATION="/config/config.yaml"
|
||||
if bashio::config.has_value "ALSA_CARD"; then
|
||||
alsa_card=$(bashio::config 'ALSA_CARD')
|
||||
bashio::log.info "ALSA_CARD option set to $alsa_card"
|
||||
bashio::log.info "ALSA_CARD option is set to ${alsa_card}. Please ensure it is the correct card"
|
||||
sed -i "s/card:.*/card: ${alsa_card}/g" "$CONFIG_LOCATION"
|
||||
yq -i -y ".audio.card = \"${alsa_card}\"" "${CONFIG_FILE}"
|
||||
fi
|
||||
|
||||
# Adjust microphone volume if needed
|
||||
if command -v amixer > /dev/null 2> /dev/null; then
|
||||
current_volume="$(amixer sget Capture | grep -oP '\[\d+%\]' | tr -d '[]%' | head -1 2> /dev/null || echo "100")" || true
|
||||
|
||||
Reference in New Issue
Block a user