hass-agent / HASS.Agent

Unofficial development project for the HASS.Agent platform.
https://hass-agent.io
MIT License
410 stars 12 forks source link

Feature: Send parameter to hass.agent command like in IR devices #190

Open urri34 opened 1 month ago

urri34 commented 1 month ago

Please make sure that the feature you'd like to request is not already requested :)


Is your feature request related to a problem? Please describe. I make scripts that work for me in my LAN, they onlyuse one variable, the IP. I like to call them thru Home Assistant buttons. That home assistant buttons call hass.agernt commands that execute the script with the desired IP parameter. I need to have one command in hass.agent for each IP I want to use the script on. There is no option to send a parameter from Home Assistant to hass.agent commands.

Describe the solution you'd like Working with Home Assistant I realized that the infra red devices can be the solution. You can call an infrared device with a parameter (in that case the infrared signal code to send)

Describe alternatives you've considered I'm not able to find any alternative that is not the 1 ip -> 1 command option. And it works really nice but it's hard to mantain.

Additional context none

amadeo-alex commented 2 weeks ago

Hello, just to confirm some stuff as I'm not sure I understand everything: you'd like for PowershellCommand to accept arguments?

urri34 commented 1 week ago

Yes but the arguments should be send from the HA. Same script but different arguments.

amadeo-alex commented 1 week ago

I might not be catch everything but I think it's already supported. Example:

action: mqtt.publish
data:
  topic: homeassistant/button/AMADEO-PC/powershell/action
  payload: sum argument 4 the script

Command: obraz

script2.ps1:

$wshell = New-Object -ComObject Wscript.Shell
$wshell.Popup("runs " + $PsBoundParameters.Values + $args,1,"Done",0x1)
$PsBoundParameters.Values >> sumlogs2.txt

Result: obraz

urri34 commented 2 days ago

You catch it perfectly! It was just me that I was not able to think about the kind of solution you are proposing. Sending it thru the payload and receiving it thru the PsBoundParameters.Values is the point.

SOLVED

Thank you very much for your time!