alexbelgium / hassio-addons

My homeassistant addons
MIT License
1.38k stars 195 forks source link

🐛 [Birdnet-go] config.yaml always automatically altered at runtime to fail #1465

Closed tlj1899 closed 5 days ago

tlj1899 commented 6 days ago

Description

I get this error every time I run the add-on:

[00:45:05] INFO: Starting app... 2024/07/06 00:45:05 Error loading settings: error initializing viper: fatal error reading config file: While parsing config: yaml: line 27: did not find expected key

This is from the add-on modifying config.yaml to use improper alignment every time it runs, which causes a fatal error.

Reproduction steps

1. Fix and save config.yaml
2. Restart the add-on
3. Fatal viper error
4. Opening config.yaml reveals that the add-on modified the file which then triggered the fatal error
5. Repeats without end

Addon Logs

# Realtime processing settings
realtime:
    interval: 15 # duplicate prediction interval in seconds
    processingtime: false # true to report processing time for each prediction
    audio:
 source: "sysdefault" # audio source to use for analysis
 export:
 enabled: true # true to export audio clips containing indentified bird >
 debug: false # true to enable audio export debug messages
 path: /config/clips/ # path to audio clip export directory
 type: wav # only wav supported for now
 retention:
 policy: usage # retention policy: none, age or usage
 maxage: 30d # age policy: maximum age of clips to keep before starting >
 maxusage: 80% # usage policy: percentage of disk usage to trigger evict>
 minclips: 10 # minumum number of clips per species to keep before start>
    log:
 enabled: true # true to enable OBS chat log
 path: birdnet.txt # path to OBS chat log

Architecture

amd64

OS

HAos

alexbelgium commented 6 days ago

Hi sorry about that, I've changed the code to keep the indentation while changing on the fly the directories to use the ones specified in the addon options

tlj1899 commented 5 days ago

Problem fixed, thank you so much!