Skip to content

Commit 6a49dae

Browse files
authored
Remote control updates (home-assistant#3997)
* Update remote.itach.markdown * Update remote.apple_tv.markdown * Update remote.markdown * Update remote.harmony.markdown * Grammar fixes
1 parent 16fd447 commit 6a49dae

File tree

4 files changed

+49
-62
lines changed

4 files changed

+49
-62
lines changed

source/_components/remote.apple_tv.markdown

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,4 @@ data:
3737
- left
3838
- menu
3939
- select
40-
device: ''
4140
```
42-
43-
Please note that `device` must be specified (because of validation) but is not used by this platform. So you may specify any value.

source/_components/remote.harmony.markdown

Lines changed: 45 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ Configuration variables:
5353
- **name** (*Required*): The hub's name to display in the frontend.
5454
- **host** (*Optional*): The Harmony device's IP address. Leave empty for the IP to be discovered automatically.
5555
- **port** (*Optional*): The Harmony device's port. Defaults to 5222.
56-
- **activity** (*Optional*): Activity to use when turnon service is called without any data.
56+
- **activity** (*Optional*): Activity to use when `turn_on` service is called without any data.
5757
- **delay_secs** (*Optional*): Default duration in seconds between sending commands to a device.
5858

5959
Configuration file:
@@ -64,32 +64,58 @@ Upon startup one file will be written to your Home Assistant configuration direc
6464
- List of all programmed device names and ID numbers
6565
- List of all available commands per programmed device
6666

67-
Supported services:
67+
### {% linkable_title Service `remote.turn_off` %}
6868

69-
- **Turn Off**: Turn off all devices that were switched on from the start of the current activity.s
70-
- **Turn On**: Start an activity, will start the default activity from configuration.yaml if no activity is specified. The specified activity can either be the activity name or the activity ID from the configuration file written to your [Home Assistant configuration directory](/docs/configuration/).
71-
- **Send Command**: Send a single command or a set of commands to one device, device ID and available commands are written to the configuration file at startup. You can optionally specify the number of times you wish to repeat the command(s) and delay you want between repeated command(s).
72-
- **Sync**: Synchronizes the Harmony device with the Harmony web service if any changes are made from the web portal or app.
69+
Turn off all devices that were switched on from the start of the current activity.
7370

71+
| Service data attribute | Optional | Description |
72+
| ---------------------- | -------- | ----------- |
73+
| `entity_id` | yes | Only act on a specific remote, else target all.
7474

75-
### {% linkable_title Examples %}
75+
### {% linkable_title Service `remote.turn_on` %}
76+
77+
Start an activity. Will start the default `activity` from configuration.yaml if no activity is specified. The specified activity can either be the activity name or the activity ID from the configuration file written to your [Home Assistant configuration directory](/docs/configuration/).
78+
79+
| Service data attribute | Optional | Description |
80+
| ---------------------- | -------- | ----------- |
81+
| `entity_id` | yes | Only act on a specific remote, else target all.
82+
| `activity` | yes | Activity ID or Activity Name to start.
83+
84+
### {% linkable_title Service `remote.send_command` %}
85+
86+
Send a single command or a set of commands to one device, device ID and available commands are written to the configuration file at startup. You can optionally specify the number of times you wish to repeat the command(s) and delay you want between repeated command(s).
87+
88+
| Service data attribute | Optional | Description |
89+
| ---------------------- | -------- | ----------- |
90+
| `entity_id` | yes | Only act on a specific remote, else target all.
91+
| `device` | no | Device ID to send the command to.
92+
| `command` | no | A single command or a list of commands to send.
93+
| `num_repeats` | yes | The number of times to repeat the command(s).
94+
| `delay_secs` | yes | The number of seconds between sending each command.
7695

77-
A template switch can be used to display and control the state of an activity in the frontend.
96+
A typical service call for sending several button presses looks like this:
7897

7998
```yaml
80-
switch:
81-
- platform: template
82-
switches:
83-
tv:
84-
value_template: "{% raw %}{% if is_state('remote.family_room', 'on') %}on{% else %}off{% endif %}{% endraw %}"
85-
turn_on:
86-
service: remote.turn_on
87-
entity_id: remote.family_room
88-
turn_off:
89-
service: remote.turn_off
90-
entity_id: remote.family_room
99+
service: remote.send_command
100+
data:
101+
entity_id: remote.tv_room
102+
command:
103+
- home
104+
- 1
105+
- 2
106+
delay_secs: 0.6
91107
```
92108

109+
### {% linkable_title Service `remote.harmony_sync` %}
110+
111+
Synchronize the Harmony device with the Harmony web service if any changes are made from the web portal or app.
112+
113+
| Service data attribute | Optional | Description |
114+
| ---------------------- | -------- | ----------- |
115+
| `entity_id` | yes | Only act on a specific remote, else target all.
116+
117+
### {% linkable_title Examples %}
118+
93119
Template sensors can be utilized to display current activity in the frontend.
94120

95121
```yaml
@@ -104,7 +130,6 @@ sensor:
104130
friendly_name: 'bedroom'
105131
```
106132

107-
108133
The example below shows how to control an `input_boolean` switch using the Harmony remote's current activity. The switch will turn on when the remote's state changes and the Kodi activity is started and off when the remote's state changes and the current activity is PowerOff.
109134

110135
```yaml
@@ -130,39 +155,3 @@ automation:
130155
service: input_boolean.turn_off
131156
entity_id: input_boolean.notify
132157
````
133-
134-
The automation example below shows how to send a command via the harmony remote using the `send_command` service to send the 'Pause' command to the hub, which is already defined as an IR code for each device to be used via the Harmony app. It is checking for the activity name as exposed through the sensor in the harmony remote component using Jinja if statements to set the device_id, sending the correct Pause command for the given activity. This requires checking your activity list and device_id from the `harmony_REMOTENAME.conf` file created when you start the component. In this example, the harmony hub is named bedroom.
135-
136-
```yaml
137-
automation:
138-
- alias: Harmony Pause contextual for activity
139-
trigger:
140-
# trigger happens to be from a flic button - could be any valid event
141-
platform: event
142-
event_type: flic_click
143-
event_data:
144-
button_name: flic_80e4da70bbb1
145-
click_type: double
146-
action:
147-
service: remote.send_command
148-
data_template:
149-
# using a data template to have if brances for relevant device
150-
# Always the same entity_id - the harmony hub
151-
entity_id: remote.bedroom
152-
# Always the same command - the Pause key
153-
command: Pause
154-
# select device based upon the activity being undertaken.
155-
device: >
156-
# when in WATCH TV activity, the pause key relates to a TiVo, which is device 22987101
157-
{% raw %}{% if is_state("sensor.bedroom", "WATCH TV") %}{% raw %}
158-
22987101
159-
# when in WATCH APPLE TV activity, the pause key relates to an Apple TV, which is device 23002316
160-
{% raw %}{% elif is_state("sensor.bedroom", "WATCH APPLE TV") %}{% endraw %}
161-
23002316
162-
{% raw %}{% elif is_state("sensor.bedroom", "PLEX") %}{% endraw %}
163-
23048786
164-
{% raw %}{% elif is_state("sensor.bedroom", "WATCH BLU RAY") %}{% endraw %}
165-
23043122
166-
{% raw %}{% endif %}{% endraw %}
167-
168-
````

source/_components/remote.itach.markdown

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ Configuration variables:
4848
- **name** (*Required*): Command name.
4949
- **data** (*Required*): Hex command data.
5050
51-
An example to call the component from developer tools using the remote, send_command service `{ "entity_id":"remote.tv", "device":"0", "command":"menu" }`
51+
An example to call the component from developer tools using the `remote.send_command` service: `{ "entity_id":"remote.tv", "command":"menu" }`
5252

5353
Note: Global Cache devices expect data in their own format of "sendir...". This component converts hex code to Global Cache IR form.
5454

source/_components/remote.markdown

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ ha_release: "0.34"
1313
Keeps track which remotes are in your environment, their state and allows you to control them.
1414

1515
* Maintains a state per remote and a combined state `all_remotes`.
16-
* Registers services `remote/turn_on`, `remote/turn_off`, `remote/toggle`, `remote/sync`, and `remote/send_command` to control remotes.
16+
* Registers services `remote/turn_on`, `remote/turn_off`, `remote/toggle`, and `remote/send_command` to control remotes.
1717

1818
### {% linkable_title Use the services %}
1919

@@ -25,5 +25,6 @@ Go to the **Developer Tools**, then to **Call Service** in the frontend, and cho
2525

2626
| Service data attribute | Optional | Description |
2727
| ---------------------- | -------- | ----------- |
28-
| `entity_id` | yes | Only act on specific remote. Else targets all.
28+
| `entity_id` | yes | Only act on a specific remote, else target all.
2929

30+
See the platform documentation for each type of remote for more detailed examples.

0 commit comments

Comments
 (0)