Defining switches with new Harmony integration

Now that it’s no longer third-party, I’m trying to get the Harmony stuff set up to replace the functionality I was originally doing with HarmonyHubControl.

Basically this was stupidly simple: execute a script, issue a Harmony command; just a single remote button press. But the current documentation doesn’t really go beyond “here’s how to set up your activity list.” Can someone give me an idea of what the sequence would look like? I have…

mute_htpc_2:
  sequence:
  - service: remote.send_command
    entity_id: remote.freds_harmony_hub
    data:
      device: 34450182
      command: Mute

…and I’m sure that isn’t right, but it’s probably close? Maybe?

Can someone help?

EDIT: Holy crap, that WORKS. :slight_smile: Okay, so I think I’m good! :slight_smile:

Does anyone have example code of a switch for say controlling just the device power on the tv?

service: remote.send_command
data_template:
  command: PowerOn
  device: 37313947
  entity_id: remote.livingroom

I used to do it this way with another product.

- platform: command_line
  switches:
    vizio_tv:
      command_on: "/config/harmony/HarmonyHubControl HarMony hub 10.0.1.16  issue_device_command 37313947 PowerOn"
      command_off: "/config/harmony/HarmonyHubControl HarMony hub 10.0.1.16  issue_device_command 37313947 PowerOff"

So I put all of my switches in a single file, but this would give you an idea of the syntax:

sleep_htpc:
  sequence:
    - service: remote.send_command
      entity_id: remote.freds_harmony_hub
      data:
        device: 34450182
        command: PowerToggle

I can’t seem to get the syntax right. My switches are all in a separate file as well.

- platform: template
  switches:
    LivingRoom_Screen:
      value_template: "{{ is_state('switch.source', 'on') }}"
      turn_on:
        service: remote.send_command
        entity_id: remote.livingroom
        data:
          device: 37313947
          command: PowerOn
      turn_off:
        service: remote.send_command
        entity_id: remote.livingroom
        data:
          device: 37313947
          command: PowerOff

Learned that caps are not acceptable

 switches:
    livingroom_screen:

Getting closer. Just have to fix the switch status being unavailable… Probably something to do with the value_template