Monday 18 February 2013

XBMC / Vera Integration send notifications to XBMC

This is written for XBMC V12 Frodo. If you want to be able to send event notifications from Vera to your TV screens running XBMC read on.

First you need to enabled HTTP control in XBMC, to do this go to System - Settings – Services – Webserver. Enable “Allow control of XBMC via HTTP”.

The default port number is 8080, my user name is xbmc I did not set a password.

image

Now for a quick test, open a web browser and enter this in to the address bar and hit enter:




http://192.168.1.7:8080/jsonrpc?request={%22jsonrpc%22:%222.0%22,%22method%22:%22GUI.ShowNotification%22,%22params%22:{%22title%22:%22Motion%20Detected%22,%22message%22:%22Front%20Door%22},%22id%22:1}

Change the IP address to the IP address of your XBMC PC. On your XBMC it should pop up with a notification that has a title of Motion Detected and the message says Front Door.

image

image

Customize the HTTP command to change the title and message text for your own purposes.

http://192.168.1.7:8080/jsonrpc?request={%22jsonrpc%22:%222.0%22,%22method%22:%22GUI.ShowNotification%22,%22params%22:{%22title%22:%22Motion%20Detected%22,%22message%22:%22Front%20Door%22},%22id%22:1}

I have an Everspring Z-wave motion detector outside my front door, so I can monitor if someone is outside my house at my porch. In VeraLite I have a scene that turns on my porch light when this motion sensor detects movement (If its night) and it also sends the popup notification to the XBMC PC in the living room.

To do this simply click in to the Luup tab of your scene and add in the HTTP command string.

image

You need to add some extra code however, the bits highlighted in red below are what you need to add for the HTTP command to work in Vera.

luup.inet.wget("http://192.168.1.7:8080/jsonrpc?request={%22jsonrpc%22:%222.0%22,%22method%22:%22GUI.ShowNotification%22,%22params%22:{%22title%22:%22Motion%20Detected%22,%22message%22:%22Front%20Door%22},%22id%22:1}")

Click the Save Lua button, then confirm changes – Save and Reload Vera.

Now try running your Vera scene and your new notification should pop up on your XBMC / TV screen.

image

Job done!

12 comments:

  1. Hi,

    Nice post. How do I customize the audible tone? I am using Aeon Nox skin. I know I've seen the setting somewhere before. Currently the system beeps when the message disappears. I would like it to beep when the message appears instead.

    Thanks, PLA

    ReplyDelete
  2. Hi,

    Nice post. How do I customize the audible tone? I am using Aeon Nox skin. I know I've seen the setting somewhere before. Currently the system beeps when the message disappears. I would like it to beep when the message appears instead.

    Thanks, PLA

    ReplyDelete
  3. Hi,

    Nice post. How do I customize the audible tone? I am using Aeon Nox skin. I know I've seen the setting somewhere before. Currently the system beeps when the message disappears. I would like it to beep when the message appears instead.

    Thanks, PLA

    ReplyDelete
  4. Great post with nice details. I really like your info. Thanks for sharing.

    emergency mass notification software

    ReplyDelete
  5. Getting error when i enter the code in Vera but working fine from browser.Any ideas.

    ReplyDelete
  6. Put the http command inside this and try again in your Vera scenes Luup

    luup.inet.wget("http command here")

    ReplyDelete

  7. hi im having the same issue on vera u17. send fine in the browser but nothing from vera. same when testing luup (lua) inside vera. displays code sent successfully but nothing is displayed on kodi

    luup.inet.wget("http://kodi ip:kodi port/jsonrpc?request={%22jsonrpc%22:%222.0%22,%22method%22:%22GUI.ShowNotification%22,%22params%22:{%22title%22:%22Motion%20Detected%22,%22message%22:%22Front%20Door%22},%22id%22:1}")

    ReplyDelete
  8. Could be a URL encoding issue. Go to this website http://www.url-encode-decode.com enter the http command and click the decode button.

    ReplyDelete
  9. I assume you are also using the correct IP address and port number for your kodi box in the http command.

    ReplyDelete
  10. this is the decoded syntax from your link

    luup.inet.wget("http://192.168.0.39:8080/jsonrpc?request={"jsonrpc":"2.0","method":"GUI.ShowNotification","params":{"title":"Motion Detected","message":"Front Door"},"id":1}")

    ReplyDelete
    Replies
    1. Vera can be funny some times with the URL encoding.

      If you have a username and password set on your Kodi web server you will need to add that to the URL. Not sure how but a search on the Kodi forum should give you some examples.

      Delete
  11. Thanks for all your help I found the solution if you ever want to later add it to your post

    http://username:password@host:port/

    Your a legend!

    ReplyDelete