Vinnerliste
Populært innhold
Viser innholdet med mest poeng fra 08. juni 2016 i Innlegg
-
GrandbeingMX0404.vb Script for å styre en Grandbeing MX0404 HDMI matrise. Lager en root med tilhørende child-devicer for hver utgang hvor man kan trykke på de forskjellige inngangene. Alt i et script, men dette blir nok en plugin på sikt (der er det lettere å få til en autorefresh, og sånt). '© Moskus 2014 Dim Scriptname As String = "GrandbeingMX0404.vb" Dim hdmi_outputs() As String = {"None", "TV", "SageTV", "Xbox", "Extra"} Dim ip_address As String = "192.168.0.39" Public Sub Main(parm As Object) End Sub Public Sub Setup(parm As Object) 'Setting up devices 'Creating master device Dim dt As New HomeSeerAPI.DeviceTypeInfo Dim devref As Integer = hs.NewDeviceRef("Root") Dim dv As Scheduler.Classes.DeviceClass = hs.GetDeviceByRef(devref) Try dv.Location(hs) = "HDMI matrix" dv.Location2(hs) = "Media" dv.Device_Type_String(hs) = "HDMI root" dv.DeviceType_Set(hs) = New HomeSeerAPI.DeviceTypeInfo dv.Status_Support(hs) = True dv.Can_Dim(hs) = False hs.SaveEventsDevices() dv.MISC_Set(hs, HomeSeerAPI.Enums.dvMISC.SHOW_VALUES) dv.MISC_Clear(hs, HomeSeerAPI.Enums.dvMISC.STATUS_ONLY) 'Adding a "Refresh" button to the root device hs.DeviceScriptButton_AddButton(devref, "Refresh", 0, Scriptname, "ButtonPress", "Refresh", 1, 1, 1) hs.SaveEventsDevices() Dim SVpair As New HomeSeerAPI.VSPair(HomeSeerAPI.ePairStatusControl.Status) SVpair.PairType = HomeSeerAPI.VSVGPairType.SingleValue SVpair.Value = 0 SVpair.Status = "HDMI matrix" hs.DeviceVSP_AddPair(devref, SVpair) Dim VGpair As New HomeSeerAPI.VGPair VGpair.PairType = HomeSeerAPI.VSVGPairType.SingleValue VGpair.Set_Value = 0 VGpair.Graphic = "images/Moskus/icon_hdmi.png" hs.DeviceVGP_AddPair(devref, VGpair) hs.WriteLog("HDMI matrix", "Root device for HDMI matrix created") Catch ex As Exception hs.WriteLog("HDMI matrix", "Error creating root device: " & ex.Message) End Try 'Creating child devices dv.Relationship(hs) = HomeSeerAPI.Enums.eRelationship.Parent_Root For i As Integer = 1 To 4 Dim childref As Integer = CreateOutputDevice(i, devref) If childref > 0 Then dv.AssociatedDevice_Add(hs, childref) Next End Sub Public Function CreateOutputDevice(ByVal output As Integer, masterdevice As Integer) As Integer 'Creating device Dim dt As New HomeSeerAPI.DeviceTypeInfo Dim devref As Integer = hs.NewDeviceRef("Output " & output) Dim dv As Scheduler.Classes.DeviceClass = hs.GetDeviceByRef(devref) Try dv.Location(hs) = "HDMI matrix" dv.Location2(hs) = "Media" dv.Device_Type_String(hs) = "HDMI out " & output dv.DeviceType_Set(hs) = New HomeSeerAPI.DeviceTypeInfo hs.SaveEventsDevices() dv.Status_Support(hs) = True dv.Can_Dim(hs) = False dv.MISC_Set(hs, HomeSeerAPI.Enums.dvMISC.SHOW_VALUES) dv.MISC_Clear(hs, HomeSeerAPI.Enums.dvMISC.STATUS_ONLY) dv.Relationship(hs) = HomeSeerAPI.Enums.eRelationship.Child dv.AssociatedDevice_Add(hs, masterdevice) dv = Nothing hs.WriteLog("HDMI matrix", "Test Device for output " & output & " created") Catch ex As Exception hs.WriteLog("HDMI matrix", "Error creating devices: " & ex.Message) Return 0 End Try Dim SVpair_off As New HomeSeerAPI.VSPair(HomeSeerAPI.ePairStatusControl.Status) SVpair_off.PairType = HomeSeerAPI.VSVGPairType.SingleValue SVpair_off.Value = 0 SVpair_off.Status = "None" hs.DeviceVSP_AddPair(devref, SVpair_off) Dim VGpair_off As New HomeSeerAPI.VGPair VGpair_off.PairType = HomeSeerAPI.VSVGPairType.SingleValue VGpair_off.Set_Value = 0 VGpair_off.Graphic = "images/Moskus/icon_hdmi_X.png" hs.DeviceVGP_AddPair(devref, VGpair_off) 'Adding buttons, values and graphic For i As Integer = 1 To 4 hs.DeviceScriptButton_AddButton(devref, output & "-" & i, i, Scriptname, "ButtonPress", output & "-" & i, 1, i, 1) Dim SVpair As New HomeSeerAPI.VSPair(HomeSeerAPI.ePairStatusControl.Status) SVpair.PairType = HomeSeerAPI.VSVGPairType.SingleValue SVpair.Value = i SVpair.Status = "Input " & i hs.DeviceVSP_AddPair(devref, SVpair) Dim VGpair As New HomeSeerAPI.VGPair VGpair.PairType = HomeSeerAPI.VSVGPairType.SingleValue VGpair.Set_Value = i VGpair.Graphic = "images/Moskus/icon_hdmi_" & i & ".png" hs.DeviceVGP_AddPair(devref, VGpair) Next Return devref End Function Public Sub ButtonPress(Input As Object) Dim devref As Integer = Input(0) Dim ButtonName As String = Input(1) Dim output As String = String.Empty 'Gets filled by GetURLIE Dim device As Integer = 0 Dim master As Integer = hs.GetDeviceParentRefByRef(devref) If master = 0 Then master = devref Dim dv As Scheduler.Classes.DeviceClass = hs.GetDeviceByRef(master) For Each devid As Integer In dv.AssociatedDevices(hs) Dim dev As Scheduler.Classes.DeviceClass = hs.GetDeviceByRef(devid) Select Case dev.Device_Type_String(hs) Case Is = "HDMI root" device = 0 Case Is = "HDMI out 1" device = 1 Case Is = "HDMI out 2" device = 2 Case Is = "HDMI out 3" device = 3 Case Is = "HDMI out 4" End Select Next Dim command As String = "Refresh" If device > 0 Then Dim value As Integer = hdmi_outputs.ToList.IndexOf(ButtonName) command = device & "-" & value End If Select Case command Case Is = "Refresh" output = hs.GetURLIE("http://" & ip_address & "/get_data?type=refrash", True) '"refrash" is actually not a typo on my part... Case Is = "1-1" output = hs.GetURLIE("http://" & ip_address & "/get_data?type=port&cmd=a09", True) Case Is = "1-2" output = hs.GetURLIE("http://" & ip_address & "/get_data?type=port&cmd=a1D", True) Case Is = "1-3" output = hs.GetURLIE("http://" & ip_address & "/get_data?type=port&cmd=a1F", True) Case Is = "1-4" output = hs.GetURLIE("http://" & ip_address & "/get_data?type=port&cmd=a0D", True) Case Is = "2-1" output = hs.GetURLIE("http://" & ip_address & "/get_data?type=port&cmd=a17", True) Case Is = "2-2" output = hs.GetURLIE("http://" & ip_address & "/get_data?type=port&cmd=a12", True) Case Is = "2-3" output = hs.GetURLIE("http://" & ip_address & "/get_data?type=port&cmd=a59", True) Case Is = "2-4" output = hs.GetURLIE("http://" & ip_address & "/get_data?type=port&cmd=a08", True) Case Is = "3-1" output = hs.GetURLIE("http://" & ip_address & "/get_data?type=port&cmd=a5E", True) Case Is = "3-2" output = hs.GetURLIE("http://" & ip_address & "/get_data?type=port&cmd=a06", True) Case Is = "3-3" output = hs.GetURLIE("http://" & ip_address & "/get_data?type=port&cmd=a05", True) Case Is = "3-4" output = hs.GetURLIE("http://" & ip_address & "/get_data?type=port&cmd=a03", True) Case Is = "4-1" output = hs.GetURLIE("http://" & ip_address & "/get_data?type=port&cmd=a18", True) Case Is = "4-2" output = hs.GetURLIE("http://" & ip_address & "/get_data?type=port&cmd=a44", True) Case Is = "4-3" output = hs.GetURLIE("http://" & ip_address & "/get_data?type=port&cmd=a0F", True) Case Is = "4-4" output = hs.GetURLIE("http://" & ip_address & "/get_data?type=port&cmd=a51", True) End Select InterpretOutput(devref, output) End Sub Public Sub InterpretOutput(ByVal devref As Integer, ByVal output As String) 'output: Output1=1Output2=1Output3=1Output4=1 Dim data(3) As Integer data(0) = CInt(output(8).ToString) data(1) = CInt(output(17).ToString) data(2) = CInt(output(26).ToString) data(3) = CInt(output(35).ToString) Dim master As Integer = hs.GetDeviceParentRefByRef(devref) If master = 0 Then master = devref Dim dv As Scheduler.Classes.DeviceClass = hs.GetDeviceByRef(master) For Each devid As Integer In dv.AssociatedDevices(hs) Dim dev As Scheduler.Classes.DeviceClass = hs.GetDeviceByRef(devid) Select Case dev.Device_Type_String(hs) Case Is = "HDMI out 1" If hs.DeviceValue(devid) <> data(0) Then hs.SetDeviceValueByRef(devid, data(0), True) Else hs.SetDeviceValueByRef(devid, data(0), False) End If Case Is = "HDMI out 2" If hs.DeviceValue(devid) <> data(1) Then hs.SetDeviceValueByRef(devid, data(1), True) Else hs.SetDeviceValueByRef(devid, data(1), False) End If Case Is = "HDMI out 3" If hs.DeviceValue(devid) <> data(2) Then hs.SetDeviceValueByRef(devid, data(2), True) Else hs.SetDeviceValueByRef(devid, data(2), False) End If Case Is = "HDMI out 4" If hs.DeviceValue(devid) <> data(3) Then hs.SetDeviceValueByRef(devid, data(3), True) Else hs.SetDeviceValueByRef(devid, data(3), False) End If End Select Next End Sub Gir:1 poeng
-
Ja, her er det bare å kopiere og bruke scriptene som du vil. Bare husk på å forandre på Reference IDen slik at de passer ditt system.1 poeng
-
RDP er vel like trygt som VNC, ser ingen grunn til å ikke bruke det. Jeg bruker imidlertid LogMeIn, og er veldig fornøyd med det! Ulempen er at det koster (til og med en del), men det er veldig hendig, kjapt og enkelt. Et alternativ er TeamViewer. Noen påstår at de har blitt hacket, mens TeamViewer selv skylder på at enkelte brukere har samme passord overalt slik at LinkedIn-angrepet i 2012 fremdeles kan brukes i dag. Men så lenge du har et godt passord på TeamViewer (og de støtter til og med to-faktor autentisering), og passord på PCen du skal styre, vil jeg anslå at risikoen er minimal. Bare vær klar over at så lenge en maskin er knyttet til internett med en eller flere tjenester, oppstår det et sikkerhetsspørsmål. Så lenge du bruker sunn fornuft (f.eks. ikke setter kamera rett på nettet uten passord, á la Dagbladets #NullCtrl), så vil det stort sett gå greit. Hvis noen virkelig, VIRKELIG vil inn på maskinen din, så vil de komme til å klare det. Men du er ikke Pentagon så sannsynligheten er lav.1 poeng
-
1 poeng
Vinnerlisten er satt til Oslo/GMT+02:00