You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: source/_integrations/kodi.markdown
+89-67Lines changed: 89 additions & 67 deletions
Original file line number
Diff line number
Diff line change
@@ -36,7 +36,34 @@ If you do not remove it, your configuration will be imported with the following
36
36
37
37
### Turning On/Off
38
38
39
-
You can customize your turn on and off actions through automations. Simply use the relevant Kodi device triggers and your automation will be called to perform the `turn_on` or `turn_off` sequence.
39
+
You can customize your turn on and off actions through automations. Simply use the relevant Kodi device triggers and your automation will be called to perform the `turn_on` or `turn_off` sequence; see the [Kodi turn on/off samples](#kodi-turn-onoff-samples) section for scripts that can be used.
40
+
41
+
These automations can be configured through the UI (see [Device Triggers](/automation/trigger/#device-triggers) for automations). If you prefer YAML, you'll need to get the device ID from the UI automation editor. Automations would be of the form:
42
+
43
+
```yaml
44
+
automation:
45
+
- id: kodi_turn_on
46
+
alias: "Kodi: turn on"
47
+
trigger:
48
+
- platform: device
49
+
device_id: !secret kodi_device_id
50
+
domain: kodi
51
+
entity_id: media_player.kodi
52
+
type: turn_on
53
+
action:
54
+
- service: script.kodi_turn_on
55
+
56
+
- id: kodi_turn_off
57
+
alias: "Kodi: turn off"
58
+
trigger:
59
+
- platform: device
60
+
device_id: !secret kodi_device_id
61
+
domain: kodi
62
+
entity_id: media_player.kodi
63
+
type: turn_off
64
+
action:
65
+
- service: script.kodi_turn_off
66
+
```
40
67
41
68
### Services
42
69
@@ -75,17 +102,16 @@ result: <data received from the Kodi API>
75
102
76
103
### Kodi turn on/off samples
77
104
78
-
With the `turn_on_action` and `turn_off_action` parameters you can run any combination of Home Assistant actions to turn on/off your Kodi instance. Here are a few examples of this usage, including the **migration instructions for the old `turn_off_action` list of options**.
105
+
The following scripts can be used in automations for turning on/off your Kodi instance; see [Turning on/off](#turning-onoff). You could also simply use these sequences directly in the automations without creating scripts.
79
106
80
107
#### Turn on Kodi with Wake on LAN
81
108
82
109
With this configuration, when calling `media_player/turn_on` on the Kodi device, a _magic packet_ will be sent to the specified MAC address. To use this service, first you need to configuration the [`wake_on_lan`](/integrations/wake_on_lan) integration in Home Assistant, which is achieved simply by adding `wake_on_lan:` to your `configuration.yaml`.
83
110
84
111
```yaml
85
-
media_player:
86
-
- platform: kodi
87
-
host: 192.168.0.123
88
-
turn_on_action:
112
+
script:
113
+
turn_on_kodi_with_wol:
114
+
sequence:
89
115
- service: wake_on_lan.send_magic_packet
90
116
data:
91
117
mac: aa:bb:cc:dd:ee:ff
@@ -96,98 +122,94 @@ media_player:
96
122
97
123
Here are the equivalent ways to configure each of the old options to turn off Kodi (`quit`, `hibernate`, `suspend`, `reboot`, or `shutdown`):
98
124
99
-
- **Quit** method (before was `turn_off_action: quit`)
125
+
- **Quit** method
100
126
101
127
```yaml
102
-
media_player:
103
-
- platform: kodi
104
-
host: 192.168.0.123
105
-
turn_off_action:
106
-
service: kodi.call_method
107
-
data:
108
-
entity_id: media_player.kodi
109
-
method: Application.Quit
128
+
script:
129
+
kodi_quit:
130
+
sequence:
131
+
- service: kodi.call_method
132
+
data:
133
+
entity_id: media_player.kodi
134
+
method: Application.Quit
110
135
```
111
136
112
-
- **Hibernate** method (before was `turn_off_action: hibernate`)
137
+
- **Hibernate** method
113
138
114
139
```yaml
115
-
media_player:
116
-
- platform: kodi
117
-
host: 192.168.0.123
118
-
turn_off_action:
119
-
service: kodi.call_method
120
-
data:
121
-
entity_id: media_player.kodi
122
-
method: System.Hibernate
140
+
script:
141
+
kodi_hibernate:
142
+
sequence:
143
+
- service: kodi.call_method
144
+
data:
145
+
entity_id: media_player.kodi
146
+
method: System.Hibernate
123
147
```
124
148
125
-
- **Suspend** method (before was `turn_off_action: suspend`)
149
+
- **Suspend** method
126
150
127
151
```yaml
128
-
media_player:
129
-
- platform: kodi
130
-
host: 192.168.0.123
131
-
turn_off_action:
132
-
service: kodi.call_method
133
-
data:
134
-
entity_id: media_player.kodi
135
-
method: System.Suspend
152
+
script:
153
+
kodi_suspend:
154
+
sequence:
155
+
- service: kodi.call_method
156
+
data:
157
+
entity_id: media_player.kodi
158
+
method: System.Suspend
136
159
```
137
160
138
-
- **Reboot** method (before was `turn_off_action: reboot`)
161
+
- **Reboot** method
139
162
140
163
```yaml
141
-
media_player:
142
-
- platform: kodi
143
-
host: 192.168.0.123
144
-
turn_off_action:
145
-
service: kodi.call_method
146
-
data:
147
-
entity_id: media_player.kodi
148
-
method: System.Reboot
164
+
script:
165
+
kodi_reboot:
166
+
sequence:
167
+
- service: kodi.call_method
168
+
data:
169
+
entity_id: media_player.kodi
170
+
method: System.Reboot
149
171
```
150
172
151
-
- **Shutdown** method (before was `turn_off_action: shutdown`)
173
+
- **Shutdown** method
152
174
153
175
```yaml
154
-
media_player:
155
-
- platform: kodi
156
-
host: 192.168.0.123
157
-
turn_off_action:
158
-
service: kodi.call_method
159
-
data:
160
-
entity_id: media_player.kodi
161
-
method: System.Shutdown
176
+
script:
177
+
kodi_shutdown:
178
+
sequence:
179
+
- service: kodi.call_method
180
+
data:
181
+
entity_id: media_player.kodi
182
+
method: System.Shutdown
162
183
```
163
184
164
185
#### Turn on and off the TV with the Kodi JSON-CEC Add-on
165
186
166
187
For Kodi devices running 24/7 attached to a CEC capable TV (OSMC / OpenElec and systems alike running in Rasperry Pi's, for example), this configuration enables the optimal way to turn on/off the attached TV from Home Assistant while Kodi is always active and ready:
0 commit comments