I have searched a lot and found a lot of examples, but haven’t regonized a complete beginners example and still struggle:
How would I input a string (in the Lovelace UI), run a shell script with that value as input parameter and optional display the output result? - My installation is docker based on ubuntu.
Do I need entities? Which?
Which card as input?
How to pass the input to the script?
Which card and how to trigger the run?
(Optionally) Which card to display the result?
my configuration.yaml
:
shell_command:
testmyscript: bash /config/myScript.sh
I have placed the script in docker-containers root-folder on my host which I have mapped to the config-folder in the container. Here the part of my docker-compose.yaml
:
homeassistant:
container_name: home-assistant
image: homeassistant/raspberrypi3-homeassistant:stable
volumes:
- /home/docker-volumes/homeassistant:/config
my automation.yaml
:
- id: '1620048842570'
alias: Fire myScript
description: ''
trigger:
- platform: time
at: '17:00'
condition: []
action:
- service: shell_command.testmyscript
mode: single
my myScript.sh
:
#!/bin/bash
touch ./shell/Erfolg
pwd
Now I stuck. I can fire the automation, the file is created but where and how would I get the output from the pwd
-command.