Harmony Hub turns on PS3 after poweroff

Hi All

I have set up the Harmony Hub as per the advice in another thread.
I have a quite simple choice, just with activity selection.
The problem is that when I do a PowerOff, the Hub powers everything off, and then after a short while the PS3 is turned on again.

In my configuration.yaml I have this:

remote:
  - platform: harmony
    name: Stue harmonyhub
    host: A.B.C.D
    port: 5222

input_select:
  stue_remote:
    name: Fjernbetjening i stuen
    options:
        - PowerOff
        - TV
        - PS4
        - PS3
        - TV med Surround
        - Musiccast
        - PS3
        - Spil Wii
        - Hør radio
    initial: PowerOff
    icon: mdi:monitor

My automations.yaml has these:

- alias: Remote external update living room
  trigger:
    platform: state
    entity_id: remote.stue_harmonyhub
  action:
    service: input_select.select_option
    data_template:
      entity_id: input_select.stue_remote
      option: "{{ states.remote.stue_harmonyhub.attributes.current_activity }} \n"
- alias: Remote start activity from input select living room tv
  trigger:
    platform: state
    entity_id: input_select.stue_remote
  action:
    service: script.turn_on
    entity_id: script.input_select_harmony

Finally my scripts.yaml has this:

input_select_harmony:
    alias: "Start aktivitet fra input select"
    sequence:
      - service: remote.turn_on
        data_template:
          entity_id: remote.stue_harmonyhub
          activity: >
            {% if is_state("input_select.stue_remote", "PowerOff") %}
                -1
            {% elif is_state("input_select.stue_remote", "TV") %}
                CODE1
            {% elif is_state("input_select.stue_remote", "PS4") %}
                CODE2
            {% elif is_state("input_select.stue_remote", "PS3") %}
                CODE3
            {% elif is_state("input_select.stue_remote", "TV med Surround") %}
                CODE4
            {% elif is_state("input_select.stue_remote", "Musiccast") %}
                CODE5
            {% elif is_state("input_select.stue_remote", "PS2") %}
                CODE6
            {% elif is_state("input_select.stue_remote", "Spil Wii") %}
                CODE7
            {% elif is_state("input_select.stue_remote", "Hør radio") %}
                CODE8
            {% endif %}

So if the remote is used, the page is updated, and if ha is used, the app is updated of course.

But why on earth is the PS3 turned on after everything is turned off?

seem’s like you’re getting a feedback loop. Your automations will circularly call each other when 1 is triggered. hit remote -> change input select -> detect input select change -> change remote -> change input select -> detect input select change -> etc

This is why I moved to buttons in the UI instead. No feedback loop, just longer configuration.

1 Like

Hi @petro, hmm, well it only happens for poweroff, and there it turns on the ps3 after a while. If I change it to buttons, how do I then see the current state of the harmony?

You can make a sensor that displays the current state, if you want to see that. Otherwise you can have a setup like mine: This is what it looks like off.

image

The xbox, playstation, wii u, switch, and tv are the activities. the power off activity is inverted on the upper left button. So technically, in this state, the harmony activity is ‘PowerOff’.

It looks like this when on (Xbox)

So, the poweroff activity is actually off, but the inverted button makes it look like there is power going to the harmony. I liked this more than having the activity displayed on when off. And the current activity is xbox. Having the button appear on makes it pretty clear that xbox is on.

If you click on my name, you can see my entire configuration for this. It’s complicated but I can help set it up.

Take a look this post for the backend. This is my old setup. Most of the switches and backend sensors have not changed when I moved to the interface above.

Hi @fribse ,

Did you ever figure this out? My PS3 does this too almost every night when the harmony hub is sent a remote.power_off from my ‘go to sleep’ script, but I have a difficult time isolating/reproducing it reliably.

  • Rick

Nope, I got some other suggestions on how to set it up, and also a script change, but the script I had looked different, so I haven’t solved that yet.

