I am only here to post a working example for an automation (configured via GUI), even if it is an old thread. ^^
Was locking for an example and found this thread.
1st you have to open the harmony conf file in the File editor like
/homeassistant/harmony_12345678.conf
to get all the information for your device.
It will look like this (snipped)
...
"Devices": {
"LG-Monitor": {
"commands": [
"PowerToggle",
"Mute",
"VolumeDown",
"VolumeUp",
"DirectionDown",
"DirectionLeft",
"DirectionRight",
"DirectionUp",
"OK",
"Menu",
"Audio",
"PIP",
"PictureMode",
"Exit",
"PictureMode",
"AudioSelect",
"FullScreen",
"GameMode",
"Input",
"InputHdmi1",
"InputHdmi2",
"InputHdmi3",
"InputHdmi4",
"InputUsb",
"PBP"
],
"id": "87654321"
},
...
here you can find the name of the device, in my case LG-Monitor
and the available commands. As I created the automation, I put the name of the device in quotes, but HA removes the quotes after I saved the automation.
After this you have to find the ID of your Harmony Hub. This value will be needed for the entity_id
Go to Settings → Devices → search for Harmony → click on “X Devices” → click on your device (your Harmony Hub name)
click here
click here
click here
to copy the ID
alias: Harmony - PIP EIN
description: ""
triggers:
- trigger: state
entity_id:
- input_button.pip_ein
actions:
- data_template:
command:
- PIP
- OK
device: LG-Monitor
entity_id: remote.sz_harmony_hub
delay_secs: 1.6
action: remote.send_command
2nd example
alias: Harmony - PIP AUS
description: ""
triggers:
- trigger: state
entity_id:
- input_button.pip_aus
conditions: []
actions:
- data_template:
command:
- FullScreen
- OK
device: LG-Monitor
entity_id: remote.sz_harmony_hub
delay_secs: 1.6
action: remote.send_command
mode: single
delay_secs
is for the delay in seconds between the commands.
Finally the link to the documentation: