Site updated at 2017-05-20 22:59:15 UTC
This commit is contained in:
parent
024eeb853f
commit
ebffa845cd
709 changed files with 10815 additions and 1472 deletions
|
@ -85,7 +85,99 @@
|
|||
<li><strong>password</strong> (<em>Optional</em>): The XBMC/Kodi HTTP password.</li>
|
||||
<li><strong>turn_off_action</strong> (<em>Optional</em>): The desired turn off action. Options are <code class="highlighter-rouge">none</code>, <code class="highlighter-rouge">quit</code>, <code class="highlighter-rouge">hibernate</code>, <code class="highlighter-rouge">suspend</code>, <code class="highlighter-rouge">reboot</code>, or <code class="highlighter-rouge">shutdown</code>. Default <code class="highlighter-rouge">none</code>.</li>
|
||||
<li><strong>enable_websocket</strong> (<em>Optional</em>): Enable websocket connections to Kodi via the TCP port. Defaults to <code class="highlighter-rouge">true</code>. The websocket connection allows Kodi to push updates to Home Assistant and removes the need for Home Assistant to poll. If websockets don’t work on your installation this can be set to <code class="highlighter-rouge">false</code>.</li>
|
||||
<li><strong>timeout</strong> (<em>Optional</em>): Set timeout for connections to Kodi. Defaults to 5 seconds.</li>
|
||||
</ul>
|
||||
<h3><a class="title-link" name="service-kodi_add_to_playlist" href="#service-kodi_add_to_playlist"></a> Service <code class="highlighter-rouge">kodi_add_to_playlist</code></h3>
|
||||
<p>Add music to the default playlist (i.e. playlistid=0).</p>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Service data attribute</th>
|
||||
<th>Optional</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><code class="highlighter-rouge">entity_id</code></td>
|
||||
<td>no</td>
|
||||
<td>Name(s) of the Kodi entities where to add the media.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code class="highlighter-rouge">media_type</code></td>
|
||||
<td>yes</td>
|
||||
<td>Media type identifier. It must be one of SONG or ALBUM.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code class="highlighter-rouge">media_id</code></td>
|
||||
<td>no</td>
|
||||
<td>Unique Id of the media entry to add (<code class="highlighter-rouge">songid</code> or <code class="highlighter-rouge">albumid</code>). If not defined, <code class="highlighter-rouge">media_name</code> and <code class="highlighter-rouge">artist_name</code> are needed to search the Kodi music library.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code class="highlighter-rouge">media_name</code></td>
|
||||
<td>no</td>
|
||||
<td>Optional media name for filtering media. Can be ‘ALL’ when <code class="highlighter-rouge">media_type</code> is ‘ALBUM’ and <code class="highlighter-rouge">artist_name</code> is specified, to add all songs from one artist.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code class="highlighter-rouge">artist_name</code></td>
|
||||
<td>no</td>
|
||||
<td>Optional artist name for filtering media.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<h3><a class="title-link" name="service-kodi_call_method" href="#service-kodi_call_method"></a> Service <code class="highlighter-rouge">kodi_call_method</code></h3>
|
||||
<p>Call a <a href="http://kodi.wiki/?title=JSON-RPC_API">Kodi JSONRPC API</a> method with optional parameters. Results of the Kodi API call will be redirected in a Home Assistant event: <code class="highlighter-rouge">kodi_call_method_result</code>.</p>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Service data attribute</th>
|
||||
<th>Optional</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><code class="highlighter-rouge">entity_id</code></td>
|
||||
<td>no</td>
|
||||
<td>Name(s) of the Kodi entities where to run the API method.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code class="highlighter-rouge">method</code></td>
|
||||
<td>yes</td>
|
||||
<td>Name of the Kodi JSONRPC API method to be called.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>any other parameter</td>
|
||||
<td>no</td>
|
||||
<td>Optional parameters for the Kodi API call.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<h3><a class="title-link" name="event-triggering" href="#event-triggering"></a> Event triggering</h3>
|
||||
<p>When calling the <code class="highlighter-rouge">kodi_call_method</code> service, if the Kodi JSONRPC API returns data, when received by Home Assistant it will fire a <code class="highlighter-rouge">kodi_call_method_result</code> event on the event bus with the following <code class="highlighter-rouge">event_data</code>:</p>
|
||||
<div class="language-yaml highlighter-rouge"><pre class="highlight"><code><span class="s">entity_id</span><span class="pi">:</span> <span class="s2">"</span><span class="s"><Kodi</span><span class="nv"> </span><span class="s">media_player</span><span class="nv"> </span><span class="s">entity_id>"</span>
|
||||
<span class="s">result_ok</span><span class="pi">:</span> <span class="s"><boolean></span>
|
||||
<span class="s">input</span><span class="pi">:</span> <span class="s"><input parameters of the service call></span>
|
||||
<span class="s">result</span><span class="pi">:</span> <span class="s"><data received from the Kodi API></span>
|
||||
</code></pre>
|
||||
</div>
|
||||
<h3><a class="title-link" name="kodi-services-samples" href="#kodi-services-samples"></a> Kodi services samples</h3>
|
||||
<h4>Simple script to turn on the TV with the Kodi JSON-CEC Addon</h4>
|
||||
<div class="language-yaml highlighter-rouge"><pre class="highlight"><code><span class="s">script</span><span class="pi">:</span>
|
||||
<span class="s">activate_tv</span><span class="pi">:</span>
|
||||
<span class="s">alias</span><span class="pi">:</span> <span class="s">Turn on TV</span>
|
||||
<span class="s">sequence</span><span class="pi">:</span>
|
||||
<span class="pi">-</span> <span class="s">alias</span><span class="pi">:</span> <span class="s">TV on</span>
|
||||
<span class="s">service</span><span class="pi">:</span> <span class="s">media_player.kodi_call_method</span>
|
||||
<span class="s">data</span><span class="pi">:</span>
|
||||
<span class="s">entity_id</span><span class="pi">:</span> <span class="s">media_player.kodi</span>
|
||||
<span class="s">method</span><span class="pi">:</span> <span class="s">Addons.ExecuteAddon</span>
|
||||
<span class="s">addonid</span><span class="pi">:</span> <span class="s">script.json-cec</span>
|
||||
<span class="s">params</span><span class="pi">:</span>
|
||||
<span class="s">command</span><span class="pi">:</span> <span class="s">activate</span>
|
||||
</code></pre>
|
||||
</div>
|
||||
<p>For a more complex usage of the <code class="highlighter-rouge">kodi_call_method</code> service, with event triggering of Kodi API results, you can have a look at this <a href="/cookbook/kodi_dynamic_input_select/">example</a></p>
|
||||
</article>
|
||||
</div>
|
||||
<aside id="sidebar" class="grid__item one-third lap-one-whole palm-one-whole">
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue