I am trying to assure a Sony Bravia TV is using its speakers rather than audio system prior to starting an automation action. The REST example came from: https://github.com/home-assistant/core/issues/88532 which was used to create a shell command that was added to configuration.yaml as:
The command works when entered directly in the terminal and there are no errors in the configuration.yaml file. (“xxxxxxxx” used in lieu of actual IP and PSK.)
However when envoked as a service call in an automation, for example:
action: shell_command.sonytv_speakers data: {}
nothing happens and the log error is:
``Logger: homeassistant.components.shell_command
Source: /usr/src/homeassistant/homeassistant/components/shell_command/init.py:129
integration: Shell Command (documentation, issues)
First occurred: 5:30:04 PM (1 occurrences)
Last logged: 5:30:04 PM
Sometimes the version of the command is not what you’re expecting. I have often had to create a shell command just to find the version of the command (e.g., which version of curl you have installed) so I can make sure it supports what I’m doing. If you’ve got simple curl commands working but complex ones don’t, check the version!
Thank you for your response and sorry I was not clear about my goal. I did follow the Shell Command integration instructions by first placing the shell_command in configuration.yaml and then calling it in the automation.
Upon reading the command guide you provided I think it provides an explanation how my command can work in a terminal but not through HAOS.
Ah, that was another thing I was going to ask (were you using HAOS). I don’t, but if it does have a shell that you can successfully run the command in, perhaps it’s somewhat as simple as prepending sh -c to your line to spawn the shell and have it run the command.