Here is a quick example showing how to add a button in the XBMC skin that trigger an event in HS when clicked.
step 1: Create a simple python script with these two lines:
the parameters sender and message will be checked by HomeSeer to know which event to trigger (see step 3)
step 2: Modify the XBMC skin to add a button which, when clicked, will run the script.
For example I have added a button for the Confluence skin by adding the following lines of code in VideoOSD.xml just before the subtitles button:
and here is how it shows in XBMC:
step 3: Now we just need to tell HomeSeer to do something when it receives the notification from XBMC. We do so by creating an Event with a XBMC Trigger of type "Addon Trigger", and we set the parameter values for sender and message as in our script.
et voila
step 1: Create a simple python script with these two lines:
Code:
import xbmc xbmc.executeJSONRPC('{ "jsonrpc": "2.0", "method": "JSONRPC.NotifyAll", "params": {"sender": "SimpleScript", "message": "Toggle Lights"}, "id": 1 }')
step 2: Modify the XBMC skin to add a button which, when clicked, will run the script.
For example I have added a button for the Confluence skin by adding the following lines of code in VideoOSD.xml just before the subtitles button:
Code:
<control type="button" id="249"> <posx>-55</posx> <posy>0</posy> <width>55</width> <height>55</height> <label>13395</label> <font>-</font> <texturefocus>icon_favourites.png</texturefocus> <texturenofocus>icon_favourites.png</texturenofocus> <onleft>205</onleft> <onright>250</onright> <onup>1000</onup> <ondown>1000</ondown> <onclick>XBMC.RunScript(D:\SimpleScript.py)</onclick> </control>
step 3: Now we just need to tell HomeSeer to do something when it receives the notification from XBMC. We do so by creating an Event with a XBMC Trigger of type "Addon Trigger", and we set the parameter values for sender and message as in our script.
et voila
Comment