Figuring the correct way to publish a payload for powershell
So I'm having trouble getting custom payloads working with powershell. I am running
2.1.1-beta3
and the latest 2.1.1
integration.
I've had a decent play with possible variation on how to do this, and scoured the old and new docs, both github repos and general googling. At this point I figure I'm scratching my head.
I have made a PowershellCommand via the ui and set the command to C:\quicksetdns\QuickSetDNS.exe /SetDNS "1.1.1.1,1.0.0.1" "{F41A4233-02DA-42D6-A97B-A2D12F9FE0CD}"
which works a treat when I hit the entity button in HA, but what I'm looking to do is be able to set "1.1.1.1,1.0.0.1"
via payload to allow me to configure the dns I'm using via home assistant
Setting the command to just C:\quicksetdns\QuickSetDNS.exe
and a payload of /SetDNS "1.1.1.1,1.0.0.1" "{F41A4233-02DA-42D6-A97B-A2D12F9FE0CD}"
however doesn't seem to work.
I've tried wrapping the command in in quotes, I've tried variations of payload: >
and payload: >-
wit the payload data on a new line. I've tried escaping all non-alphanumeric characters, in different combinations with one another, along with wrapping the entire payload in it's own (unescaped) quotes, tried variations of this from within an automation block in the HA UI both with the visual editor and YAML editor (testing by hitting run on the block). I've tried it in the developer tools actions tab, I've even tried throwing the /SetDNS
into the command instead.
I've had a look at MQTTexplorer which seems to return /SetDNS "1.1.1.1,1.0.0.1" "{F41A4233-02DA-42D6-A97B-A2D12F9FE0CD}"
within what looks to be the correct topic (matches Agent)
I've tried leaving the Agent command blank and making the payload the entire command that worked via HA button, no dice
Finally I've watched HA logs and HASS.Agent logs (with extended logging enabled) which is flooded with one particular AudioManager error, and nothing else at all.
Any insight would be appreciated~Solution:
Jump to solution
While I couldn't seem to get anything working using that example, I have found a solution. I made the following custom executor using
C:\Program Files\PowerShell\7\pwsh.exe
and use one of your example payloads from above: /SetDNS \"1.1.1.1,1.0.0.1\" \"{F41A4233-02DA-42D6-A97B-A2D12F9FE0CD}\"

10 Replies
Help us Help Others!
To help others find answers, you can mark your question as solved via
Right click solution message -> Apps -> ✅ Mark Solution

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.
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.
quickest-silverOP•2mo ago
I've also realised I can simplify my testing by by not being on 'automatic dns' and using just
C:\quicksetdns\QuickSetDNS.exe /SetDNS
to put me back on it, which again works via entity button when that entire string is set as the agent command, but not when leaving command blank and using dev tools actions in HA with this string as payload regardless of escapes, yaml mode etcNumber one reason is quotes and escaping them
Haven't read your entire thread yet, will when I'm home.
AudioManager error listed as failure or FTL?
config should be a payload with main quotes(included in dev tools UI mode) and then escape any quotes used.
So on first look i would put the below in dev tools UI mode:
quickest-silverOP•2mo ago
QuickSetDNS.exe
runs a GUI app from cmdline when arguments aren't present
when I add your recommended payload to publish, it appears in MQTTexplorer but is not passed to the commandline or something, as the GUI appears instead of silently running with supplied arguments
quickest-silverOP•2mo ago
re: AudioManager, I have the following repeating over and over... it doesn't seem to be breaking anything I'm currently using though
Yep, FTLs just show with extended logging, they're just a check to see if something exists on Ur PC. Nothing to worry about
The problem with these is always how to test it without installing that app, I'll have a look at ipconfig or something with /arguments and get back to you
to be specific FTL + first change exception when debug is enabled 😄
sending quotes as payload required some flips here and there, especially with windows
can you check this for an example? https://discord.com/channels/1173033284519862392/1330664713796976651
Solution
quickest-silver•4w ago
While I couldn't seem to get anything working using that example, I have found a solution. I made the following custom executor using
C:\Program Files\PowerShell\7\pwsh.exe
and use one of your example payloads from above: /SetDNS \"1.1.1.1,1.0.0.1\" \"{F41A4233-02DA-42D6-A97B-A2D12F9FE0CD}\"

quickest-silverOP•4w ago
Can't figure why it doesn't work with the inbuilt powershell command, but a result is a result ty for the help