I just wondered if it’s possible to use the script widget and pass some arguments to the script? I couldn’t find a documented solution for this purpose. Does anyone know how to do this?
If not, I’VE GOT A FEATURE REQUEST
Okay, than this is my feature request When calling a script make it possible to pass over a predefined argument.
Example: Pressing button “Play Radio” calls the script “mediaplayer_play_radio” and passes entity_id “media_player.player01” to it
create different scrits that call that one scrits with different arguments and connect the dashboard to the different scripts.
that works the same and is possible already
and there is little difference between hardcoding an option at one place or another
Well, in the example above this would require to have a single script for each media_player and for each radio station. This does not sound very comfortable to me.
Being able to define the media_player entity_id (together with the radio station) with the button seems the smarter and more minimalistic approach to me
If the options could be represented by a input_select, would that work?
Does it pop up a UI to select a different mode?
mode that shows as active, not sure I follow?
How does script tie into this?
Could be way off, if so just let me know …
mode
A widget to track the state of an input_select by showing active when it is set to a specific value. Also allows scripts to be run when activated.
Mandatory Arguments
entity - the entity_id of the input_select
mode - value of the input select to show as active
script - script to run when pressed
state_text
state_map
That’s the way it would offer the possibility to define the buttons particular action. I’d like to prevent using a single script for each media_player entity and for each radio station for each media_player as its possible at the moment.
So handing both informations over with the button data would be pretty cool. I hope you can understand my purpose
2 input selects that contain the entity ids and the radiostation tokes
1 input boolean to turn it on and of.
1 small app that starts what you want based on the 2 input selects.
that way you dont have to create a big amount of buttons, so i see it as a better way any way.
if you only want to create 3 buttons then it wouldnt be worthwhile anyway, so i guess you want a lot of buttons.
and that can be avoided with 2 input selects