I have a couple of scripts that take fields as parameters and I’m looking for an easy way to invoke them. Ideally, I think it would be nice to have a widget/shortcut on my phone that would open a “form” ready to invoke the service, and ask values for the fields (potentially, would be nice that i could configure a distinct shortcut for a set of pre-filled items, so that if 1 of my “fields” is the media player I wanna play music on, I can have a shortcut directly for my Living Room and another for Bedroom).
Currently, I’m using Developer Tools > Service to get this behaviour, but it’s cumbersome and not easy to create shortcuts.
If such feature already exists, please let me know!
i’m not sure exactly what you’re looking for. perhaps if you sketched your ideal cx, it may help. however if you want an arbitrary form, you could serve up an html page that collected a form, then submitted a post back to ha. you can catch that post with an automation webhook trigger. a warning to be careful about security however… be careful how publicly you expose these access points and limit what it can do.
This is called “call service”, and I’m proposing a “call a script” UI.
Blueprints are just templates afaik. Which means, for each different combination of fields as inputs, I would need to create a new Automation from it. Suppose you wanna play white noise in a speaker like my pic above, but you wanna accept the volume as a parameter as well, and maybe select from a list of possible music (water, thunder, nature). A form to trigger it would let me choose during execution, instead of having me saving all possible combinations.
I’m assuming there would be a limited number of choices here that could be put into a select statement possibly, pick from the list. That would work with a script or a blueprint.
I had something similar with a select helper showing in the dashboard. My daughter had a house alert, she would select from about 10 statements in the list and whatever she selected would play on speakers. There were 3 select lists in the card, ons whole house, one that excluded the bedroom when I was up and Mom was asleep, and one that hit the phones with a text if we were outside.
Also consider building an intent_script and just tell HA what you want to do with what device.
Just brainstorming here with things you may not have considered.
I don’t believe there is a construct exactly like you are requesting in HA, and adding something like that is a hard sell with the core group. Finding a suitable workaround in the short term at least would be a smart move.
and if the choices are constrained what i said above would work. you could build a super simple web form with prefilled defaults and send a post to a webhook triggered automation which then calls your custom script with the params.
So it seems that (1) there’s a bug on the list of scripts, and (2) I would just need a way to get a shortcut/direct link to this type of form, rather than clicking many screens to get there.
if you’ve update to this month’s release that just came out hours ago pops up that dialog when you try to invoke your script and it has required fields. so with the 2024.3.0 release, go put that script in the dashboard and give it a go.