However when I try to execute the automation I get the following error:
Script does not support ‘response_variable’ for service ‘response_variable’ which does not support response data… Got {‘type’: ‘execute_script’, ‘sequence’: [{‘service’: ‘shell_command.test_return_code’, ‘response_variable’: ‘todo_response’}], ‘id’: 45}
Does anyone have a working configuration where they get the result of the shell command? If so please share it with the class.
I have tried to recreate it somehow using your example, but I fail to get “stdout”, “stderr” or “exit: 0” into a template.
I can’t get to grips with “extracting” the response variables. This is beyond my horizon.
“hifi_update” is the name of my response variable and this is the output:
results:
- device_id: 883d93ecc43bcf23e2108bf8ce3ab991
device_name: HiFi-System
success: true
command: sudo apt update && sudo apt upgrade
stdout:
- OK:1 http://packages.azlux.fr/debian bullseye InRelease
- OK:2 http://raspbian.raspberrypi.org/raspbian bullseye InRelease
- OK:3 http://archive.raspberrypi.org/debian bullseye InRelease
- OK:4 https://dtcooper.github.io/raspotify raspotify InRelease
- Paketlisten werden gelesen…
- Abhängigkeitsbaum wird aufgebaut…
- Statusinformationen werden eingelesen…
- Alle Pakete sind aktuell.
- Paketlisten werden gelesen…
- Abhängigkeitsbaum wird aufgebaut…
- Statusinformationen werden eingelesen…
- Paketaktualisierung (Upgrade) wird berechnet…
- >-
0 aktualisiert, 0 neu installiert, 0 zu entfernen und 0 nicht
aktualisiert.
stderr:
- ""
- >-
WARNING: apt does not have a stable CLI interface. Use with caution in
scripts.
- ""
- ""
- >-
WARNING: apt does not have a stable CLI interface. Use with caution in
scripts.
- ""
code: 0
All I want is to use “code: 0” for a template but I don’t know how. The “templating” is unfortunately the worst documentation available in Home Assistant. I’ve been working on it for months… how do you extract this data?