thanks, this was the missing piece (btw: I've edited my first post for other beginners with the same question)
Now I can power off my wifi socket if
a) an event tells me the print job has finished
b) I select my custom shutdown system action
Just in sense of transperancy, these are my config/script:
- command: sudo /home/pi/poweroff.sh
- action: safepoweroff
command: sudo /home/pi/poweroff.sh
confirm: Raspberry Pi will shutdown and power socket will be turned
off in 45s.
name: Custom PowerOff
script to power off tasmota driven wifi switch:
curl --location --request -v -s 'http://MYHOST/cm?user=myuser&password=mypass&cmnd=Backlog%20Delay%20450%3BPower%20OFF' >/dev/null
shutdown -h now
I had some trouble using the system actions with sudo, so I allowed to run my poweroff.sh script without any password.
%sudo ALL=(ALL:ALL) NOPASSWD: /home/pi/poweroff.sh