Shell comand

Hello, I’m a beginner at HA and I’ve had good results.

However the Shell Command integration in the configuration.yalm file doesn’t work for me (included according to the documentation).

I tested manually the shell command via terminal with success, so the command line is ok.

After countless attempts, either through an automation calling a script or directly in the automation, it always indicates an error in the UI (does not find the created shell command), - there is a print below.

Interestingly, the YAML code does not return a syntax error.

I really don’t know what could be happening.
I followed in a similar way to some examples from the community and according to the documentation.

Steps:
-Shell command via Terminal tested ok
-Configuration.yaml ok
-YAML sintax testing via developer interface ok
-Restarted HA
-Manual execution of the automation does not return an error (despite the UI indicating it), but it does not carry out the command, i.e. it does not execute as manually executed via the terminal.
-I´m using a HASS integration version: 2024.10.4

In short, it always ignores the shell command saved in the Shell_Command integration in the configuration.yaml file


  • Configuration.yalm:

shell_command:
a_cam: find /homeassistant/www/images/ -mtime +3 -exec rm {} \


  • YALM code of automation:

alias: apagar video
description: “”
trigger:

  • platform: time
    at: “09:34:00”
    condition:

action:

  • action: shell_command.a_cam
    mode: single

print of error at UI:

So I would really appreciate some help.
Everything indicates that there is a lack of connection between the inclusion of the shell command in the configuration.yalm file and the execution via automation/script, which indicates that there is no definition of the “a_cam” command

I also don’t know what type of action to call in the integration.
The option to run a script does not work because script also returns the same error.

I don’t know if there is another specific type of action to include via UI in the automation to call a shell command

I’ll just link the answer I gave to a similar question:

/homeassistant doesn’t exist in the HA container. Try replacing it with /config as a first.

Thank you very much for your help.

My mistake prevented the shell_command option being visible at the automation actions.

In the HA terminal, the files are visible by address /homeassistant/www/images , but as you explained, it is not the correct one for the HA paths.

All I had to do was change the configuration.yam file .

Problem Solved.

Thank you very much!

Sorry by my writing errors since i’m not a fluente in English.