I have 4-Source 4-Zone Equipment Rack Hub (DIGI-5 D5RH) from xantech
(http://www.xantech.com/Video/AVDistr...n/DIGI-5/D5RH/
(http://www.xantech.com/Video/AVDistr...n/DIGI-5/D5RH/
If this is your first visit, be sure to check out the FAQ. You must register before you can post.
IMPORTANT: Your first post will be checked for appropriate content. This may take a bit of time.
sub main(parms) hs.writelog "serial", parms end sub
'Control for Denon Receiver
'
Const PortNum = 5
Sub Main()
errMsg = hs.OpenComPort(PortNum,"9600,n,8,1",1,"denon.vbs","Receive",vbCr)
If errMsg <> "" Then
hs.writelog "Denon.vbs","Error opening COM" & PortNum & " : " & errMsg
Else
hs.writelog "Denon.vbs","Success opening COM " & PortNum & ". Talking to Denon Receiver"
End if
End Sub 'Main
Sub Send(command)
'============================ S E N D I N G C O M M A N D S =============================================
'Remember what command was issued if there is a data that is comming back
Const LastCommand = "DenonCommand"
hs.createVar LastCommand
hs.saveVar LastCommand, parm
'Issue the command
Select Case ucase(command)
Case "OFF"
hs.SendToComPort PortNum,"PWSTANDBY" & Chr(13) & Chr(10)
hs.writelog "Denon.vbs","Sending command OFF "
hs.ExecX10 "v6", "off",0,0
Case "ON"
hs.SendToComPort PortNum,"PWON" & Chr(13) & Chr(10)
hs.writelog "Denon.vbs","Sending command ON "
hs.ExecX10 "v6", "on",0,0
'Case "TV"
'hs.SendToComPort PortNum, "SITV", & Chr(13) & Chr(10)
Case Else
hs.SendToComPort PortNum,command & Chr(13) & Chr(10)
hs.writelog "Denon.vbs","Denon attempting to send command " & command & " to receiver at COM" & PortNum
End Select
End sub
Sub Receive(strBack) '======================= R E C E I V I N G C O M M A N D S ==========================
CommandIssued = hs.GetVar(LastCommand)
hs.SetDeviceString "v70",strBack,True
hs.writelog "denon.vbs","Denon Receiving Data ------> " & strBack
If strBack = "PWSTANDBY" Then
'hs.SetDeviceString "v6","Standby"
hs.SetDeviceStatus "v6",3
'hs.SetDeviceString "v6", "<img src=/images/homeseer/off.gif>Standby"
End if
If strBack = "PWON" Then
hs.SetDeviceStatus "v6",2
'hs.SetDeviceString "v6", "<img src=/images/homeseer/on.gif>On"
End if
'============================== XM Radio Stuff ========================================
If INStr(strBack,"TFXM") > 0 Then
tag = "TFXM"
PullData(Replace(strBack,tag,""))
End if
'=========================== Input Selection ======================================================================
If InStr(strBack,"SI") > 0 Then
Select Case strBack
Case "SITV"
hs.SetDeviceString "v7","Satellite",True
Case "SIDVD"
hs.SetDeviceString "v7","DVD",True
Case "SIPHONO"
hs.SetDeviceString "v7","Phonograph",True
Case "SICD"
hs.SetDeviceString "v7","CD",True
Case "SITUNER"
hs.SetDeviceString "v7","Tuner",True
Case "SIVCR-1"
hs.SetDeviceString "v7","VCR-1",True
Case "SIVCR-2"
hs.SetDeviceString "v7","VCR-2",True
Case "SIV.AUX"
hs.SetDeviceString "v7","AUX",True
Case Else
hs.SetDeviceString "v7","UNK",True
hs.writelog "Denon.vbs","ERROR. Unknown Input Source " & strBack
End Select
End if
If InStr(strBack,"MV") > 0 Then
volume = Mid(strBack,3,Len(strBack))
hs.SetDeviceString "v8","Master VOL " & volume,True
End if
If InStr(strBack,"MU") > 0 Then
mute = Mid(strBack,3,Len(strBack))
hs.setDeviceString "v9","Mute " & mute,True
End if
' ----------- Zone 2 Stuff
If InStr(strBack,"Z2") > 0 Then
' ------------- New Sutff ----------------------------------
If InStr(strBack,"Z2TUNER") > 0 Then hs.SetDeviceString "V12","Zone 2 Source Tuner", True
'------- ------ New Sutff ----------------------------------
Z2Vol = Mid(strBack,3,Len(strBack))
hs.SetDeviceString "v10","Zone2 VOL " & Z2Vol, True
End if
End sub
Comment