This confuse many new users.
The addons are in fact containers, which means they are actually another server than HA and it could actually also be on another hardware device.
the commands might be installed in the addon container, but not be present in the HA container.
Likewise folders might be mapped differently in the different containers.
Easiest way to check the command is by adding a monitor and keyboard to the HA server.
When you get the HA prompt, then type login and hit enter.
Next you need to run the docker command to execute your line on the homeassistant container, like docker container exec homeassistant <your command>
I did try to connect directly to HA Green as you suggested, but TBH I wasn’t really sure what I was doing. I could login to HA and I literally typed what you said (not sure if that is correct)
Maybe it is your test.txt file that is the issue.
I do not have that and ran docker container exec homeassistant tac scripts.yaml | head -n 5 and that works.
docker container exec homeassistant tac scripts.yaml | head -n 5
all that happened was the help file popped up.
Note, I have a ha > prompt on my screen. I tried exiting out of this but it just seems to reboot back to this screen. I have been reading that maybe the green is locked down and wont allow me to do what you suggested.
so back to the problem, how can I read from a file?
Objective was to log all visits of my lawnmower man in a file and display the last 5 visits on my dashboard. I would have access to the file if I needed more
Problem: it seems I can’t read from the file using command_line with my HA Green. It would be good if someone can confirm that. If true, there should be a warning on the purchase “warning, advanced concepts cannot be executed. This is the price you pay to have a protected environment”
My solution was to create 2x storage solutions. I kept the file for long term storage and deployed a second input_text helper to manage the 5 events on the dashboard.
Next step is to store the “days since last visit” against each entry
I have not used command_line sensor for a while, so I am a bit rusty on that part, but the file sensor require a setting to allow reading the files and it is listed as a note on the page for the sensor.
Maybe there is missing a note on the command_line sensor too.
If you can’t, it has nothing to do with a Green or not. Any system running HA OS would not be able to do it. But I have to little experience with command line sensor to confirm.