Harmony Activities, Volume Slider, and Lovelace

I might have a solution to your problem. I also don’t have a network controlled receiver yet and have been using this as a workaround in the meantime. It’s not perfect but it does look nicer than using scripts on the frontend.

image

What I did was created an input_number like so…

denon_volume:
  name: Volume
  initial: 5
  min: 0
  max: 10
  step: 5
  mode: slider

Then I created two automations; one that when the slider is moved up it turns the volume up and then resets the slider back to the middle position. Then another automation that does the opposite like so…

- id: denon_vol_down
  alias: Denon Volume Down
  trigger:
    platform: state
    entity_id: input_number.denon_volume
    to: '0.0'
  action:
  - service: input_number.set_value
    entity_id: input_number.denon_volume
    data:
      value: '5.0'  
  - service: remote.send_command
    entity_id: remote.living_room
    data:
      device: '46571740'
      command: 'VolumeDown'
      num_repeats: '10'
  
- id: denon_vol_up
  alias: Denon Volume Up
  trigger:
    platform: state
    entity_id: input_number.denon_volume
    to: '10.0'
  action:
  - service: input_number.set_value
    entity_id: input_number.denon_volume
    data:
      value: '5.0'
  - service: remote.send_command
    entity_id: remote.living_room
    data:
      device: '46571740'
      command: 'VolumeUp'
      num_repeats: '10'
1 Like

Thanks!
Well, I have used the glance card for that in lovelace ui and that sort of made it look better as well.

2 Likes

Hi petro, is it possible for a link to the png images, going to have a go at this later and have nearly the same setup, even the amp. Many thanks, this looks great!

Yes, here they are

Many thanks, will be working on this tonight!

1 Like

I’ve been using this card: Lovelace: Button card
to create this:
image

And this is the corresponding code in ui-lovelace.yaml:

  - title: Radio
    icon: mdi:radio
    cards:
      - type: vertical-stack
        cards:
        - type: "custom:button-card"
          name: Radio Channels
          style:
#            - color: rgb(44, 109, 214)
            - font-size: 19px
#            - font-weight: bold
        - type: horizontal-stack
          cards:
          - type: "custom:button-card"
            color_type: icon
            color_off: rgb(44, 109, 214)
            icon: attribute
            entity: script.radio_10
            name: Radio 10
            size: 22%
          - type: "custom:button-card"
            color_type: icon
            color_off: rgb(44, 109, 214)
            icon: attribute
            name: Sky Radio
            size: 22%
            entity: script.radio_sky
        - type: horizontal-stack
          cards:
          - type: "custom:button-card"
            color_type: icon
            color_off: rgb(44, 109, 214)
            icon: attribute
            name: NPO3 FM
            size: 22%
            entity: script.radio_npo3
          - type: "custom:button-card"
            color_type: icon
            color_off: rgb(44, 109, 214)
            icon: attribute
            name: Omrop Fryslan
            size: 22%
            entity: script.radio_frl
        - type: entities
          title: Volume
          show_header_toggle: false
          entities:
            - input_number.slider1
        - type: horizontal-stack
          cards:
          - type: "custom:button-card"
            entity: script.receiver_volume_up
            color_type: icon
            color_off: rgb(44, 109, 214)
            icon: mdi:volume-plus
          - type: "custom:button-card"
            color_type: icon
            color_off: rgb(44, 109, 214)
            icon: mdi:volume-minus
            entity: script.receiver_volume_down
          - type: "custom:button-card"
            color_type: icon
            color_off: rgb(44, 109, 214)
            icon: attribute
            name: Radio OFF
            size: 28%
            entity: script.radio_off
1 Like

This is such a great documentation. Thanks for that! I have one question regarding the receiver switches. I have an activity on my harmony called “Listen to Music”. Obviously it only turns on the receiver. From looking at the code it seems the switch status and the volume sliders are only displayed correct if the status of the receiver is “on”. But when only listening to music it is either “idle” or “playing”. I did not manage to adapt the code respectively and I’d be happy about some help. Thanks folks.

Hm okay. It was so much easier than expected… Just didn’t realize I need to restart HA in order for switch.yaml changes to take effect. It is a simple ‘or’ like this:

"{{ is_state('media_player.yamaha_receiver_family_room', 'on') or is_state('media_player.yamaha_receiver_family_room', 'idle') or is_state('media_player.yamaha_receiver_family_room', 'playing') }}"

1 Like

I was able to get this up and running but not 100% (but enough to where i have the activity displaying and working), is there any way to make the image stand out more? it’s kind of hard to see for my “music” activity

56%20PM
on the far right there is a speaker but it’s really faint

I think the only way to make it stand out more is to use a custom theme, adjust the background color, or possibly use the card modder (a custom card).

Same colors w/ black background

Update: I see I have the same idea as sMauldaeschle :slight_smile:

I found a small improvement for the volume slider, this removes an error from the HA log when the receiver is turned off. Use:

    condition:
      condition: and
      conditions:
        - condition: template
          value_template: "{{ not states.media_player.receiver.state == 'off' }}"
        - condition: template
          value_template: "{{ not is_state_attr('media_player.receiver', 'volume_level', states('input_number.slider1') | int / 100) }}"

Instead of:

    condition:
      - condition: template
        value_template: "{{ not is_state_attr('media_player.receiver', 'volume_level', states('input_number.slider1') | int / 100) }}"

Adapt the names, etc. as used in your system.

Could you elaborate on this a bit please?
How do you show what you’re doing on Xbox, all I see with the Xbox component is online or offline?

Mine does, it will say what app / game is being played.

yep, you’re right, its one of the sensor attributes.
my bad

No biggie. I actually don’t really enjoy the component to be honest. I just implemented it to see what it was like. I always reach the max api limit and it doesn’t update fast enough without requiring payment.

Yeah I’m getting the same impression to be fair
I’ve set the update interval to 120 secs, in the hope of staying within the request limit. I can live with a 2 minutes delay.

Mine is set to 90 and I hit the limit around half way through the day for some reason. I think they lowered the free limit.

According to the site, it’s 60 API requests per hour

Awesome write up Petro! I will definitely be attempting to set this up once we get into our new home. I also have a newer Yamaha receiver, but waiting until we move into our new home to set it up. Right now I have two harmony hubs running (one in LR and BR).

Do you have any recommendations for a simple setup on the lovelace IU? I’m only running
TVs in each room with soundbars (two hubs), so this seems like overkill for my current setup. I was just wondering if you have an suggestions. Again, thank you for all your contributions within the community. I’m fairly new to the Home Assistant community and noticed you are always posting awesome stuff.

1 Like

It’s really up to you. You need to answer these questions:

  1. How do you want to turn on your activities? Dropdown or Switch? Personally, I hate dropdowns on cellphones, so I went with switches.

  2. Do you want quick access to volume controls?

  3. Do you want the volume to disappear when the system is off?

If yes, then you still will pretty much mimic a lot in this thread. For the simplest setup. You’d still need a way to activate your activities, which would just be the template switches. Volume controls are on the media players so you wouldn’t need that.

1 Like