Harmony Activities, Volume Slider, and Lovelace

Thanks for your help petro. I’ve been playing around for the past hour, but not having much joy! I think this is a little beyond me at present. Will come back to it in the future when i’ve learnt a but more!

OK this is very exciting stuff. I’ve hooked a lot of things into my HA instance but haven’t automated much yet. Just sensors and a couple switches. Getting reading to make things happen. This post is similar to something I did with OpenHab originally before I decided to switch to HA. I’m torn right now between going the Harmony Hub route, or the Broadlink route. Here is my current setup:

  1. Panasonic TC50-S1 Plasma TV in the family room. IR only, no network support
  2. XBox 360 in the utility room
  3. Denon Receiver in the utility room
  4. Harmony 900 IR/RF remote in the family room that turns everything on
  5. RF receiver in the utility room with IR blasters pointing at the XBox 360 and Denon

Everything works great. Family loves it. But I want to do cool things with HA. :slight_smile:

I want to be able to fully control the above but want it to be seamless. So if I turn something on or off or change the volume or something with the remote I want HA to be aware and update it’s screens. If I do the same in HA the remote is aware.

I’m thinking Broadlink isn’t going to be able to keep that awareness.

My thought is to have one Harmony Hub (or Broadlink mini if that makes sense) in the family room, and one in the utility room. I will have to replace the remote with a new Harmony one that is compatible with the Harmony Hub. The remote will turn everything on like the current one does but it will do so with the Harmony Hub in the utility room. Thinking the remote will still have IR so can turn on the TV but then send a request to the Harmony Hub using RF to manage the devices in the utility room. Then if I use HA to control things, the Harmony Hub in the family room will manage the TV and the harmony hub in the utility room will continue to manage the xbox and denon.

Based on the above scenario would this work and if so would HA and Harmony know what was happening with each other?

If so, I assume I can’t keep my current Harmony setup and just add the Harmony Hubs just for HA and have everything keep in sync could I?

Thanks.

JR

You could but keep in mind that harmony hubs have a significant delay when reporting states. Performing actions is instant, reporting a state after the action can have a 2-30 second delay. Also, I have the harmony elite, I do not know if the hub alone will allow you to create activities.

Hi Petro, As you can probably tell from my screenshot, I’m a big fan of your setup. I’ve been using it since shortly after you posted it. So thank you for that! :grinning:

I do have a question though… I still haven’t been able to wrap my head around around how to recreate your volume automations without the decibel conversion. I make attempts to figure it out every now and again, but no real joy to speak of.

Any chance you’d be willing to post an example for a single receiver zone without the db conversion? I’d really appreciate it. :smiley:

Edit: Sorry, more info. I have no trouble with the volume control buttons or the input_number. I’m just unable to get the volume monitored reliably in Lovelace. Meaning, if I control the volume from the remote, I’d still like the volume change shown in the front end.

does your media player for your receiver have a volume slider when playing? I don’t remember if it’s on the main interface, you may need to click the i with a circle around it to see the volume control. If you don’t have one, then you can’t use a slider. This is because your hardware does not report volume back to home assistant.

Yes, the Onkyo media player does have a volume slider that updates if you change the volume through devices such as the Harmony remote, or the Onkyo receiver app.

I just don’t know how to replicate this through my custom Harmony media player. I’ve tried to modify your automations a number of times, but I’m not great with YAML and get confused when trying to strip out your db conversion settings.

Thanks!

So you want a slider in the UI? That’s all this automation does.

Yes, I want a slider in the UI that reflects the actual volume of the receiver. I can add a ‘dumb’ slider that simply turns the volume up and down, but the automation to track the actual volume changes at the receiver is sadly beyond my skill level.

Any help with this would be greatly appreciated!

Do this:

Set the receiver to max volume. Record the value inside home assistant and the value on the receiver.
Set the receiver to min volume. Record the value inside home assistant and the value on the receiver.

Tell me all 4 of those values and I can tailor an equation for you.

The max volume on the receiver is 75.
I’m not sure the best way to read the volume in HA, because the slider in the media player doesn’t show numbers. I’ll attach a screenshot, which looks like the slider is 3/4 of the way up, which would make sense if the receiver volume is 75. Looking at the media player in States, it lists the volume as 0.69375.
Volume

The min volume on the receiver is 0. The media player slider is at the bottom. The state of the media player shows volume 0.

just for giggles can you get it at 35 on the reciever too? The number listed in the states page is what i’m interested in. I want to know if it’s a linear relationship. If it is, this should work

- alias: Zone 1 Volume (Media to Slider)
  trigger:
    - platform: state
      entity_id: media_player.xxx
  condition:
    - condition: template
      value_template: >
        {% set converted = trigger.to_state.state | float / 0.00925 %}
        {{ converted != states('input_number.xxx') | float }}
  action:
     service: input_number.set_value
     data_template:
       entity_id: input_number.xxx
       value: >
          {{ trigger.to_state.state | float / 0.00925 }}
- alias: Zone 1 Volume (Slider to Media)
  trigger:
    - platform: state
      entity_id: input_number.xxx
  condition:
    - condition: template
      value_template: >
        {% set converted = trigger.to_state.state | float * 0.00925 %}
        {{ converted != state_attr('media_player.xxx','volume_level') | float }}
  action:
    - service: media_player.volume_set
      data_template:
        entity_id: media_player.xxx
        volume_level: >
          {{ trigger.to_state.state | float * 0.00925 }}
1 Like

Absolutely! At 35, the volume is 0.32375.

Thank you so much! :grinning:

yep, the calc returns
0.32375

It’s kind of working, but a bit strange. If I adjust the volume through HA, the volume turns up on the receiver, but immediately, input_number immediately drops to zero, as does the volume on the receiver. I can turn the volume back up on the receiver, but the input_number isn’t tracking above 0. Is my input_number wrong?

  harmony_my_volume:
    icon: mdi:volume-high
    name: Volume
    initial: 15
    min: 0
    max: 75
    step: 5

nope, it looks good but your steps could cause problems.

1 Like

What would you recommend?

what does your receiver do? 0.5 or 1 for increments?

I’ve change the step to one, but it still just turns the volume down immediately after making a change.

Hmm, you should add alias’s and turn on debugging. Possibly add a few persistent notifications to see what’s getting passed around.

Sorry to sound dense, but I don’t know how to do that. I’ve had debugging turned on before, but I had no idea what it was actually telling me. I think if I don’t know enough to even troubleshoot the automations, I probably shouldn’t be using them. I’m embarrassed to have wasted your time, but I think I have a lot to learn before attempting this. :flushed:

Petro, thanks so much for your generous help and time, I really appreciate it! You’re fantastic. :sunglasses: