Help with volume slider for Google Home

I’m trying to setup a volume slider for Google Home. Here’s the code I have so far, but it doesn’t work:

input_slider:
  google_home_volume:
    initial: 0.27
    min: 0.09
    max: 1.00
    step: 0.09

automation:
  - alias: "Google Home - Adjust Volume"
    trigger:
      platform: state
      entity_id: input_slider.google_home_volume
    action:
      - service: media_player.volume_set
        data_template:
          entity_id: media_player.google_home
          volume_level: '{{ states.input_slider.google_home_volume.state }}'

Here are some scripts I have that do work setting the volume level:
google_home_volume_01:
  sequence:
    - service: media_player.volume_set
      data_template:
        entity_id: media_player.google_home
        volume_level: 0.1

google_home_volume_02:
  sequence:
    - service: media_player.volume_set
      data_template:
        entity_id: media_player.google_home
        volume_level: 0.2

google_home_volume_03:
  sequence:
    - service: media_player.volume_set
      data_template:
        entity_id: media_player.google_home
        volume_level: 0.3

Any help would be appreciated :slight_smile:

I managed to do it with this code:

- alias: "Google Home - Set Volume"
  trigger:
    platform: state
    entity_id: input_number.google_home_volume
  action:
    service: media_player.volume_set
    data_template:
      entity_id: media_player.google_home
      volume_level: '{{ states.input_number.google_home_volume.state | float * 0.09 }}'

Jono,

Could you elaborate on how you got this working? I noticed that you switched from input slider to input number, could you explain why? Also how did you account for the .45 to .55 jump in volume increments in the middle of the volume slider? I’ve been have a hell of a time with this today and any help would be greatly appreciated. Thanks in advance!

Input_slider not longer exists, its now input_number. As for the rest of it, I’m too new to all this to have an answer yet so I’m not much help!

Apparently clearing cache will display the slider.

Still having trouble getting the volume to adjust. It sends the cmd to the google home but it just flashes with a single dot and never adjusts the volume past 1. I believe that is has to due with the input number and the steps between increments.