Skip to main content

How to reboot Kodi using Google Home and ha-bridge

If you have an instance of ha-bridge (highly recommended) running on your network like I do, it enables you to create devices that can be ‘seen’ by Google Home and Alexa for remote control via voice.

Recent versions of ha-bridge allow you to create custom commands, one of those being JSON commands so you can set up a device that sends something like the following to your Kodi instance to reboot it.

http://192.168.100.13:8080/jsonrpc?request={"jsonrpc":"2.0","method":"System.Reboot","id":1} –Reboot (replace the IP address with that of your Kodi instance). You can test it in a browser first (recommended) and you should get the following response

{"id":1,"jsonrpc":"2.0","result":"OK"}

An extensive list of working Kodi JSON commands can be found here: https://forum.kodi.tv/showthread.php?tid=157996&page=7

How to set up a ‘Reboot Kodi’ command in ha-bridge

  1. Click Add/Edit top right
  2. Under Name, type Reboot Media Player (or whatever you like).
  3. Under Device Type (Informational), select Custom.
  4. Under On Items > Type, select HTTP Device.
  5. Under On Items > Target Item, paste in the following: http://10.0.1.101:8080/jsonrpc (but using your IP address)
  6. Under On Items > Http Verb, select POST.
  7. Under On Items > Http Body, paste in the following: {"jsonrpc": "2.0", "method": "System.Reboot", "id": 1}
  8. Under On Items > Content Type, select application/json
  9. Click the blue “Add Bridge Device” button
  10. Now go to Bridges Devices (top left) and find your Reboot Media Player device you just added and click on the light blue “Test On” button to see if your Kodi instance reboots.

    ha-bridge_JSON

N.B You do not need any DIM or Off items.

One last step in Google Home using the shortcuts feature as ideally we don’t want to have to say “OK Google, Turn on Reboot Media Player” every time we want to use it.

  1. In the Google Home app in the menu top left, go to …More Settings
  2. Scroll down to Shortcuts

    Screenshot_20170709-132520(1)


  3. Add a new voice command called say “Reboot Kodi” and map it to Turn on Reboot Media Player.

    Screenshot_20170709-132455

All done. You can now reboot Kodi using Google Home. One important thing to note is that if Kodi has actually locked up badly, a JSON call may not work so your best bet is to use SSH for a reboot. If you’re on Android, use the excellent SSH Button for that available in the play store here.

Comments

Popular posts from this blog

Using ESPEasy with Home Assistant via MQTT

Preface: I've just started playing around with Home Assistant on a Raspberry Pi and exploring the world of MQTT to control devices on the network. Learning curve is a bit steep but worth the effort as MQTT is very fast. The hardware and software tools I'm using are as follows: 2 x Sonoff relay units 2 x NodeMCU Boards ESPEasy firmware (must be version 121 or above as that contains the MQTT 'retain' flag option. Home Assistant software on Raspberry Pi2 MQTT Test Software: PC: MQTT.fx Android: MQTT Dashboard

My Notepad++ tricks when editing YAML files in Home Assistant

To comment out a whole section in one go: Highlight the text you want to comment out and use CTRL + Q. If you do this at the start of a line, it will only comment that line. CTRL + Q is toggle mode (comment on/off). CTRL + K will allow you to add multiple comments one after the other.

How to check what entities are filling up your Home Assistant database

If you use the Home Assistant MariaDB add-on, this tip will show you how to query the database so see what Home Assistant entity states are triggering the most, filling up your database. What were going to do: Install the phMyAdmin add-on for MariaDB. Query the MariaDB database. See what entity state changes have the most action. Paste the code below into the SQL query box:  select entity_id,count( * ) from states group by entity_id order by count ( * ) desc; And if you're using the internal home-assistant_v2.db instead, you can use the SQLite Web add-on to achieve the same thing.