Harmony Hub - Switching TV channels

It cost me several days to figure out the correct commands to send a three digit channel number to the Harmony Hub. Finally found it and want to share…

In <Developer Tools> + <Services>:
<Domain> is <remote>
<Service> is <send_command>
<Service Data JSon optional> is {“entity_id”:“remote.harmony”,“device”: “19977378”,“command”: [“6”, “6”, “4”]}
Push <Call Service>-button on page.

Rest you can use provided script by BTallack to build a channel selector.
https://community.home-assistant.io/t/logitech-harmony-integration-with-ianddays-component/6183

8 Likes

Any idea how you would script this in an automation?

I’m assuming:

service: remote.send_command
entity_id: remote.living_room
data:
  command: ["6", "6", "4"]

In configuration.yaml:

input_select:
  tvkanaal:
    name: TV kijken
    options:
      - NPO1
      - NPO2
script:
  npo1:
    sequence:
    - service: remote.send_command
      entity_id: remote.harmony
      data:
        device: 19977378
        command: ["6", "6", "1"]
  npo2:
    sequence:
    - service: remote.send_command
      entity_id: remote.harmony
      data:
        device: 19977378
        command: ["6", "6", "2"]

automation: !include_dir_list automations/

In folder “automations”.
npo1.yaml

alias: "NPO1 from HASS"
trigger:
  platform: state
  entity_id: input_select.tvkanaal
  to: 'NPO1'
action:
  service: script.turn_on
  entity_id: script.npo1

npo2.yaml

alias: "NPO2 from HASS"
trigger:
  platform: state
  entity_id: input_select.tvkanaal
  to: 'NPO2'
action:
  service: script.turn_on
  entity_id: script.npo2

Hope this helps…

1 Like

Hi could someone please help with with this?

I tried adding the script arq above using my device number and keep getting a script error

@phairplay can you post the part of your script that fails validation?

hi
have got it working like this

bbcone:
alias: BBC One HD
sequence:

  • service: remote.send_command
    data:
    entity_id: remote.living_room
    device: 43041296
    command: [“1”, “1”, “5”]

Hi,

short question why your are doing it that complicated? Simply define the Channels on you hub by name! Update your harmony conf and look for the code for your channels in harmony.conf. Create an Input Select with your TV Channels names. And create an automation. In the End it Looks like this.

and the Automation like this:

  • alias: Harmony Select Channel
    trigger:
    platform: state
    entity_id: input_select.tv_source
    action:

    • service: remote.turn_on
      data_template:
      entity_id: remote.harmony_hub
      activity: >
      {% if is_state(“input_select.tv_source”, “Apple TV”) %}
      31986002
      {% elif is_state(“input_select.tv_source”, “Xbox One X”) %}
      31986022
      {% elif is_state(“input_select.tv_source”, “Recalbox”) %}
      32031978
      {% elif is_state(“input_select.tv_source”, “Extern”) %}
      27928482
      {% endif %}
  • alias: Reset Input Select
    trigger:
    platform: state
    entity_id: input_select.tv_source
    action:

    • delay: 00:00:05
    • service: input_select.select_option
      data:
      entity_id: input_select.tv_source
      option: Select Source

And another benefit is that you can select your TV channels by asking Alexa or Google home to set the TV Channel to BBC in Harmony Hub. Without remembering the numbers :slight_smile:

Kind Regards

Dear reua, could you explain your script please :slight_smile:
i am very interessed by your solution but i start in Home assistant configuration :wink:

thank you very much

You can do that directly with the Harmony Alexa skill too.