Im asuming you are talking about the xbmc script.
Its pretty easy really.
1) Copy paste the code below (Little Update for more functions) in a new text document and save this document as XBMC.vb
3) Change the IP adresses in the script to reflect your own XBMC box.
5) Add Device - Device Name: XBMCLocation - Device Type: Status Only - Lettercode: X2
6) Create a button in HStouch, for example Play.
7) ActionWhenReleased - Homeseer:Run a Homeseer script ... - Script: XBMC.vb - ScriptProcedure: Play
Do this for every function you want to use.
Almost forgot...you have to run the ToggleServerIP first for the script to work. This sets the IP adress to use in the StatusDevice X1.
You can off course also use the functions from an event. Make an event that runs the script with the specific funtion(s). Make button that runs a homeseer event.
Code: Select all
' help for XBMC HTTP calls http://www.xbmc.org/wiki/?title=WebServerHTTP-API
' Button mappings http://xbmc.svn.sourceforge.net/viewvc/xbmc/tags/XBMC_2_0_1/XBMC/guilib/Key.h?view=markup
' No Script Procedure requires element input except volume, for the rest fill in any element into parameter 1.
' Uses a virtual device "X1" to store the IP and toggles in case of multiple XBMC machines on the network
Sub ToggleServerIP(parm as object)
' ----------------------- Toggle To Other Server IP ------------------------
Dim XBMCCurrentIP As String = hs.DeviceString("X1")
Dim XBMCBedroomIP As String = "10.255.1.31"
Dim XBMCLivingRoomIP As String = "10.255.1.30"
if XBMCCurrentIP = XBMCBedroomIP Then
hs.SetDeviceString("X1", XBMCLivingRoomIP)
hs.SetDeviceString("X2", "Living Room")
hs.writelog("XBMC", "Controlled XBMC is now " & hs.DeviceString("X2"))
End If
if XBMCCurrentIP = XBMCLivingRoomIP Then
hs.SetDeviceString("X1", XBMCBedroomIP)
hs.SetDeviceString("X2", "Bedroom")
hs.writelog("XBMC", "Controlled XBMC is now " & hs.DeviceString("X2"))
End If
if XBMCCurrentIP <> XBMCLivingRoomIP and XBMCCurrentIP <> XBMCBedroomIP Then
hs.SetDeviceString("X1", XBMCLivingRoomIP)
hs.SetDeviceString("X2", "Living Room")
hs.writelog("XBMC", "No IP was assigned, assigning to LivingRoom ..")
End If
End Sub
Sub Volume(parm as object)
' ------------------------ VOLUME Slider --------------------------
dim XBMCIPAdress As String = hs.DeviceString("X1")
dim XBMCVolumeValue = Val (parm(0))
dim XBMCVolumeCurrentValue As String
dim XBMCVolumeURL As String = "http://" & XBMCIPAdress & "/xbmcCmds/xbmcHttp?command=setvolume(80)"
'Get Current Volume
XBMCVolumeCurrentValue = hs.URLAction ("http://" & XBMCIPAdress & "/xbmcCmds/xbmcHttp?command=GetVolume", "GET", "", "")
'Compose new URL
XBMCVolumeURL = "http://" & XBMCIPAdress & "/xbmcCmds/xbmcHttp?command=setvolume(" & XBMCVolumeValue & ")"
'Send command to XBMC web interface
hs.URLAction (XBMCVolumeURL, "GET", "", "")
hs.writelog("HSTouch", "XBMC Volume Changed to " & XBMCVolumeValue)
End Sub
Sub ToggleMute(parm as object)
' ----------------------- VOLUME Mute Toggle ------------------------
dim XBMCIPAdress As String = hs.DeviceString("X1")
'Compose URL
dim XBMCMuteURL As String = "http://" & XBMCIPAdress & "/xbmcCmds/xbmcHttp?command=Mute()"
'Send command to XBMC web interface
hs.URLAction (XBMCMuteURL, "GET", "", "")
hs.writelog("XBMC", "Toggled Mute")
End Sub
Sub TogglePause(parm as object)
' ----------------------- Pause / Play Toggle ------------------------
dim XBMCIPAdress As String = hs.DeviceString("X1")
'Compose URL
dim XBMCPauseURL As String = "http://" & XBMCIPAdress & "/xbmcCmds/xbmcHttp?command=Pause()"
'Send command to XBMC web interface
hs.URLAction (XBMCPauseURL, "GET", "", "")
hs.writelog("XBMC", "Pause/Play")
End Sub
Sub Play(parm as object)
' ----------------------- Play ------------------------
dim XBMCIPAdress As String = hs.DeviceString("X1")
'Compose URL
dim XBMCPlayURL As String = "http://" & XBMCIPAdress & "/xbmcCmds/xbmcHttp?command=Sendkey(0xF050)"
'Send command to XBMC web interface
hs.URLAction (XBMCPlayURL, "GET", "", "")
hs.writelog("XBMC", "Play")
End Sub
Sub StopPlayback(ByVal parm As Object)
' ----------------------- Stop Playback ------------------------
Dim XBMCIPAdress As String = hs.DeviceString("X1")
'Compose URL
Dim XBMCStopPlaybackURL As String = "http://" & XBMCIPAdress & "/xbmcCmds/xbmcHttp?command=Sendkey(0xF058)"
'Send command to XBMC web interface
hs.URLAction(XBMCStopPlaybackURL, "GET", "", "")
hs.writelog("XBMC", "Stop")
End Sub
Sub Queue(ByVal parm As Object)
' ----------------------- Queue ------------------------
Dim XBMCIPAdress As String = hs.DeviceString("X1")
'Compose URL
Dim XBMCQueueURL As String = "http://" & XBMCIPAdress & "/xbmcCmds/xbmcHttp?command=Sendkey(0xF051)"
'Send command to XBMC web interface
hs.URLAction(XBMCQueueURL, "GET", "", "")
hs.writelog("XBMC", "Added Media To Queue")
End Sub
Sub FastForward(ByVal parm As Object)
' ----------------------- FastForward ------------------------
Dim XBMCIPAdress As String = hs.DeviceString("X1")
'Compose URL
Dim XBMCFastForwardURL As String = "http://" & XBMCIPAdress & "/xbmcCmds/xbmcHttp?command=Sendkey(0xF046)"
'Send command to XBMC web interface
hs.URLAction(XBMCFastForwardURL, "GET", "", "")
hs.writelog("XBMC", "FastForward")
End Sub
Sub Rewind(ByVal parm As Object)
' ----------------------- Rewind ------------------------
Dim XBMCIPAdress As String = hs.DeviceString("X1")
'Compose URL
Dim XBMCRewindURL As String = "http://" & XBMCIPAdress & "/xbmcCmds/xbmcHttp?command=Sendkey(0xF052)"
'Send command to XBMC web interface
hs.URLAction(XBMCRewindURL, "GET", "", "")
hs.writelog("XBMC", "Rewind")
End Sub
Sub PlayBackNext(parm as object)
' ----------------------- PlayBack Next ------------------------
dim XBMCIPAdress As String = hs.DeviceString("X1")
'Compose URL
dim XBMCNextURL As String = "http://" & XBMCIPAdress & "/xbmcCmds/xbmcHttp?command=PlayNext()"
'Send command to XBMC web interface
hs.URLAction (XBMCNextURL, "GET", "", "")
hs.writelog("XBMC", "Next")
End Sub
Sub PlayBackPrev(parm as object)
' ----------------------- PlayBack Previous ------------------------
dim XBMCIPAdress As String = hs.DeviceString("X1")
'Compose URL
dim XBMCPrevURL As String = "http://" & XBMCIPAdress & "/xbmcCmds/xbmcHttp?command=PlayPrev()"
'Send command to XBMC web interface
hs.URLAction (XBMCPrevURL, "GET", "", "")
hs.writelog("XBMC", "Previous")
End Sub
Sub Guide(ByVal parm As Object)
' ----------------------- Guide ------------------------
Dim XBMCIPAdress As String = hs.DeviceString("X1")
'Compose URL
Dim XBMCGuideURL As String = "http://" & XBMCIPAdress & "/xbmcCmds/xbmcHttp?command=Sendkey(0xF04D)"
'Send command to XBMC web interface
hs.URLAction(XBMCGuideURL, "GET", "", "")
hs.writelog("XBMC", "Guide")
End Sub
Sub ToggleWatched(ByVal parm As Object)
' ----------------------- Toggle Watched Status ------------------------
Dim XBMCIPAdress As String = hs.DeviceString("X1")
'Compose URL
Dim XBMCToggleWatchedURL As String = "http://" & XBMCIPAdress & "/xbmcCmds/xbmcHttp?command=Sendkey(0xF057)"
'Send command to XBMC web interface
hs.URLAction(XBMCToggleWatchedURL, "GET", "", "")
hs.writelog("XBMC", "Toggle Watched")
End Sub
Sub NowPlaying(parm as object)
' ----------------------- Now Playing ------------------------
dim XBMCIPAdress As String = hs.DeviceString("X1")
'Compose URL
dim XBMCNowPlayingURL As String = "http://" & XBMCIPAdress & "/xbmcCmds/xbmcHttp?command=getcurrentlyplaying"
'Send command to XBMC web interface
hs.URLAction (XBMCNowPlayingURL, "GET", "", "")
hs.writelog("XBMC", "Now Playing")
End Sub
' ------------------- Navigation Keys ---------------------
Sub NavBack(ByVal parm As Object)
' ----------------------- Navigate Back Button ------------------------
Dim XBMCIPAdress As String = hs.DeviceString("X1")
'Compose URL
Dim XBMCNavBackURL As String = "http://" & XBMCIPAdress & "/xbmcCmds/xbmcHttp?command=SendKey(257)"
'Send command to XBMC web interface
hs.URLAction(XBMCNavBackURL, "GET", "", "")
hs.writelog("XBMC", "Back")
End Sub
Sub Escape(ByVal parm As Object)
' ----------------------- ESC Button ------------------------
Dim XBMCIPAdress As String = hs.DeviceString("X1")
'Compose URL
Dim XBMCEscapeURL As String = "http://" & XBMCIPAdress & "/xbmcCmds/xbmcHttp?command=SendKey(0xF01B)"
'Send command to XBMC web interface
hs.URLAction(XBMCEscapeURL, "GET", "", "")
hs.writelog("XBMC", "Cancel")
End Sub
Sub NavConfirm(parm as object)
' ----------------------- Navigate Confirm Button ------------------------
dim XBMCIPAdress As String = hs.DeviceString("X1")
'Compose URL
dim XBMCNavConfirmURL As String = "http://" & XBMCIPAdress & "/xbmcCmds/xbmcHttp?command=SendKey(256)"
'Send command to XBMC web interface
hs.URLAction (XBMCNavConfirmURL, "GET", "", "")
hs.writelog("XBMC", "Confirm")
End Sub
Sub NavUp(parm as object)
' ----------------------- Navigate Up Button ------------------------
dim XBMCIPAdress As String = hs.DeviceString("X1")
'Compose URL
dim XBMCNavUpURL As String = "http://" & XBMCIPAdress & "/xbmcCmds/xbmcHttp?command=SendKey(270)"
'Send command to XBMC web interface
hs.URLAction (XBMCNavUpURL, "GET", "", "")
End Sub
Sub NavDown(parm as object)
' ----------------------- Navigate Down Button ------------------------
dim XBMCIPAdress As String = hs.DeviceString("X1")
'Compose URL
dim XBMCNavDownURL As String = "http://" & XBMCIPAdress & "/xbmcCmds/xbmcHttp?command=SendKey(271)"
'Send command to XBMC web interface
hs.URLAction (XBMCNavDownURL, "GET", "", "")
End Sub
Sub NavLeft(parm as object)
' ----------------------- Navigate Left Button ------------------------
dim XBMCIPAdress As String = hs.DeviceString("X1")
'Compose URL
dim XBMCNavLeftURL As String = "http://" & XBMCIPAdress & "/xbmcCmds/xbmcHttp?command=SendKey(272)"
'Send command to XBMC web interface
hs.URLAction (XBMCNavLeftURL, "GET", "", "")
End Sub
Sub NavRight(ByVal parm As Object)
' ----------------------- Navigate Right Button ------------------------
Dim XBMCIPAdress As String = hs.DeviceString("X1")
'Compose URL
Dim XBMCNavRightURL As String = "http://" & XBMCIPAdress & "/xbmcCmds/xbmcHttp?command=SendKey(273)"
'Send command to XBMC web interface
hs.URLAction(XBMCNavRightURL, "GET", "", "")
End Sub
Sub Info(ByVal parm As Object)
' ----------------------- Info Button ------------------------
Dim XBMCIPAdress As String = hs.DeviceString("X1")
'Compose URL
Dim XBMCInfoURL As String = "http://" & XBMCIPAdress & "/xbmcCmds/xbmcHttp?command=SendKey(0xF049)"
'Send command to XBMC web interface
hs.URLAction(XBMCInfoURL, "GET", "", "")
End Sub
Sub Menu(ByVal parm As Object)
' ----------------------- Menu Button ------------------------
Dim XBMCIPAdress As String = hs.DeviceString("X1")
'Compose URL
Dim XBMCMenuURL As String = "http://" & XBMCIPAdress & "/xbmcCmds/xbmcHttp?command=SendKey(0xF043)"
'Send command to XBMC web interface
hs.URLAction(XBMCMenuURL, "GET", "", "")
End Sub
Sub TAB(ByVal parm As Object)
' ----------------------- TAB Button ------------------------
Dim XBMCIPAdress As String = hs.DeviceString("X1")
'Compose URL
Dim XBMCTABURL As String = "http://" & XBMCIPAdress & "/xbmcCmds/xbmcHttp?command=SendKey(0xF009)"
'Send command to XBMC web interface
hs.URLAction(XBMCTABURL, "GET", "", "")
End Sub
Sub SubtitleDelay(ByVal parm As Object)
' ----------------------- Subtitle Delay ------------------------
Dim XBMCIPAdress As String = hs.DeviceString("X1")
'Compose URL
Dim XBMCSubtitleDelayURL As String = "http://" & XBMCIPAdress & "/xbmcCmds/xbmcHttp?command=Action(52)"
'Send command to XBMC web interface
hs.URLAction(XBMCSubtitleDelayURL, "GET", "", "")
End Sub
Sub SubtitleDelayPlus(ByVal parm As Object)
' ----------------------- Subtitle Delay Forward ------------------------
Dim XBMCIPAdress As String = hs.DeviceString("X1")
'Compose URL
Dim XBMCSubtitleDelayPlusURL As String = "http://" & XBMCIPAdress & "/xbmcCmds/xbmcHttp?command=Action(53)"
'Send command to XBMC web interface
hs.URLAction(XBMCSubtitleDelayPlusURL, "GET", "", "")
End Sub
Sub NextLanguage(ByVal parm As Object)
' ----------------------- Next Language ------------------------
Dim XBMCIPAdress As String = hs.DeviceString("X1")
'Compose URL
Dim XBMCNextLanguageURL As String = "http://" & XBMCIPAdress & "/xbmcCmds/xbmcHttp?command=Action(56)"
'Send command to XBMC web interface
hs.URLAction(XBMCNextLanguageURL, "GET", "", "")
End Sub
Sub ScanItem(ByVal parm As Object)
' ----------------------- Scan Item ------------------------
Dim XBMCIPAdress As String = hs.DeviceString("X1")
'Compose URL
Dim XBMCScanItemURL As String = "http://" & XBMCIPAdress & "/xbmcCmds/xbmcHttp?command=Action(201)"
'Send command to XBMC web interface
hs.URLAction(XBMCScanItemURL, "GET", "", "")
End Sub
Sub ShowSubtitle(ByVal parm As Object)
' ----------------------- Scan Item ------------------------
Dim XBMCIPAdress As String = hs.DeviceString("X1")
'Compose URL
Dim XBMCShowSubtitleURL As String = "http://" & XBMCIPAdress & "/xbmcCmds/xbmcHttp?command=Action(25)"
'Send command to XBMC web interface
hs.URLAction(XBMCShowSubtitleURL, "GET", "", "")
End Sub
Sub NextSubtitle(ByVal parm As Object)
' ----------------------- Scan Item ------------------------
Dim XBMCIPAdress As String = hs.DeviceString("X1")
'Compose URL
Dim XBMCNextSubtitleURL As String = "http://" & XBMCIPAdress & "/xbmcCmds/xbmcHttp?command=Action(26)"
'Send command to XBMC web interface
hs.URLAction(XBMCNextSubtitleURL, "GET", "", "")
End Sub
Sub CurrentPlaylist(ByVal parm As Object)
' ----------------------- Scan Item ------------------------
Dim XBMCIPAdress As String = hs.DeviceString("X1")
'Compose URL
Dim XBMCCurrentPlaylistURL As String = "http://" & XBMCIPAdress & "/xbmcCmds/xbmcHttp?command=ExecBuiltIn(ActivateWindow(musicplaylist))"
'Send command to XBMC web interface
hs.URLAction(XBMCCurrentPlaylistURL, "GET", "", "")
End Sub
Sub SMS2(ByVal parm As Object)
' ----------------------- Navigate to titles A/B/C ------------------------
Dim XBMCIPAdress As String = hs.DeviceString("X1")
'Compose URL
Dim SMS2URL As String = "http://" & XBMCIPAdress & "/xbmcCmds/xbmcHttp?command=Action(142)"
'Send command to XBMC web interface
hs.URLAction(SMS2URL, "GET", "", "")
End Sub
Sub SMS3(ByVal parm As Object)
' ----------------------- Navigate to titles D/E/F ------------------------
Dim XBMCIPAdress As String = hs.DeviceString("X1")
'Compose URL
Dim SMS3URL As String = "http://" & XBMCIPAdress & "/xbmcCmds/xbmcHttp?command=Action(143)"
'Send command to XBMC web interface
hs.URLAction(SMS3URL, "GET", "", "")
End Sub
Sub SMS4(ByVal parm As Object)
' ----------------------- Navigate to titles G/H/I ------------------------
Dim XBMCIPAdress As String = hs.DeviceString("X1")
'Compose URL
Dim SMS4URL As String = "http://" & XBMCIPAdress & "/xbmcCmds/xbmcHttp?command=Action(144)"
'Send command to XBMC web interface
hs.URLAction(SMS4URL, "GET", "", "")
End Sub
Sub SMS5(ByVal parm As Object)
' ----------------------- Navigate to titles J/K/L ------------------------
Dim XBMCIPAdress As String = hs.DeviceString("X1")
'Compose URL
Dim SMS5URL As String = "http://" & XBMCIPAdress & "/xbmcCmds/xbmcHttp?command=Action(145)"
'Send command to XBMC web interface
hs.URLAction(SMS5URL, "GET", "", "")
End Sub
Sub SMS6(ByVal parm As Object)
' ----------------------- Navigate to titles M/N/O ------------------------
Dim XBMCIPAdress As String = hs.DeviceString("X1")
'Compose URL
Dim SMS6URL As String = "http://" & XBMCIPAdress & "/xbmcCmds/xbmcHttp?command=Action(146)"
'Send command to XBMC web interface
hs.URLAction(SMS6URL, "GET", "", "")
End Sub
Sub SMS7(ByVal parm As Object)
' ----------------------- Navigate to titles P/Q/R ------------------------
Dim XBMCIPAdress As String = hs.DeviceString("X1")
'Compose URL
Dim SMS7URL As String = "http://" & XBMCIPAdress & "/xbmcCmds/xbmcHttp?command=Action(147)"
'Send command to XBMC web interface
hs.URLAction(SMS7URL, "GET", "", "")
End Sub
Sub SMS8(ByVal parm As Object)
' ----------------------- Navigate to titles S/T/U ------------------------
Dim XBMCIPAdress As String = hs.DeviceString("X1")
'Compose URL
Dim SMS8URL As String = "http://" & XBMCIPAdress & "/xbmcCmds/xbmcHttp?command=Action(148)"
'Send command to XBMC web interface
hs.URLAction(SMS8URL, "GET", "", "")
End Sub
Sub SMS9(ByVal parm As Object)
' ----------------------- Navigate to titles V/W/X/Y/Z ------------------------
Dim XBMCIPAdress As String = hs.DeviceString("X1")
'Compose URL
Dim SMS9URL As String = "http://" & XBMCIPAdress & "/xbmcCmds/xbmcHttp?command=Action(149)"
'Send command to XBMC web interface
hs.URLAction(SMS9URL, "GET", "", "")
End Sub
' ---------------- Navigate Directly To Pages ----------------
Sub NavPageHome(ByVal parm As Object)
' ----------------------- Navigate to HomePage ------------------------
Dim XBMCIPAdress As String = hs.DeviceString("X1")
'Compose URL
Dim XBMCNavHomeURL As String = "http://" & XBMCIPAdress & "/xbmcCmds/xbmcHttp?command=ExecBuiltIn(ActivateWindow(Home))"
'Send command to XBMC web interface
hs.URLAction(XBMCNavHomeURL, "GET", "", "")
hs.writelog("XBMC", "Navigating to Home Page")
End Sub
Sub NavPageVideos(ByVal parm As Object)
' ----------------------- Navigate to Videos ------------------------
Dim XBMCIPAdress As String = hs.DeviceString("X1")
'Compose URL
Dim XBMCNavPageVideosURL As String = "http://" & XBMCIPAdress & "/xbmcCmds/xbmcHttp?command=ExecBuiltIn(ActivateWindow(Videos,Files,return))"
'Send command to XBMC web interface
hs.URLAction(XBMCNavPageVideosURL, "GET", "", "")
hs.writelog("XBMC", "Navigating to Video Page")
End Sub
Sub NavPageMusic(ByVal parm As Object)
' ----------------------- Navigate to Videos ------------------------
Dim XBMCIPAdress As String = hs.DeviceString("X1")
'Compose URL
Dim XBMCNavPageMusicURL As String = "http://" & XBMCIPAdress & "/xbmcCmds/xbmcHttp?command=ExecBuiltIn(ActivateWindow(musicfiles,Muziek,return))"
'Send command to XBMC web interface
hs.URLAction(XBMCNavPageMusicURL, "GET", "", "")
hs.writelog("XBMC", "Navigating to Music Page")
End Sub
Sub ShutDown(ByVal parm As Object)
' ----------------------- Shutdown the Machine ------------------------
Dim XBMCIPAdress As String = hs.DeviceString("X1")
'Compose URL
Dim XBMCShutDownURL As String = "http://" & XBMCIPAdress & "/xbmcCmds/xbmcHttp?command=Shutdown()"
'Send command to XBMC web interface
hs.URLAction(XBMCShutDownURL, "GET", "", "")
hs.writelog("XBMC", "Shutting down " & XBMCIPAdress)
End Sub
Sub Restart(ByVal parm As Object)
' ----------------------- Restart HTPC ------------------------
Dim XBMCIPAdress As String = hs.DeviceString("X1")
'Compose URL
Dim XBMCRestartURL As String = "http://" & XBMCIPAdress & "/xbmcCmds/xbmcHttp?command=Restart()"
'Send command to XBMC web interface
hs.URLAction(XBMCRestartURL, "GET", "", "")
hs.writelog("XBMC", "Restarting HTPC " & XBMCIPAdress)
End Sub