Thanks @fribse.

I’ ve debugged this a little further and it seems to happen if you poweroff the activity twice… so if the state is already powered off, you send another ‘poweroff’. It also does from the harmony companion remote.

So to reproduce: Start an activity -> Power off activity -> Power off again
…and the PS3 turns on.

But… it only does it the first time after powering off an activity. Because on subsequent poweroffs it seems to select a random other device to power ON :crazy_face: … yet another example of Harmony software quality.

So I suspect in your case you call remote.turn_off twice somehow.

Myself I’m going to implement a check for the current state of the hub before sending a poweroff. I.e.: don’t send a poweroff if it’s already off.

Which is the feedback Loop I was referring to. This is why I posted the other solution so that you never run into this issue :wink:

1 Like

But Petro, as I see your description you have the ‘automations’ in harmony duplicated to HA, and just use the harmony as a IR blaster, and then I will loose the ability to use the remotes’ automations, or did I miss something?

You missed something.

All that i’m doing is creating activity buttons. So instead of a dropdown list and 2 automations, you have a series of switches that act as the dropdown list items.

To elaborate. Lets say you have 3 activities: TV, Playstation, and Xbox.

In your setup, you have an input_select with 4 options: TV, Playstation, Xbox, and PowerOff.

In my setup, I have 3 switches: switch.tv, switch.playstation, switch.xbox.

No power off because you just flick the switch that’s on to off and it will power off.

1 Like

And to clarify the feedback loop:

If you select an item from your input select. It triggers an automation1 to change the activity. The change in activity triggers automation2 to update the input_select. Which triggers automation1 to change the activity… Do you see the feedback loop now?

1 Like

I never use the power off button as the remote then becomes useless and won’t control the lights, fan etc.

Better method is to create a ‘Bedtime’ or ‘All off’ activity, don’t add any devices that you want to turn off automatically and then they will when starting this activity. You can then program any buttons, real or otherwise, to control your lights etc as per normal.

No need to worry about self-inflicted problems then :slight_smile:

Also watch out for what you have sending IR in case you are getting reflections, by default the hub and blasters all send everything, just set each device to only use the most appropriate one.

I had a very similar feedback loop implemented and I saw the same problem with PS3.

In principle you just need to “do nothing” if the state changes to the same activity, by e.g. inserting the following conditions below the triggers:

condition:
    condition: template
    value_template: "{{ states.remote.myhub.attributes.current_activity != states.input_select.myhubactivities.state }}" 

That works for me and the setup is more “elegant” than having to enumerate everything many times.

Needless to say that you may (and I have) mirror the input_select in some input_booleans to be exported to homekit, so that you get voice control of the whole thing.

Works quite well for me.

1 Like

Where exactly do you propose to insert this?

It goes in the automation

1 Like

Thanks @petro :smiley: I gatheres as much, but I have two :wink:

- alias: Remote external update living room
  trigger:
    platform: state
    entity_id: remote.stue_harmonyhub
  action:
    service: input_select.select_option
    data_template:
      entity_id: input_select.stue_remote
      option: "{{ states.remote.stue_harmonyhub.attributes.current_activity }} \n"
- alias: Remote start activity from input select living room tv
  trigger:
    platform: state
    entity_id: input_select.stue_remote
  action:
    service: script.turn_on
    entity_id: script.input_select_harmony

It goes in both.

1 Like

Ahaaaa :laughing: Thanks @petro and @c0revin, it seems to work for me as well, have to check further!

Welcome and big thanks to petro for helping out with my solution while I was AFK

If you are exposing the input_select by translating into input_boolean state for homekit, you would have to put something similar also there. (I have done some, so far no problems)

I’ve just added a projector to the livingroom (will add a screen for it also), it has no activity set up yet, but now that turns on when I turn off the tv, rather odd :slight_smile:I’m not sure if it’s the harmony itself doing that, or if it’s the automations yet.