Ah, well that is unfortunate.
FYI for future reference, the home assistant CLI is an add-on which means it is a separate docker container from HA application itself. It has its own set of dependencies and filesystem other then the few shared folders such as
/config. So the fact that your command works when running it while ssh’ed in to the HA using one of the Terminal & SSH add-ons actually doesn’t tell you anything about whether it will work when run from HA using a command line sensor or shell command.
If you plan to do a lot of command line sensors and shell commands my advice is to install the Portainer add-on. That will let you get to the
homeassistant container (which is what actually runs HA) and access the console within that container. Then you can test your commands from there since that is running that command in the exact same way HA will be. If a command works in the console within the
homeassistant container then you know it will work from a sensor or shell command.
Well as long as its not relying on a file outside of
/share or any of the folder subsystems which actually persist over update. That’s the other gotcha to watch out for like I mentioned earlier, since it will appear to work in that case but break next update.