HADashboard + input_select

Can I do add input_select in HAdashboard? I can’t find.

Not yet available …

1 Like

@aimc Any alternative way to achieve input_select feature using multiple switches or something else.

Thanks

My HA Setup (input_select is Current Activity Widget))

1 Like

So yes, you can use a script widget to call a script on HASS. In that Script you can use a service call to change the input_select.

I should add a service widget so you can do this without needing an intervening script but that is on my list too.

1 Like

Sorry, but… how do I find your list? (I’m newbie here)

When I say “it’s on my list” _ I mean it’s on my list of things to add but I haven;t had time to work on it yet.

2 Likes

:corar:
Ok, tks!

I was just about to search for this! I want to be able to select audio source directly (either from a dropdown-ish widget or one widget per available source). If I haven’t overlooked anything, the way to do this is mode widgets -> input selects -> scripts -> media_player.select_source service. Any more direct way of achieving this?

got it, let me give it a shot, if successful, will post here so that it can help others to achieve the same. Cheers!!!

Scripts or Mode will both work, they are basically the same thing. This will be a lot easier when I implement a proper input_select, and a little easier when I implement a service widget (I’ll try and get that one in the next release as it should be very easy)

Great, thanks.

I would still have to make one script per source, right?

Regarding Script vs Mode - is Mode able to manipulate an input_select directly? I did not get it to work, so now I am making one script per source and the next step would be to create one widget per script.

Here is a hacky way to use input select functionality on HADashboard:
In the script section you can create one for each activity like this below:

tv:
sequence:
- service: input_select.select_option
data:
entity_id: input_select.harmony
option: “Watch TV”

watch_apple_tv:
sequence:
- service: input_select.select_option
data:
entity_id: input_select.harmony
option: “Watch Apple TV”

play_xbox_one:
sequence:
- service: input_select.select_option
data:
entity_id: input_select.harmony
option: “Play Xbox One”

watch_plex:
sequence:
- service: input_select.select_option
data:
entity_id: input_select.harmony
option: “Watch PLEX”

power_off:
sequence:
- service: input_select.select_option
data:
entity_id: input_select.harmony
option: “Power Off”

Then in HADashboard Config do like this:

tv:
widget_type: script
title: TV
entity: script.tv
icon_on: mdi-television
icon_off: mdi-television

watch_apple_tv:
widget_type: script
title: Apple TV
entity: script.watch_apple_tv
icon_on: mdi-apple
icon_off: mdi-apple

play_xbox_one:
widget_type: script
title: X Box One
entity: script.play_xbox_one
icon_on: mdi-xbox
icon_off: mdi-xbox

watch_plex:
widget_type: script
title: PLEX
entity: script.watch_plex
icon_on: mdi-plex
icon_off: mdi-plex

power_off:
widget_type: script
title: Power Off
entity: script.power_off
icon_on: mdi-power-plug-off
icon_off: mdi-power-plug-off

End Result:

2 Likes

There’s actually another - in my eyes cleaner - way to do this. You can override the undocumented post_service_active and/or post_service_inactive keys. This is actually what HADashboard does itself in the mode widget: https://github.com/home-assistant/appdaemon/blob/89279f53b3524da3fff9e745fb310a6dbd995ea6/appdaemon/widgets/mode.yaml#L5-L7

The widget definition in your .dash file should then look something like this:

relaxing:
    widget_type: mode
    title: Relaxing
    entity: input_select.living_preset
    icon_on: mdi-sofa
    icon_off: mdi-sofa
    icon_style_active: "color: #add8ec"
    mode: "Relaxing"
    post_service_active:
        service: input_select/select_option
        entity_id: input_select.living_preset
        option: "Relaxing"
    post_service_inactive:
        service: input_select/select_option
        entity_id: input_select.living_preset
        option: NoPreset
4 Likes

Thanks for this. Would this work for any HASS services or only a limited set? I would like to use climate.set_operation_mode and climate.set_fan_mode. When I tried the code below, it doesn’t do anything when activating and inactivating the widget.

EDIT Fixed by replacing option: with operation_mode:. Duh!

climate_mode:
    widget_type: mode
    mode: "Cool"
    entity: climate.living_ac
    icon_on: mdi-snowflake
    icon_off: mdi-snowflake
    post_service_active:
        service: climate/set_operation_mode
        entity_id: climate.living_ac
        operation_mode: "Cool"
    post_service_inactive:
        service: climate/set_operation_mode
        entity_id: climate.living_ac
        operation_mode: "Idle"