Would appreciate any help with Harmony script

Okay, I tried my best to find the answer to a seemingly simple task but being so new to Home Assistant I’m getting nowhere! Trying to move from using a VeraEdge that’s running out of steam so I’ve been testing a few automations, etc with HA. I’ve been able to do a few things but can’t get the basics straightened out.

I use a Harmony Elite Remote so I added it with the Logitech Harmony Integration. That automatically created a device and entities which are all my activities. At this point I can’t even remember how but I added a “Harmony Card” to my dashboard that has a selector for those activities and on/off slider.

I’d actually like to add a volume slider to the bottom of that card that would control the volume of my preamp but after reading instructions, watching videos, etc. I’m just trying to add two buttons for now, one for volume up and one for volume down.

My biggest issue is I’m having problems understanding the whole process and what leads to what. I understand the whole concept of being able to do lots of stuff with the UI (which places code into yaml files) and/or just editing the files directly. I also know how to get the info I need from the harmony_xxxxxx.conf file.

I was trying to follow a youtube vid so I entered my info (sample script below) into the scripts.yaml file (which was empty) but had trouble getting it to pass the configuration check. Finally got it to pass config check but when I look in the scripts section of the UI it’s in red and when I click it gives this error:

Script is unavailable
Actions: template value is None for dictionary value @ data[0][‘data’]

whatever the heck that means! So then I somehow created a script just called “volume up” using the UI which placed similar but different data in the script file, that apparently/maybe works because it shows up fine, not in red. So I could probably work off that but how do I now actually use that script. I tried tying it to an input button but of course I can’t get that to work either! Any hints??

Sample script file

turn_preamp_volume_up:
alias: Turn PreAmp Volume Up
sequence:
- service: remote.send_command
data:
entity_id: remote.livingroomhub
command:
- VolumeUp
device: “Yamaha Preamp”

turn_preamp_volume_down:
alias: Turn PreAmp Volume Down
sequence:
- service: remote.send_command
data:
entity_id: remote.livingroomhub
command:
- VolumeDown
device: “Yamaha Preamp”

Noob need more help

That title does not invite anyone with Harmony knowledge to read your post. Maybe change your title to something that resembles the question.

Okay, thank you, will modify

Could you format your code please, take a look here.

Take a look at your harmony_xxxxxxxx.conf file in the config directory.

I have the harmony integration running, I’ll see what mine looks like.

Here we go:

turn_preamp_volume_down:
  alias: Turn PreAmp Volume Down
  sequence:
    - service: remote.send_command
      data:
        device: Yamaha Preamp
        command: VolumeDown
      target:
        entity_id:
          - remote.livingroomhub

Blockquote
Thank you, that worked! I had the code formatted in editor I composed the message with but all the spacing got stripped when I copied it, sorry for that. I have reviewed the post(s) you suggested again. I can easily paste the code as an image but I need to figure out how you pasted yours so that it shows as code correctly formatted but also is still text so that it allows someone to copy and paste it, like I pasted yours. :slight_smile: Thanks again!!

Dave

I fixed the original link,you should be reading Point 11.

Okay, thanks. I have one activity for when I’m just watching news or something and don’t care about surround sound so I just use the TV for the audio. All other activities I use my pre-amp and amps for the audio so I created a vertical stack with a conditional card that calls a card that displays TV volume controls if TV activity is selected or calls another card that displays pre-amp controls if any activity that’s not TV is selected or if the powered off activity is not selected. Hopefully I can put the code in a code block properly. Thanks again!

type: vertical-stack
cards:
  - type: entities
    entities:
      - entity: select.livingroomhub_activities
    name: Activities
    title: Harmony Elite
  - type: conditional
    conditions:
      - condition: state
        entity: select.livingroomhub_activities
        state: Watch TV
    card:
      type: entities
      entities:
        - entity: script.turn_tv_volume_up
          icon: mdi:volume-plus
          name: TV Volume Up
        - entity: script.turn_tv_volume_down
          icon: mdi:volume-minus
          name: TV Volume Down
        - entity: script.mute_tv
          icon: mdi:volume-mute
      title: Pioneer Elite TV
  - type: conditional
    conditions:
      - condition: state
        entity: select.livingroomhub_activities
        state_not: power_off
      - condition: and
        conditions: []
      - condition: state
        entity: select.livingroomhub_activities
        state_not: Watch TV
    card:
      type: entities
      entities:
        - entity: script.turn_preamp_volume_up
          name: PreAmp Volume Up
          icon: mdi:volume-plus
        - entity: script.turn_preamp_volume_down
          name: PreAmp Volume Down
          icon: mdi:volume-minus
        - entity: script.mute_preamp
          icon: mdi:volume-off
      title: Yamaha PreAmp

It looks good, I can’t test it as I don’t have those components, but it does pass the YAML test.