Harmony Hub TV volume script devices problem

Hey there,
I wrote my own TV volume script as a switch for Alexa (“on” makes two steps louder, “off” two steps lower).
The script works, but I realized that the Harmony Hub does not specify the Volume command to the device, it sends it globally (my soundbar which is not connected to the TV got the volume treatment everytime as well).
Below is my script with my device number for the TV. Any idea why my Harmony Hub doesn’t specifiy?

edit: I just realized that the script is fine, but my Harmony Hub is the problem. I have the same issue when I use the volume buttons in the phone app.

edit2: Ok apparently, my Samsung TV remote triggers my LG soundbar, this is really weird :frowning: And not related to HASS so feel free to close/delete the topic. I am sorry for the confusion!

volume_on:
  sequence:
    - service: remote.send_command
      entity_id: remote.harmony_hub
      data:
        device: "50346430"
        command: "VolumeUp"
    - service: remote.send_command
      entity_id: remote.harmony_hub
      data:
        device: "50346430"
        command: "VolumeUp"

volume_off:
  sequence:
    - service: remote.send_command
      entity_id: remote.harmony_hub
      data:
        device: "50346430"
        command: "VolumeDown"
    - service: remote.send_command
      entity_id: remote.harmony_hub
      data:
        device: "50346430"
        command: "VolumeDown"

It’s probably sending the command through HDMI-CEC or I believe Samsung calls it Anynet+. You should be able to turn that off from your TV to avoid this.

As for HA, first up, for your script, there is a repeat option so you don’t have to create multiple services. Also have you checked out Node Red? I just recently moved to it and you can use commands such as “increase the TV volume” and it can execute these scripts.

Here’s a how-to guide I just posted.

Thanks for your input! I switched off HDMI-CEC/Anynet+ on my Samsung TV and it still happens. This is extremely weird. Even when I point the original Samsung TV remote at the LG Soundbar while the TV is powered off, the soundbar picks up the volume command (but nothing else just volume). I don’t know how this coincidence could have happened since both are well known manufactures and fairly new devices. I haven’t taught the soundbar anything, really frustrating.

I’ll check out Node Red for future setups, thanks a lot!