Harmony Hub Activity

Hi all,

my home assistant recognized my HUB HARMONY but can not configure any activity, I try the information of the tutorial on the site but nothing to do, can someone help me to add the activity? I look in the file harmony hub config I have all my entries but I do not know how to control them.
thank you in advance

actually i have just possibility turn on or off HUB but dont work…

Same thing here as well… Got the harmony discovered but I have no idea of what is the best way of setting up the activities. Should I use switches? input booleans? script? and how to integrate it all with automation?
First thing anybody would want is to have all the activities in one panel, like in a panel named Home Theater.

Suppose I have these Activities in my harmony_theater.conf file. How should I get them to show in one panel?
26467721 - AC
-1 - PowerOff
4981325 - Apple TV
5376059 - PS4
4977610 - TV

I think setting setting up the individual remotes would be the next logical step after this.

Many Thanks!

from my side i just have HARMONY HUB, but nothing possible…

I have try with domoticz i can control all activity without problem but i want to controle with Home assistant :slight_smile:

Here’s what I did to get started…
This is in my configuration.yaml file:

remote:
  - platform: harmony
    name: Theater
    host: 192.168.1.16
    MAC: 00:54:60:E4:33:CF
    activity: 4981325
    scan_interval: 5

This is my scripts.yaml file

#################################################################
## Harmony Activities
#################################################################
    ps4_activity_on:
      alias: Turn on PS4
      sequence:
        - service: remote.turn_on
          data:
            activity: 'PS4'

    ps4_activity_off:
      alias: Turn off PS4
      sequence:
        - service: remote.turn_off
          data:
            activity: 'PS4'

    tv_activity_on:
      alias: Turn on TV in Theater
      sequence:
        - service: remote.turn_on
          data:
            activity: 'TV'

    tv_activity_off:
      alias: Turn off TV in Theater
      sequence:
        - service: remote.turn_off
          data:
            activity: 'TV'

    apple_tv_activity_on:
      alias: Turn on Apple TV
      sequence:
        - service: remote.turn_on
          data:
            activity: 'Apple TV'

    apple_tv_activity_off:
      alias: Turn off Apple TV
      sequence:
        - service: remote.turn_off
          data:
            activity: 'Apple TV'


#################################################################
## Home Theater Devices
#################################################################
#################################################################
## PS4
#################################################################
    ps4_device_on:
      alias: Turn on Playstation
      sequence:
        - service: remote.send_command
          data:
            command: PowerOn
            device: 28654516

    ps4_device_off:
      alias: Turn off Playstation
      sequence:
        - service: remote.send_command
          data:
            command: PowerOff
            device: 28654516

#################################################################
## Epson Projector
#################################################################
    epson_projector_on:
      alias: Turn on Epson Projector
      sequence:
        - service: remote.send_command
          data:
            command: PowerOn
            device: 13005092

    epson_projector_off:
      alias: Turn off Epson Projector
      sequence:
        - service: remote.send_command
          data:
            command: PowerOff
            device: 13005092

#################################################################

and it looks like this in the frontend:

It would be great to have On Off switches for the activities!!

Thanks!

1 Like

I use my Harmony Hub in combination with HA to simply turn on my TV (also via Alexa).

configuration.yaml

remote:
  - platform: harmony
    name: Fernsehzimmer
    host: YOUR_HUB_IP
    activity: 18945024 (replace this with your activity ID)

This will set up my HarmonyHUB as a sensor “remote.Fernsehzimmer”. The “activity” defines which activity to start when you switch on the HUB via HA. In my case this activity triggers “Tv on” in my setup.

To add a switch add this:

switch.yaml:

- platform: template
  switches:
    remote:
      friendly_name: 'TV'
      value_template: "{{ is_state('remote.Fernsehzimmer', 'on') }}"
      turn_on:
        service: remote.turn_on
      turn_off:
        service: remote.turn_off

This will add a switch in your frontend to switch on the HUB and trigger the “TV on” activity defined in the configuration.yaml

Now you could even expose this to alexa via the emulated_hue component and switch your TV on via Alexa…
I hope that example will help you to get it up and running.

I also have this switch in my switches.yaml:

- platform: template
  switches:
    tv:
      friendly_name: TV
      value_template: "{% if is_state('remote.theater', 'on') %}on{% else %}off{% endif %}"
      turn_on:
        service: remote.turn_on
        entity_id: remote.theater
      turn_off:
        service: remote.turn_off
        entity_id: remote.theater

It turns off just fine but it does not turn the activity TV on.

What would be the way to go if I have multiple activities and multiple ways of turning them on and off?
Actually how it should be is that the HA should be able to figure out if an activity is already running and turn it’s switch to that position to start with.

I do have this sensor in my configuration which tells which activity if on but I cannot interact with that it in frontend.
Here’s what is looks like in sensors.yaml:

- platform: template
  sensors:
    theater:
      value_template: '{{ states.remote.theater.attributes.current_activity }}'
      friendly_name: 'Home Theater'

and here’s what it looks like in frontend:

See… Even though the activity Apple TV is on in Home Theater the switch shows that the TV is on…
Getting it all together is the problem…

Thanks!

thank you very much for all exemple :slight_smile: and help
actually i have juste 2 activity in my Harmony (launch TV with internet box) and (lauch TV with Android box tv)

i planned to buy alexa in the futur when amazon give good price (black friday ?) :slight_smile:

I use a template sensor to get current harmony activity:

