Harmony Activities, Volume Slider, and Lovelace

I think you’ll have to look up the custom button for Lovelace. It allows buttons that can be sized without text (icon only).

If I have no network enabled Receiver connected to Harmony, how would I send volume up/down commands to it through some nicer UI, like switch or something?
I am able to do this from script, like below, but how do I integrate it to something nicer?

reciever_volume_up:
    alias: Volume up
    sequence:
        service: remote.send_command
        data:
            entity_id: remote.living_room
            command:
                - VolumeUp
            device: 59394436

you can call the script from a button. You won’t be able to make a slider if you don’t have a way of knowing the current volume level. So your only option with harmony is to repeat commands. I.E. call the volume up command 5 times.

1 Like

Yes, sure, I understand it, I only control the Receiver through IR, so no slider of course.
I don’t even need 5 to repeat, 1 is enough.
I was able to create the scripts and add them to group, which is fine and working (see the screen), however this “EXECUTE” does not look good. If I could somehow put all 3 of them on one row/switch and customize each with an icon, that would be much better. And I could not find a way to define any working switch template for that.

You can’t do anything else unless you use Lovelace. Unfortunately you are limited with the native UI unless you use custom UI.

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.