Skip to content
Lieven Hollevoet edited this page Sep 22, 2014 · 1 revision

toc

Table of Contents

File

xbmc_notification.pl

Description

Send notifications to XBMC

Usage

Add the following to your mh.ini

xbmc_notify_address= xbmc_notify_port=

Notes

If notifications are not being received by XBMC, ensure it's listening on 8080. My XBMC install was listening on 80


image:xbmc_mh_notification.png

The following have been commited to the git repo

    • Modifications to send all speech events to xbmc**
Add the following entries to your mh.ini

I've added additional config items to give more control over how the notifications are displayed.

xbmc_timeout=5000 (amount of time to display message on screen -- in milliseconds) xbmc_title=MisterHouse xbmc_image=http://192.168.1.5/ia5/mh.png (Image to display next to message.. I copied favicon.ico)

Added the following

#Tell MH to call our routine each time something is spoken &Speak_pre_add_hook(\&xbmc_yac,1) if $Reload; $v_xbmc_yac_test = new Voice_Cmd('Test XBMC yac connection', undef, 1); if ($state = said $v_xbmc_yac_test) { &xbmc_yac(text=>"This is a test from misterhouse to XBMC"); }

sub xbmc_yac() { my %parms = @_; print "XBMC message sent"; print "----------------"; display_xbmcosd("$config_parms{xbmc_title}", "$parms{text}", $config_parms{xbmc_timeout}, "$config_parms{xbmc_image}"); return; }


Changed the following: display_xbmcosd("System Restarted", "Misterhouse has been restarted"); display_xbmcosd("$config_parms{xbmc_title}", "Misterhouse has been restarted", $config_parms{xbmc_timeout}, "$config_parms{xbmc_image}");

display_xbmcosd("Test Notification", "This is a test notification!!"); display_xbmcosd("$config_parms{xbmc_title}", "This is a test notification!!", $config_parms{xbmc_timeout}, "$config_parms{xbmc_image}");

my ($title, $text) = @_; my ($title, $text, $timeOut, $image) = @_;

my $url = 'http://' .$config_parms{xbmc_notify_address}.':'.$config_parms{xbmc_notify_port}.'/jsonrpc?request={"jsonrpc":"2.0","method":"GUI.ShowNotification","params":{"title":"'.$title.'","message":"'.$text.'"},"id":1}';// my $url = 'http:' .$config_parms{xbmc_notify_address}.':'.$config_parms{xbmc_notify_port}.'/jsonrpc?request={"jsonrpc":"2.0","method":"GUI.ShowNotification","params":{"title":"'.$title.'" , "message":"'.$text.'" , "displaytime":'.$timeOut.' , "image":"'.$image.'" },"id":1}';

Clone this wiki locally