Harmony Hub automations: strange side-effect

The other day, I setup an automation to switch my Harmony into a custom Idle activity, so that I can bind Emulated Roku commands to buttons while no other activities are active:

alias: Living Room | Harmony Off
description: ''
trigger:
  - platform: state
    entity_id: remote.harmony_living_room
    attribute: activity_starting
    to: PowerOff
condition: []
action:
  - service: remote.turn_on
    data:
      activity: 'Idle'
    entity_id: remote.harmony_living_room
mode: single

It’s been working great. Only, since I created it, I’m seeing strange side-effect.

For four days in a row, when turning on the TV activity first thing in the morning, this exact scenario has happened…

I start the TV activity (before this would be a switch from “PowerOff” -> “TV”, but now is “Idle” -> TV), navigate to an app (Netflix, Hulu, Plex, whatever), start playing a title, and the TV suddenly powers off.

The logbook will always have entries like the below, confirming that the Harmony indeed went into PowerOff mode and that it’s not just the TV powering off on its own. It looks just like it would if I actually chose to switch off the TV activity, only I didn’t:

This only happens in the morning, after the TV and Harmony have been sitting all night. But I can’t imagine why that would make a difference.

I also can’t think of any reason why my automation could possibly be causing this. But it literally started the day I added it. I’ve never seen this behavior before.

Yesterday, I converted this automation to node-red, and the behavior continues:

[{"id":"2dd70a3c.41af46","type":"api-call-service","z":"84d1ed44.f4f9a","name":"Turn on Idle activity","server":"e8a845d3.c74d88","version":1,"debugenabled":false,"service_domain":"remote","service":"turn_on","entityId":"remote.harmony_living_room","data":"{\"activity\":\"Idle\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":350,"y":540,"wires":[["e63d95f.1ce6568"]]},{"id":"7374e2e9.ba9dbc","type":"trigger-state","z":"84d1ed44.f4f9a","name":"TV turned off","server":"e8a845d3.c74d88","exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityid":"remote.harmony_living_room","entityidfiltertype":"exact","debugenabled":false,"constraints":[{"targetType":"this_entity","targetValue":"","propertyType":"property","comparatorType":"is","comparatorValueDatatype":"str","comparatorValue":"PowerOff","propertyValue":"new_state.attributes.activity_starting"}],"outputs":2,"customoutputs":[],"outputinitially":false,"state_type":"str","x":110,"y":540,"wires":[["2dd70a3c.41af46"],[]]},{"id":"e8a845d3.c74d88","type":"server","name":"Home Assistant","addon":true}]

I also have an automation (also now in node-red) that turns off the TV activity if the TV (Roku) is either paused for an hour or sits on the Home screen for more than 15m. This actually predates the Idle activity by several months, so I’d be surprised if it’s the culprit:

[{"id":"aeac12ce.003e4","type":"server-state-changed","z":"84d1ed44.f4f9a","name":"Roku paused for 1 hour","server":"e8a845d3.c74d88","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"media_player.living_room_tv_roku","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"paused","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"for":"1","forType":"num","forUnits":"hours","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"x":120,"y":660,"wires":[["b453a01f.8f379"],[]]},{"id":"46a5aae9.b86b54","type":"server-state-changed","z":"84d1ed44.f4f9a","name":"Roku idle for 15 minutes","server":"e8a845d3.c74d88","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"media_player.living_room_tv_roku","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"home","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"for":"15","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"x":130,"y":760,"wires":[["b453a01f.8f379"],[]]},{"id":"b453a01f.8f379","type":"api-current-state","z":"84d1ed44.f4f9a","name":"Harmony is in TV mode","server":"e8a845d3.c74d88","version":1,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"remote.harmony_living_room","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":490,"y":660,"wires":[["86899b39.65bfd8"],[]]},{"id":"86899b39.65bfd8","type":"api-call-service","z":"84d1ed44.f4f9a","name":"Turn off TV activity","server":"e8a845d3.c74d88","version":1,"debugenabled":false,"service_domain":"remote","service":"turn_off","entityId":"remote.harmony_living_room","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":770,"y":660,"wires":[["cb661099.49b98"]]},{"id":"e8a845d3.c74d88","type":"server","name":"Home Assistant","addon":true}]

Maybe this is a Harmony bug that happened to start now, but that’d be a big coincidence. OTOH, I have experiencing some general Harmony wonkiness lately unrelated to HA. Unresponsive/laggy commands, etc.

Obviously, I should disable one or both of these flows to see if that changes things. But it’s just such a slow testing process that way, wondering if anyone has other ideas or factors I’m simply not considering?

Cheers.