Custom command works if command is .bat file but not if the commands itself is entered

I have the following command
"C:\Program Files (x86)\Sound Volume View\SoundVolumeView.exe" /SetSpatial "2- B10PRO\Device\Speakers\Render" ""
"C:\Program Files (x86)\Sound Volume View\SoundVolumeView.exe" /SetSpatial "2- B10PRO\Device\Speakers\Render" ""
which references an external application, but it runs fine if i have hass agent execute a .bat file that contains the command. If I put the command directly into the command field, however, it simply doesnt execute. I checked the log files, I see nothing at the relevant timestamp
19 Replies
HASS.Agent Helper
Help us Help Others!
To help others find answers, you can mark your question as solved via Right click solution message -> Apps -> ✅ Mark Solution
From An unknown user
HASS.Agent Helper
Help us Help You!
Please don't delete messages or posts because it makes it impossible to understand what happened. If you don't want your messages to be seen then don't post here. Please provide us with the version number of your app.
You can find it by clicking the ? at the bottom of the main page and checking under the logo that shows.
We will help as soon as possible. While you're waiting you can try the following:
- Checkout the documentation. - Search here in discord for previously solved similar issues.
HASS.Agent Helper
@Amadeo
Ellie
EllieOP2mo ago
iirc theres a way to get the visible terminal to see if its through an error but idr how
DrR0x
DrR0x2mo ago
Have you got it setup as a custom command with that command? or a blank with an action payload from Home Assistant?
DrR0x
DrR0x2mo ago
something like this?
No description
Ellie
EllieOP2mo ago
i have it setup as a custom command yeah, not using a payload
DrR0x
DrR0x2mo ago
Could you try it with a powershell command?
Ellie
EllieOP2mo ago
does not seem to work either way with the powershell command, either as a command or trying to execute the bat file. both work fine running it myself in powershell
Amadeo
Amadeo2mo ago
hmm I don't have this specific program but I'll configure a dummy command to see it the parameters are passed on correctly and update hm, command itself looks ok when passed on to cmd now to find a way for me to really check it without installing this sound volume view does it work when you do
cmd.exe "C:\Program Files (x86)\Sound Volume View\SoundVolumeView.exe" /SetSpatial "2- B10PRO\Device\Speakers\Render" ""
cmd.exe "C:\Program Files (x86)\Sound Volume View\SoundVolumeView.exe" /SetSpatial "2- B10PRO\Device\Speakers\Render" ""
?
Ellie
EllieOP2mo ago
it does not, no i am currently on 2.1.0 though and i did see the 2.1.1 beta had this listed:
PowershellCommand argument handling where passing arguments containing spaces/quotes would cause the command to fail (thanks @greghesp for reporting) #204
I'm wondering if this is related maybe?
Amadeo
Amadeo2mo ago
not exactly as it changed only the powershell command but that kind hints us why it doesn't work with hass.agent, what happens in the background is basically cmd.exe /c <your command> what about
cmd.exe /C ""C:\Program Files (x86)\Sound Volume View\SoundVolumeView.exe" /SetSpatial "2- B10PRO\Device\Speakers\Render" """
cmd.exe /C ""C:\Program Files (x86)\Sound Volume View\SoundVolumeView.exe" /SetSpatial "2- B10PRO\Device\Speakers\Render" """
or
cmd.exe /C ""C:\Program Files (x86)\Sound Volume View\SoundVolumeView.exe" "/SetSpatial" "2- B10PRO\Device\Speakers\Render" """
cmd.exe /C ""C:\Program Files (x86)\Sound Volume View\SoundVolumeView.exe" "/SetSpatial" "2- B10PRO\Device\Speakers\Render" """
Ellie
EllieOP5w ago
ah sorry i forgot to check this, ill do it tomorrow both of these work, no issue
Amadeo
Amadeo5w ago
Could you try putting them in the hass.agent config? Just remove "cmd /C " from the beginning, for example ''' ""C:\Program Files (x86)\Sound Volume View\SoundVolumeView.exe" /SetSpatial "2- B10PRO\Device\Speakers\Render" """ ''' Oh nice, codeblock do not work on mobile Thx discord
DrR0x
DrR0x5w ago
Nah you used the wrong character
""C:\Program Files (x86)\Sound Volume View\SoundVolumeView.exe" /SetSpatial "2- B10PRO\Device\Speakers\Render" """
""C:\Program Files (x86)\Sound Volume View\SoundVolumeView.exe" /SetSpatial "2- B10PRO\Device\Speakers\Render" """
Ellie
EllieOP5w ago
when you say put them in the config file do you mean just make a command cause if so, yeah this seems to work as well
DrR0x
DrR0x5w ago
Press win + r and then paste this:
%appdata%\LAB02 Research\HASS.Agent\config
%appdata%\LAB02 Research\HASS.Agent\config
In there you should be able to find your command config file, open it in an editor and manually change the command for the custom one to the code @Amadeo suggested above Oh wait the one above works, you can just use that then
Ellie
EllieOP5w ago
yeah both the last 2 suggestions work, it just looks like this in the commands.json lol
"Command": "\"\"C:\\Program Files (x86)\\Sound Volume View\\SoundVolumeView.exe\" /SetSpatial \"2- B10PRO\\Device\\Speakers\\Render\" \"\"\"",
"Command": "\"\"C:\\Program Files (x86)\\Sound Volume View\\SoundVolumeView.exe\" /SetSpatial \"2- B10PRO\\Device\\Speakers\\Render\" \"\"\"",
Amadeo
Amadeo5w ago
so you've edited them in the file or via UI? in general it's cmd quirkness when launches via process that requires those quotes (or rather their number) which is something that we prolly need to add to the docs rather than fix directly in code

Did you find this page helpful?