Tuesday, 3 September 2013

OpenElec / XBMC - send a message to a client

With the Frodo release (12.2) of XBMC installed onto a Raspberry Pi via the OpenElec distribution I wanted a easy way to send messages to clients (therefore mitigating the need to shout upstairs )After some googling and trying different ways I found the following ways to display a notification on the client:
  1. Use the JSON-RPC API
  2. In System/Settings/Network/Services activate Allow control of XBMC via HTTP
    Then post something like the following into a browser:

    http://IP:PORT/jsonrpc?request={%22jsonrpc%22:%222.0%22,%22method%22:%22GUI.ShowNotification%22,%22params%22:{%22title%22:%22The%20Title%22,%22message%22:%22This%20is%20the%20message%20displayed%22},%22id%22:1} 


    It should ask for your username / password configured for the web service and afterwards display
    {"id":1,"jsonrpc":"2.0","result":"OK"}
  3. Use xbmc-send via ssh
    ssh into the Openelec client then use the following command
OpenELEC:~ # xbmc-send -a "Notification(Hey,Hey this is a message)"
  1. Use xbmc-send remotely
     Install xbmc eventclient (sudo apt-get install xbmc-eventclients-xbmc-send)then from the remote pc use the following command:
xbmc-send --host=IP_of_OpenElec -a "Notification(Title, the message to display,5000,/storage/.xbmc/addons/service.openelec.settings/resources/skins/Default/media/HomeIcon-Focus.png)"
5000 = the time to display the notification and ...//HomeIcon-Focus.png adds an icon to the notification.