- platform: template
  sensors:
    harmony:
      friendly_name: "Comedor"
      value_template: >
        {% if states.remote.comedor.attributes.current_activity == "PowerOff" %}
          OFF
        {% elif states.remote.comedor.attributes.current_activity == "Ver TV" %}
          TV
        {% elif states.remote.comedor.attributes.current_activity == "Media Center" %}
          MEDIA CENTER
        {% elif states.remote.comedor.attributes.current_activity == "SATELITE" %}
          SATELITE
        {% elif states.remote.comedor.attributes.current_activity == "Radio" %}
          RADIO
        {% elif states.remote.comedor.attributes.current_activity == "Unknown" %}
          OFF
        {% elif states.remote.comedor.attributes.current_activity == "Switch" %}
          SWITCH
        {% endif %}

Hey guys, There’s really no point in making a harmony activity sensor. If you use the following code, you can get switches for each activity on your remote:

        # XBOX HARMONY ACTIVITY
        xbox_one:
          value_template: "{{ is_state_attr('remote.living_room', 'current_activity', 'Xbox One') }}"
          turn_on:
            service: remote.turn_on
            data:
              entity_id: remote.living_room
              activity: 'Xbox One'
          turn_off:
            service: remote.turn_on
            data:
              entity_id: remote.living_room
              activity: 'PowerOff'
        
        # PLAYSTATION HARMONY ACTIVITY
        ps4:
          value_template: "{{ is_state_attr('remote.living_room', 'current_activity', 'PS4') }}"
          turn_on:
            service: remote.turn_on
            data:
              entity_id: remote.living_room
              activity: 'PS4'
          turn_off:
            service: remote.turn_on
            data:
              entity_id: remote.living_room
              activity: 'PowerOff'

These act like switches. When one activity turns on, the others will turn off in the interface. It acts just like activities on the remote; one at a time.

EDIT: To clarify, I have 6 activities in harmony, and 6 switches in home assistant. Nothing more.

3 Likes

And if you guys are really feeling up for the challenge, you can marry this with lovelace for a simple UI that covers harmony activities:

2 Likes

thank you all i try after work :slight_smile:
just for confirm, logitech hub just can launch activity, no possible to set sound or change channel tv ?

You can execute any device command, in your config folder there should be a config file with all available commands.

OK thank you :slight_smile: i try that today !!! hope i can successfully add all activity and full controle :slight_smile:

for sur, all configuration line is on file : configuration.yaml
not other file ???

The name of the config file for harmony remote in home assistant is covered in the documentation:


Configuration file:

Upon startup one file will be written to your Home Assistant configuration directory per device in the following format: harmony_REMOTENAME.conf. The file will contain:

List of all programmed activity names and ID numbers

List of all programmed device names and ID numbers

List of all available commands per programmed device


Thanks petro!!
That was very helpful!!
Based on your code I changed my code:

In my switches.yaml I added this:

- platform: template
  switches:
    # TV - Theater
    theater_tv:
      friendly_name: TV
      value_template: "{{ is_state_attr('remote.theater', 'current_activity', 'TV') }}"
      turn_on:
        service: remote.turn_on
        data:
          entity_id: remote.theater
          activity: 'TV'
      turn_off:
        service: remote.turn_on
        data:
          entity_id: remote.theater
          activity: 'PowerOff'


    # Play PS4
    ps4:
      friendly_name: PS4
      value_template: "{{ is_state_attr('remote.theater', 'current_activity', 'PS4') }}"
      turn_on:
        service: remote.turn_on
        data:
          entity_id: remote.theater
          activity: 'PS4'
      turn_off:
        service: remote.turn_on
        data:
          entity_id: remote.theater
          activity: 'PowerOff'


    # Watch Apple TV
    appletv:
      friendly_name: Apple TV
      value_template: "{{ is_state_attr('remote.theater', 'current_activity', 'Apple TV') }}"
      turn_on:
        service: remote.turn_on
        data:
          entity_id: remote.theater
          activity: 'Apple TV'
      turn_off:
        service: remote.turn_on
        data:
          entity_id: remote.theater
          activity: 'PowerOff'


    # AC in Theater
    theater_ac:
      friendly_name: AC
      value_template: "{{ is_state_attr('remote.theater', 'current_activity', 'AC') }}"
      turn_on:
        service: remote.turn_on
        data:
          entity_id: remote.theater
          activity: 'AC'
      turn_off:
        service: remote.turn_on
        data:
          entity_id: remote.theater
          activity: 'PowerOff'

To make it look something like this at the frontend:

Thank You Very Much!!

1 Like

To add a channel you can do something like this…
In my scripts.yaml file I have this to change channel (suppose I want to change the channel to 708)

#################################################################
## Tata Sky Fav Channels
#################################################################
    ts_natgeo:
    alias: National Geographic
    sequence:
      - service: remote.send_command
        data:
          command:
            - 7
            - 0
            - 8
          device: 13005117
          delay_secs: 0.6

  ts_sonylive:
    alias: Sony Live
    sequence:
      - service: remote.send_command
        data:
          command:
            - 4
            - 8
            - 3
          device: 13005117
          delay_secs: 0.6

It looks like this in frontend:

I’ll add channel icons to this shortly.
Can I change EXECUTE to something else???
I don’t know of any other way of sending commands in sequence to change channels.
Looking for a better way to do this myself.
It would be great if somebody could chip in with a more elegant/practical solution.

Thanks!

1 Like

Your scripts are missing an entity_id for the remote.send_command service. As soon as you get a second remote, your stuff is going to break. To be honest, I’m surprised it even works without the entity_id.

As for the word execute, changing that isn’t possible without using a custom UI.

1 Like

It doesn’t work like that and creating complete remotes seems a huge backwards step from what Harmony does itself.

The idea of the HA integration is to pick specific controls you want to include in automations, getting it set up is all explained in the supporting threads/docs so suggest you read them and then ask specific questions.

Oh… That’s really helpful…
Us newcomers make these silly mistakes without knowing it.
A little explanation goes a long way.
This forum is a godsend!

Thank You So Much!!

1 Like