When I use bash to invoke decode-config.py to backup or restore my tasmota-devices, I always get a returncode of 0, even if the operation fails. This troubles me, because I only want to reset and / or upgrade my device once I have a working backup.
To Reproduce
I installed Python on a Debian Bookworm machine. I was unable to install the required "configargparse" module via pip, because Python runs in an externally managed environment.
So I set up a venv envireonment for my Tasmotascript under this path: /root/00-Tasmota/Tasmotascript
I activated the environment in my script like this:
Tasmota_Path=/root/00-Tasmota/Tasmotascript
source $Tasmota_Path/venv/bin/activate
# here the script does some testing for old backup files and walks through an array of IPs, but the line in question is this one:
$Tasmota_Path/venv/bin/decode-config.py -s $tasmota_ip --backup-file $Tasmota_Path/backups/$tasmota_ip.dmp
status=$?
if [ $status -eq 0 ]; then
echo "backup successfully done"
else
echo "there was an error during the backup"
fi
Expected behavior
If i use a non-tasmota IP in the $tasmota_ip variable, the backup option fails and the bash script should see the return code.
Append -g System to your decode-config parameter, e. g. decode-config.py -s myconfig.dmp -g System
Even when appending -g System to the call of decode-config in my script, it still always returns 0.
Additional context
Please be patient with me if this has to do with my bad understanding of venvs and not with decode-config. Thank you very much!
Edit: I installed the librarys systemwide with "--break-system-packages" flag. This way I can run the decode-config.py "directly" without a virtual environment. This also always returns 0.
Describe the bug
When I use bash to invoke decode-config.py to backup or restore my tasmota-devices, I always get a returncode of 0, even if the operation fails. This troubles me, because I only want to reset and / or upgrade my device once I have a working backup.
To Reproduce
Expected behavior
If i use a non-tasmota IP in the $tasmota_ip variable, the backup option fails and the bash script should see the return code.
Version Information
System' information of your Tasmota data
Append
-g System
to your decode-config parameter, e. g.decode-config.py -s myconfig.dmp -g System
Even when appending
-g System
to the call of decode-config in my script, it still always returns 0.Additional context
Please be patient with me if this has to do with my bad understanding of venvs and not with decode-config. Thank you very much!
Edit: I installed the librarys systemwide with "--break-system-packages" flag. This way I can run the decode-config.py "directly" without a virtual environment. This also always returns 0.