HASS.Agent
HASS.Agent copied to clipboard
Bug: Powershell Action Command Parameters not being passed
Describe the bug hello! I'm having an issue running a powershell script from home assistant using hass.agent actional powershell commands. I can run my script itself from my HA, but I'm trying to use actions to pass a paramater to the script and I'm having trouble getting it working. I can track the action through MQTT explorer and can see it being passed, but the script open a popup with just "runs".
To Reproduce Automation script im using:
alias: Trigger PC Audio Change
description: when audio device input select is change, push set default device button
trigger:
- platform: state
entity_id:
- input_select.audio_devices
condition: []
action:
- service: switch.turn_on
data: {}
target:
entity_id: switch.scarlet_pc_set_default_device
- service: mqtt.publish
data:
topic: homeassistant/switch/scarlet-pc/scarlet-pc_set_default_device/action
payload: "{{states('input_select.audio_devices')}}"
- delay:
hours: 0
minutes: 0
seconds: 2
milliseconds: 0
- service: switch.turn_off
data: {}
target:
entity_id: switch.scarlet_pc_set_default_device
mode: single
Powershell Script
$wshell = New-Object -ComObject Wscript.Shell
$wshell.Popup("runs " + $PsBoundParameters.Values + $args,1,"Done",0x1)
HASS.Agent Command Configuration
Expected behavior popup window to show "run" then followed by the args supplied by the automation script's action payload.
Attempted Solutions Changing payload to the below value did not fix the issue.
payload: "-Arg1:{{states('input_select.audio_devices')}}"
Misc info (please complete the following information):
- Windows build (ideally screenshot/info of
winver.exe
output): Version 22H2 OS Build 19045.3208 - Windows' UI language: English
- HASS.Agent version: 2022.14.0
Please check what's applicable (multiple answers possible):
- [x] Installed via installer
- [ ] Installed manually
- [x] Problem occurs in HASS.Agent
- [ ] Problem occurs in Satellite Service
Logs No logs are changed whenever the associated automation script is run.
I was replicate this using master build of the staging repository - most likely this is an issue with how we try to pass on the arguments to "powershell.exe C:/somescript.ps1 someargument".